Protect v_rdev dereference with the vnode interlock instead of the

vnode lock.

Caller of softdep_count_dependencies() may own a buffer lock, which
might conflict with the lock order.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
This commit is contained in:
Konstantin Belousov 2017-08-25 09:51:22 +00:00
parent 9fe191043b
commit 2f9d88c7ae

View File

@ -13937,9 +13937,9 @@ softdep_count_dependencies(bp, wantcount)
*/
retry:
if (vp->v_type == VCHR) {
VOP_LOCK(vp, LK_RETRY | LK_EXCLUSIVE);
VI_LOCK(vp);
mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL;
VOP_UNLOCK(vp, 0);
VI_UNLOCK(vp);
if (mp == NULL)
goto retry;
} else if (vp->v_type == VREG) {