Don't take devmtx unnecessarily in vn_isdisk.
MFC after: 1 week
This commit is contained in:
parent
028d58547d
commit
32e7f8e4d5
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user