Don't take devmtx unnecessarily in vn_isdisk.

MFC after:	1 week
This commit is contained in:
Mateusz Guzik 2014-10-15 05:17:36 +00:00
parent 028d58547d
commit 32e7f8e4d5

View File

@ -3775,17 +3775,20 @@ vn_isdisk(struct vnode *vp, int *errp)
{
int error;
if (vp->v_type != VCHR) {
error = ENOTBLK;
goto out;
}
error = 0;
dev_lock();
if (vp->v_type != VCHR)
error = ENOTBLK;
else if (vp->v_rdev == NULL)
if (vp->v_rdev == NULL)
error = ENXIO;
else if (vp->v_rdev->si_devsw == NULL)
error = ENXIO;
else if (!(vp->v_rdev->si_devsw->d_flags & D_DISK))
error = ENOTBLK;
dev_unlock();
out:
if (errp != NULL)
*errp = error;
return (error == 0);