Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs Fix more dvp->v_mount after vput(dvp).



details:   https://anonhg.NetBSD.org/src/rev/acc65aa1cae4
branches:  trunk
changeset: 807732:acc65aa1cae4
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Apr 20 21:02:49 2015 +0000

description:
Fix more dvp->v_mount after vput(dvp).

diffstat:

 sys/ufs/lfs/ulfs_vnops.c |  18 +++++++++++-------
 sys/ufs/ufs/ufs_vnops.c  |  17 +++++++++--------
 2 files changed, 20 insertions(+), 15 deletions(-)

diffs (160 lines):

diff -r 9ef0e3bde27a -r acc65aa1cae4 sys/ufs/lfs/ulfs_vnops.c
--- a/sys/ufs/lfs/ulfs_vnops.c  Mon Apr 20 20:19:52 2015 +0000
+++ b/sys/ufs/lfs/ulfs_vnops.c  Mon Apr 20 21:02:49 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ulfs_vnops.c,v 1.23 2015/03/27 19:47:14 riastradh Exp $        */
+/*     $NetBSD: ulfs_vnops.c,v 1.24 2015/04/20 21:02:49 riastradh Exp $        */
 /*  from NetBSD: ufs_vnops.c,v 1.213 2013/06/08 05:47:02 kardel Exp  */
 
 /*-
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.23 2015/03/27 19:47:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.24 2015/04/20 21:02:49 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -502,18 +502,21 @@
        } */ *ap = v;
        struct vnode    *vp, *dvp;
        struct inode    *ip;
+       struct mount    *mp;
        int             error;
        struct ulfs_lookup_results *ulr;
 
        vp = ap->a_vp;
        dvp = ap->a_dvp;
        ip = VTOI(vp);
+       mp = dvp->v_mount;
+       KASSERT(mp == vp->v_mount); /* XXX Not stable without lock.  */
 
        /* XXX should handle this material another way */
        ulr = &VTOI(dvp)->i_crap;
        ULFS_CHECK_CRAPCOUNTER(VTOI(dvp));
 
-       fstrans_start(dvp->v_mount, FSTRANS_SHARED);
+       fstrans_start(mp, FSTRANS_SHARED);
        if (vp->v_type == VDIR || (ip->i_flags & (IMMUTABLE | APPEND)) ||
            (VTOI(dvp)->i_flags & APPEND))
                error = EPERM;
@@ -528,7 +531,7 @@
        else
                vput(vp);
        vput(dvp);
-       fstrans_done(dvp->v_mount);
+       fstrans_done(mp);
        return (error);
 }
 
@@ -546,6 +549,7 @@
        struct vnode *dvp = ap->a_dvp;
        struct vnode *vp = ap->a_vp;
        struct componentname *cnp = ap->a_cnp;
+       struct mount *mp = dvp->v_mount;
        struct inode *ip;
        struct lfs_direct *newdir;
        int error;
@@ -553,13 +557,13 @@
 
        KASSERT(dvp != vp);
        KASSERT(vp->v_type != VDIR);
-       KASSERT(dvp->v_mount == vp->v_mount);
+       KASSERT(mp == vp->v_mount); /* XXX Not stable without lock.  */
 
        /* XXX should handle this material another way */
        ulr = &VTOI(dvp)->i_crap;
        ULFS_CHECK_CRAPCOUNTER(VTOI(dvp));
 
-       fstrans_start(dvp->v_mount, FSTRANS_SHARED);
+       fstrans_start(mp, FSTRANS_SHARED);
        error = vn_lock(vp, LK_EXCLUSIVE);
        if (error) {
                VOP_ABORTOP(dvp, cnp);
@@ -597,7 +601,7 @@
        VN_KNOTE(vp, NOTE_LINK);
        VN_KNOTE(dvp, NOTE_WRITE);
        vput(dvp);
-       fstrans_done(dvp->v_mount);
+       fstrans_done(mp);
        return (error);
 }
 
diff -r 9ef0e3bde27a -r acc65aa1cae4 sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c   Mon Apr 20 20:19:52 2015 +0000
+++ b/sys/ufs/ufs/ufs_vnops.c   Mon Apr 20 21:02:49 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_vnops.c,v 1.228 2015/04/01 20:03:11 riastradh Exp $        */
+/*     $NetBSD: ufs_vnops.c,v 1.229 2015/04/20 21:02:49 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.228 2015/04/01 20:03:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.229 2015/04/20 21:02:49 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -731,7 +731,7 @@
        dvp = ap->a_dvp;
        ip = VTOI(vp);
        mp = dvp->v_mount;
-       KASSERT(mp == vp->v_mount);
+       KASSERT(mp == vp->v_mount); /* XXX Not stable without lock.  */
 
        /* XXX should handle this material another way */
        ulr = &VTOI(dvp)->i_crap;
@@ -774,6 +774,7 @@
        struct vnode *dvp = ap->a_dvp;
        struct vnode *vp = ap->a_vp;
        struct componentname *cnp = ap->a_cnp;
+       struct mount *mp = dvp->v_mount;
        struct inode *ip;
        struct direct *newdir;
        int error;
@@ -781,13 +782,13 @@
 
        KASSERT(dvp != vp);
        KASSERT(vp->v_type != VDIR);
-       KASSERT(dvp->v_mount == vp->v_mount);
+       KASSERT(mp == vp->v_mount); /* XXX Not stable without lock.  */
 
        /* XXX should handle this material another way */
        ulr = &VTOI(dvp)->i_crap;
        UFS_CHECK_CRAPCOUNTER(VTOI(dvp));
 
-       fstrans_start(dvp->v_mount, FSTRANS_SHARED);
+       fstrans_start(mp, FSTRANS_SHARED);
        error = vn_lock(vp, LK_EXCLUSIVE);
        if (error) {
                VOP_ABORTOP(dvp, cnp);
@@ -804,7 +805,7 @@
                error = EPERM;
                goto out1;
        }
-       error = UFS_WAPBL_BEGIN(vp->v_mount);
+       error = UFS_WAPBL_BEGIN(mp);
        if (error) {
                VOP_ABORTOP(dvp, cnp);
                goto out1;
@@ -825,14 +826,14 @@
                ip->i_flag |= IN_CHANGE;
                UFS_WAPBL_UPDATE(vp, NULL, NULL, UPDATE_DIROP);
        }
-       UFS_WAPBL_END(vp->v_mount);
+       UFS_WAPBL_END(mp);
  out1:
        VOP_UNLOCK(vp);
  out2:
        VN_KNOTE(vp, NOTE_LINK);
        VN_KNOTE(dvp, NOTE_WRITE);
        vput(dvp);
-       fstrans_done(dvp->v_mount);
+       fstrans_done(mp);
        return (error);
 }
 



Home | Main Index | Thread Index | Old Index