Module Name:    src
Committed By:   riastradh
Date:           Wed Apr  1 20:03:11 UTC 2015

Modified Files:
        src/sys/ufs/ufs: ufs_vnops.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.227 -r1.228 src/sys/ufs/ufs/ufs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.227 src/sys/ufs/ufs/ufs_vnops.c:1.228
--- src/sys/ufs/ufs/ufs_vnops.c:1.227	Fri Mar 27 19:47:14 2015
+++ src/sys/ufs/ufs/ufs_vnops.c	Wed Apr  1 20:03:11 2015
@@ -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 @@ ufs_remove(void *v)
 	} */ *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 @@ ufs_remove(void *v)
 	else
 		vput(vp);
 	vput(dvp);
-	fstrans_done(dvp->v_mount);
+	fstrans_done(mp);
 	return (error);
 }
 

Reply via email to