summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2006-03-19 21:05:10 +0000
committertegge <tegge@FreeBSD.org>2006-03-19 21:05:10 +0000
commitfe329e36c77c21b12b75b60ad9364fcd29e03245 (patch)
tree7044b5afa29924a844eb408aa9a93b217b18c552 /sys
parent1952671e7a76988d7d05b70ac6c163dbc3acb199 (diff)
downloadFreeBSD-src-fe329e36c77c21b12b75b60ad9364fcd29e03245.zip
FreeBSD-src-fe329e36c77c21b12b75b60ad9364fcd29e03245.tar.gz
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.
Diffstat (limited to 'sys')
-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 041ce47..16e953e 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);
OpenPOWER on IntegriCloud