1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-26 16:18:31 +00:00

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@
This commit is contained in:
Jun Kuriyama 2004-06-18 14:35:17 +00:00
parent bf4f8992cd
commit 86030e4a00
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130690

View File

@ -424,6 +424,15 @@ ffs_snapshot(mp, snapfile)
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;