ffs_snapblkfree(): add a comment explaining lockmgr invocation

Reviewed by:	markj, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34072
This commit is contained in:
Konstantin Belousov 2022-01-23 02:33:18 +02:00
parent 0cdc603308
commit 4559700a0a

View File

@ -1800,9 +1800,15 @@ retry:
VI_UNLOCK(devvp);
return (0);
}
/*
* Use LK_SLEEPFAIL because sn might be freed under us while
* both devvp interlock and snaplk are not owned.
*/
if (lockmgr(&sn->sn_lock, LK_INTERLOCK | LK_EXCLUSIVE | LK_SLEEPFAIL,
VI_MTX(devvp)) != 0)
goto retry;
TAILQ_FOREACH(ip, &sn->sn_head, i_nextsnap) {
vp = ITOV(ip);
if (DOINGSOFTDEP(vp))