Module Name: src
Committed By: hannken
Date: Wed Jan 4 10:06:43 UTC 2017
Modified Files:
src/sys/fs/tmpfs: tmpfs_subr.c
Log Message:
Change tmpfs_chsize() to update mtime etc. even if "length == node->tn_size".
Adresses PR kern/51762 "mtime not updated by open(O_TRUNC)"
To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/fs/tmpfs/tmpfs_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/tmpfs/tmpfs_subr.c
diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.101 src/sys/fs/tmpfs/tmpfs_subr.c:1.102
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.101 Thu Oct 29 16:19:44 2015
+++ src/sys/fs/tmpfs/tmpfs_subr.c Wed Jan 4 10:06:43 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_subr.c,v 1.101 2015/10/29 16:19:44 leot Exp $ */
+/* $NetBSD: tmpfs_subr.c,v 1.102 2017/01/04 10:06:43 hannken Exp $ */
/*
* Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.101 2015/10/29 16:19:44 leot Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.102 2017/01/04 10:06:43 hannken Exp $");
#include <sys/param.h>
#include <sys/cprng.h>
@@ -1125,12 +1125,10 @@ tmpfs_chsize(vnode_t *vp, u_quad_t size,
if (length < 0) {
return EINVAL;
}
- if (node->tn_size == length) {
- return 0;
- }
/* Note: tmpfs_reg_resize() will raise NOTE_EXTEND and NOTE_ATTRIB. */
- if ((error = tmpfs_reg_resize(vp, length)) != 0) {
+ if (node->tn_size != length &&
+ (error = tmpfs_reg_resize(vp, length)) != 0) {
return error;
}
tmpfs_update(vp, TMPFS_UPDATE_CTIME | TMPFS_UPDATE_MTIME);