summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkuriyama <kuriyama@FreeBSD.org>2004-06-18 14:35:17 +0000
committerkuriyama <kuriyama@FreeBSD.org>2004-06-18 14:35:17 +0000
commitbf763fabc7aec0c75095cf8c0ff1b2e00cdf2274 (patch)
tree9a5bd913030b9e96dc4e942e7b87b42a295b66fb
parentf2d71bff495ceecf24f46a6df7ccc8abd73a92b4 (diff)
downloadFreeBSD-src-bf763fabc7aec0c75095cf8c0ff1b2e00cdf2274.zip
FreeBSD-src-bf763fabc7aec0c75095cf8c0ff1b2e00cdf2274.tar.gz
Avoid deadlock which is caused by locking VDIR of parent and VREG of
snapshot itself in wrong order. We can skip unlink check of that directory because it must have snapshot in it. Reviewed by: mckusick and current@
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index adfb41b..8557edc 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -424,6 +424,15 @@ loop:
MNT_ILOCK(mp);
continue;
}
+ /*
+ * We can skip parent directory vnode because it must have
+ * this snapshot file in it.
+ */
+ if (xvp == nd.ni_dvp) {
+ VI_UNLOCK(xvp);
+ MNT_ILOCK(mp);
+ continue;
+ }
if (vn_lock(xvp, LK_EXCLUSIVE | LK_INTERLOCK, td) != 0) {
MNT_ILOCK(mp);
goto loop;
OpenPOWER on IntegriCloud