diff options
author | kuriyama <kuriyama@FreeBSD.org> | 2004-06-18 14:35:17 +0000 |
---|---|---|
committer | kuriyama <kuriyama@FreeBSD.org> | 2004-06-18 14:35:17 +0000 |
commit | bf763fabc7aec0c75095cf8c0ff1b2e00cdf2274 (patch) | |
tree | 9a5bd913030b9e96dc4e942e7b87b42a295b66fb | |
parent | f2d71bff495ceecf24f46a6df7ccc8abd73a92b4 (diff) | |
download | FreeBSD-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.c | 9 |
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; |