Module Name:    src
Committed By:   hannken
Date:           Sat Apr  8 08:51:02 UTC 2017

Modified Files:
        src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
Update mtime when updating file size.

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


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/fs/v7fs/v7fs_vnops.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/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.22 src/sys/fs/v7fs/v7fs_vnops.c:1.23
--- src/sys/fs/v7fs/v7fs_vnops.c:1.22	Sat Aug 20 12:37:08 2016
+++ src/sys/fs/v7fs/v7fs_vnops.c	Sat Apr  8 08:51:02 2017
@@ -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 @@ v7fs_setattr(void *v)
 	/* 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;

Reply via email to