aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs
diff options
context:
space:
mode:
authorTor Egge <tegge@FreeBSD.org>2006-03-19 21:05:10 +0000
committerTor Egge <tegge@FreeBSD.org>2006-03-19 21:05:10 +0000
commit8c86028f11f9dddac95126a93ce85f4b038641f9 (patch)
tree7044b5afa29924a844eb408aa9a93b217b18c552 /sys/ufs
parent87f0769a577afb1571953509d71811e5ecc14b9d (diff)
downloadsrc-8c86028f11f9dddac95126a93ce85f4b038641f9.tar.gz
src-8c86028f11f9dddac95126a93ce85f4b038641f9.zip
Ensure that vnode for directory isn't reclaimed before ffs_snapshot() has
completed expunging unlinked files. It could come back at another memory location causing a lock order reversal.
Notes
Notes: svn path=/head/; revision=156895
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index 041ce47b3634..16e953efb5ed 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -269,12 +269,11 @@ restart:
}
VOP_LEASE(nd.ni_dvp, td, KERNCRED, LEASE_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vat);
- vhold(nd.ni_dvp);
- vput(nd.ni_dvp);
+ VOP_UNLOCK(nd.ni_dvp, 0, td);
if (error) {
NDFREE(&nd, NDF_ONLY_PNBUF);
vn_finished_write(wrtmp);
- vdrop(nd.ni_dvp);
+ vrele(nd.ni_dvp);
return (error);
}
vp = nd.ni_vp;
@@ -580,7 +579,6 @@ loop:
MNT_ILOCK(mp);
}
MNT_IUNLOCK(mp);
- vdrop(nd.ni_dvp);
/*
* If there already exist snapshots on this filesystem, grab a
* reference to their shared lock. If this is the first snapshot
@@ -796,6 +794,7 @@ out:
vput(vp);
else
VOP_UNLOCK(vp, 0, td);
+ vrele(nd.ni_dvp);
vn_finished_write(wrtmp);
process_deferred_inactive(mp);
return (error);