Unlock correct lock in ffs_snapblkfree().

It is possible for ffs_snapblkfree() to race and lock snaplock while
the devvp snapdata is instantiated, but no snapshots exist.  In this
case the loop over snapshots in ffs_snapblkfree() is not executed, and
the local variable vp is left initialized to NULL.

Unlock using &sn->sn_lock and not vp->v_vnlock.  For the inodes on the
snapshot list, the locks are same.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2017-07-21 18:36:17 +00:00
parent f2e6bf5c05
commit c536471408

View File

@ -1935,7 +1935,7 @@ retry:
*/
if (error != 0 && wkhd != NULL)
softdep_freework(wkhd);
lockmgr(vp->v_vnlock, LK_RELEASE, NULL);
lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
return (error);
}