Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/fs/puffs Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/ea8d3f61c72a
branches:  netbsd-7
changeset: 798343:ea8d3f61c72a
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Sep 11 14:00:54 2014 +0000

description:
Pull up following revision(s) (requested by manu in ticket #93):
        sys/fs/puffs/puffs_vnops.c: revision 1.186
PUFFS fixes for size update ater write plus read/write sanity checks
- Always update kernel metadata cache for size when writing
  This fixes situation where size update after appending to a file lagged
- Make read/write nilpotent when called with null size, as FFS does
- Return EFBIG instead of EINVAL for negative offsets, as FFS does

diffstat:

 sys/fs/puffs/puffs_vnops.c |  28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diffs (85 lines):

diff -r c5c5e20ca781 -r ea8d3f61c72a sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c        Thu Sep 11 13:58:45 2014 +0000
+++ b/sys/fs/puffs/puffs_vnops.c        Thu Sep 11 14:00:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_vnops.c,v 1.182.2.3 2014/09/10 08:42:28 martin Exp $     */
+/*     $NetBSD: puffs_vnops.c,v 1.182.2.4 2014/09/11 14:00:54 martin 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.182.2.3 2014/09/10 08:42:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.182.2.4 2014/09/11 14:00:54 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -2203,7 +2203,7 @@
        if (uio->uio_resid == 0)
                return 0;
        if (uio->uio_offset < 0)
-               return EINVAL;
+               return EFBIG;
 
        if (vp->v_type == VREG &&
            PUFFS_USE_PAGECACHE(pmp) &&
@@ -2310,6 +2310,12 @@
        error = uflags = 0;
        write_msg = NULL;
 
+       /* std sanity */
+       if (uio->uio_resid == 0)
+               return 0;
+       if (uio->uio_offset < 0)
+               return EFBIG;
+
        mutex_enter(&pn->pn_sizemtx);
 
        if (vp->v_type == VREG && 
@@ -2326,10 +2332,6 @@
 
                origoff = uio->uio_offset;
                while (uio->uio_resid > 0) {
-                       if (vp->v_mount->mnt_flag & MNT_RELATIME)
-                               uflags |= PUFFS_UPDATEATIME;
-                       uflags |= PUFFS_UPDATECTIME;
-                       uflags |= PUFFS_UPDATEMTIME;
                        oldoff = uio->uio_offset;
                        bytelen = uio->uio_resid;
 
@@ -2390,8 +2392,6 @@
                        error = VOP_PUTPAGES(vp, trunc_page(origoff),
                            round_page(uio->uio_offset), PGO_CLEANIT);
                }
-
-               puffs_updatenode(VPTOPP(vp), uflags, vp->v_size);
        } else {
                /* tomove is non-increasing */
                tomove = PUFFS_TOMOVE(uio->uio_resid, pmp);
@@ -2425,8 +2425,10 @@
                        }
 
                        /* adjust file size */
-                       if (vp->v_size < uio->uio_offset)
+                       if (vp->v_size < uio->uio_offset) {
+                               uflags |= PUFFS_UPDATESIZE;
                                uvm_vnp_setsize(vp, uio->uio_offset);
+                       }
 
                        /* didn't move everything?  bad userspace.  bail */
                        if (write_msg->pvnr_resid != 0) {
@@ -2437,6 +2439,12 @@
                puffs_msgmem_release(park_write);
        }
 
+       if (vp->v_mount->mnt_flag & MNT_RELATIME)
+               uflags |= PUFFS_UPDATEATIME;
+       uflags |= PUFFS_UPDATECTIME;
+       uflags |= PUFFS_UPDATEMTIME;
+       puffs_updatenode(VPTOPP(vp), uflags, vp->v_size);
+
        mutex_exit(&pn->pn_sizemtx);
        return error;
 }



Home | Main Index | Thread Index | Old Index