Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/6da24f9be95d
branches:  netbsd-7
changeset: 799472:6da24f9be95d
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Jul 16 21:40:22 2015 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #850):
        sys/ufs/ufs/ufs_inode.c: revisions 1.93-1.95
Release the glock on VOP_GETPAGES failure.
Tripped over by nick@'s failing disk, missing unlock in error branch
discovered by jmcneill@.
--
ufs_inactive: take UFS_WAPBL_BEGIN() before calling chkiq().
Should fix PR kern/49948 (quota panic)
--
ufs_inactive: stop overwriting error status and return the last error seen.
Should resolve CID 1306276 (UNUSED_VALUE)

diffstat:

 sys/ufs/ufs/ufs_inode.c |  45 +++++++++++++++++++++++++++++----------------
 1 files changed, 29 insertions(+), 16 deletions(-)

diffs (102 lines):

diff -r baf959797794 -r 6da24f9be95d sys/ufs/ufs/ufs_inode.c
--- a/sys/ufs/ufs/ufs_inode.c   Thu Jul 16 21:36:59 2015 +0000
+++ b/sys/ufs/ufs/ufs_inode.c   Thu Jul 16 21:40:22 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_inode.c,v 1.90.2.1 2015/01/28 18:34:11 martin Exp $        */
+/*     $NetBSD: ufs_inode.c,v 1.90.2.2 2015/07/16 21:40:22 snj Exp $   */
 
 /*
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.90.2.1 2015/01/28 18:34:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.90.2.2 2015/07/16 21:40:22 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -84,27 +84,33 @@
        } */ *ap = v;
        struct vnode *vp = ap->a_vp;
        struct inode *ip = VTOI(vp);
-       struct mount *transmp;
+       struct mount *mp = vp->v_mount;
        mode_t mode;
-       int error = 0;
+       int allerror = 0, error;
+       bool wapbl_locked = false;
 
-       UFS_WAPBL_JUNLOCK_ASSERT(vp->v_mount);
+       UFS_WAPBL_JUNLOCK_ASSERT(mp);
 
-       transmp = vp->v_mount;
-       fstrans_start(transmp, FSTRANS_LAZY);
+       fstrans_start(mp, FSTRANS_LAZY);
        /*
         * Ignore inodes related to stale file handles.
         */
        if (ip->i_mode == 0)
                goto out;
-       if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
+       if (ip->i_nlink <= 0 && (mp->mnt_flag & MNT_RDONLY) == 0) {
 #ifdef UFS_EXTATTR
                ufs_extattr_vnode_inactive(vp, curlwp);
 #endif
                if (ip->i_size != 0)
-                       error = ufs_truncate(vp, 0, NOCRED);
+                       allerror = ufs_truncate(vp, 0, NOCRED);
 #if defined(QUOTA) || defined(QUOTA2)
-               (void)chkiq(ip, -1, NOCRED, 0);
+               error = UFS_WAPBL_BEGIN(mp);
+               if (error) {
+                       allerror = error;
+               } else {
+                       wapbl_locked = true;
+                       (void)chkiq(ip, -1, NOCRED, 0);
+               }
 #endif
                DIP_ASSIGN(ip, rdev, 0);
                mode = ip->i_mode;
@@ -118,21 +124,27 @@
        }
 
        if (ip->i_flag & (IN_CHANGE | IN_UPDATE | IN_MODIFIED)) {
-               error = UFS_WAPBL_BEGIN(vp->v_mount);
-               if (error)
-                       goto out;
+               if (! wapbl_locked) {
+                       error = UFS_WAPBL_BEGIN(mp);
+                       if (error) {
+                               allerror = error;
+                               goto out;
+                       }
+                       wapbl_locked = true;
+               }
                UFS_UPDATE(vp, NULL, NULL, 0);
-               UFS_WAPBL_END(vp->v_mount);
        }
 out:
+       if (wapbl_locked)
+               UFS_WAPBL_END(mp);
        /*
         * If we are done with the inode, reclaim it
         * so that it can be reused immediately.
         */
        *ap->a_recycle = (ip->i_mode == 0);
        VOP_UNLOCK(vp);
-       fstrans_done(transmp);
-       return (error);
+       fstrans_done(mp);
+       return (allerror);
 }
 
 /*
@@ -229,6 +241,7 @@
            VM_PROT_WRITE, 0, PGO_SYNCIO | PGO_PASTEOF | PGO_NOBLOCKALLOC |
            PGO_NOTIMESTAMP | PGO_GLOCKHELD);
        if (error) {
+               genfs_node_unlock(vp);
                goto out;
        }
 



Home | Main Index | Thread Index | Old Index