Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpvfs When truncating a file make sure to...



details:   https://anonhg.NetBSD.org/src/rev/afe099d01dc0
branches:  trunk
changeset: 827952:afe099d01dc0
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Nov 20 17:00:35 2017 +0000

description:
When truncating a file make sure to update mtime.
This fixes PR kern/51762 for rumpfs.

diffstat:

 sys/rump/librump/rumpvfs/rumpfs.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r e13625abd9bd -r afe099d01dc0 sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Mon Nov 20 16:41:55 2017 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Mon Nov 20 17:00:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpfs.c,v 1.151 2017/11/20 00:01:05 christos Exp $    */
+/*     $NetBSD: rumpfs.c,v 1.152 2017/11/20 17:00:35 martin Exp $      */
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.151 2017/11/20 00:01:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.152 2017/11/20 17:00:35 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -906,6 +906,7 @@
        }
 
        int flags = 0;
+       getnanotime(&now);
        if (vap->va_atime.tv_sec != VNOVAL)
                if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
                        flags |= RUMPFS_ACCESS;
@@ -913,11 +914,13 @@
                flags |= RUMPFS_CHANGE | RUMPFS_MODIFY;
                if (vp->v_mount->mnt_flag & MNT_RELATIME)
                        flags |= RUMPFS_ACCESS;
+       } else if (vap->va_size == 0) {
+               flags |= RUMPFS_MODIFY;
+               vap->va_mtime = now;
        }
        SETIFVAL(va_birthtime.tv_sec, time_t);
        SETIFVAL(va_birthtime.tv_nsec, long);
        flags |= RUMPFS_CHANGE;
-       getnanotime(&now);
        error = rumpfs_update(flags, vp, &vap->va_atime, &vap->va_mtime, &now);
        if (error)
                return error;



Home | Main Index | Thread Index | Old Index