Source-Changes-HG archive

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

[src/trunk]: src/sys/fs Update mtime when updating file size.



details:   https://anonhg.NetBSD.org/src/rev/fe9bf1223dcf
branches:  trunk
changeset: 352551:fe9bf1223dcf
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Apr 08 08:49:44 2017 +0000

description:
Update mtime when updating file size.

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

diffstat:

 sys/fs/puffs/puffs_vnops.c |  5 +++--
 sys/fs/v7fs/v7fs_vnops.c   |  9 ++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r b90627a54a2b -r fe9bf1223dcf sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c        Sat Apr 08 02:02:30 2017 +0000
+++ b/sys/fs/puffs/puffs_vnops.c        Sat Apr 08 08:49:44 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_vnops.c,v 1.207 2017/04/06 00:02:19 christos Exp $       */
+/*     $NetBSD: puffs_vnops.c,v 1.208 2017/04/08 08:49:44 hannken Exp $        */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.207 2017/04/06 00:02:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.208 2017/04/08 08:49:44 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -1252,6 +1252,7 @@
                pn->pn_serversize = vap->va_size;
                if (flags & SETATTR_CHSIZE)
                        uvm_vnp_setsize(vp, vap->va_size);
+               puffs_updatenode(pn, PUFFS_UPDATECTIME | PUFFS_UPDATEMTIME, 0);
        }
 
        return 0;
diff -r b90627a54a2b -r fe9bf1223dcf sys/fs/v7fs/v7fs_vnops.c
--- a/sys/fs/v7fs/v7fs_vnops.c  Sat Apr 08 02:02:30 2017 +0000
+++ b/sys/fs/v7fs/v7fs_vnops.c  Sat Apr 08 08:49:44 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: v7fs_vnops.c,v 1.22 2016/08/20 12:37:08 hannken Exp $  */
+/*     $NetBSD: v7fs_vnops.c,v 1.23 2017/04/08 08:51:02 hannken Exp $  */
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.22 2016/08/20 12:37:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.23 2017/04/08 08:51:02 hannken Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -499,8 +499,11 @@
        /* File size change. */
        if ((vap->va_size != VNOVAL) && (vp->v_type == VREG)) {
                error = v7fs_datablock_size_change(fs, vap->va_size, inode);
-               if (error == 0)
+               if (error == 0) {
                        uvm_vnp_setsize(vp, vap->va_size);
+                       v7node->update_mtime = true;
+                       v7node->update_ctime = true;
+               }
        }
        uid_t uid = inode->uid;
        gid_t gid = inode->gid;



Home | Main Index | Thread Index | Old Index