Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ufs Don't use dvp after vput(dvp).



details:   https://anonhg.NetBSD.org/src/rev/ec458b69cea2
branches:  trunk
changeset: 337087:ec458b69cea2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Apr 01 20:03:11 2015 +0000

description:
Don't use dvp after vput(dvp).

Still don't understand why the fstrans_done must happen after the
vput, and that will cause trouble once we move responsibility for the
vrele and unlock outside the vop as it seems obvious we ought to do
-- it's the caller's reference, not the vop's.

diffstat:

 sys/ufs/ufs/ufs_vnops.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 31a263a4e8df -r ec458b69cea2 sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c   Wed Apr 01 19:46:19 2015 +0000
+++ b/sys/ufs/ufs/ufs_vnops.c   Wed Apr 01 20:03:11 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_vnops.c,v 1.227 2015/03/27 19:47:14 riastradh Exp $        */
+/*     $NetBSD: ufs_vnops.c,v 1.228 2015/04/01 20:03:11 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.227 2015/03/27 19:47:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.228 2015/04/01 20:03:11 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -723,27 +723,30 @@
        } */ *ap = v;
        struct vnode    *vp, *dvp;
        struct inode    *ip;
+       struct mount    *mp;
        int             error;
        struct ufs_lookup_results *ulr;
 
        vp = ap->a_vp;
        dvp = ap->a_dvp;
        ip = VTOI(vp);
+       mp = dvp->v_mount;
+       KASSERT(mp == vp->v_mount);
 
        /* 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);
        if (vp->v_type == VDIR || (ip->i_flags & (IMMUTABLE | APPEND)) ||
            (VTOI(dvp)->i_flags & APPEND))
                error = EPERM;
        else {
-               error = UFS_WAPBL_BEGIN(dvp->v_mount);
+               error = UFS_WAPBL_BEGIN(mp);
                if (error == 0) {
                        error = ufs_dirremove(dvp, ulr,
                                              ip, ap->a_cnp->cn_flags, 0);
-                       UFS_WAPBL_END(dvp->v_mount);
+                       UFS_WAPBL_END(mp);
                }
        }
        VN_KNOTE(vp, NOTE_DELETE);
@@ -753,7 +756,7 @@
        else
                vput(vp);
        vput(dvp);
-       fstrans_done(dvp->v_mount);
+       fstrans_done(mp);
        return (error);
 }
 



Home | Main Index | Thread Index | Old Index