Skip to content

Commit

Permalink
ffs_snapblkfree(): add a comment explaining lockmgr invocation
Browse files Browse the repository at this point in the history
(cherry picked from commit 4559700)
  • Loading branch information
kostikbel committed Feb 7, 2022
1 parent 8fcc0d7 commit 773d9d7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sys/ufs/ffs/ffs_snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1807,9 +1807,15 @@ ffs_snapblkfree(fs, devvp, bno, size, inum, vtype, wkhd)
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))
Expand Down

0 comments on commit 773d9d7

Please sign in to comment.