Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/tmpfs Change tmpfs_chsize() to update mtime etc. even...



details:   https://anonhg.NetBSD.org/src/rev/c30cfb68aa0a
branches:  trunk
changeset: 820234:c30cfb68aa0a
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Jan 04 10:06:43 2017 +0000

description:
Change tmpfs_chsize() to update mtime etc. even if "length == node->tn_size".

Adresses PR kern/51762 "mtime not updated by open(O_TRUNC)"

diffstat:

 sys/fs/tmpfs/tmpfs_subr.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (33 lines):

diff -r 4f3982ca059f -r c30cfb68aa0a sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Wed Jan 04 10:04:17 2017 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Wed Jan 04 10:06:43 2017 +0000
@@ -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 @@
        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);



Home | Main Index | Thread Index | Old Index