- Properly lock v_vflags in getdirents().

This commit is contained in:
jeff 2002-09-25 02:13:38 +00:00
parent 8ec2a2de7d
commit 881a59ab9e
2 changed files with 28 additions and 8 deletions

View File

@ -3075,7 +3075,11 @@ ogetdirentries(td, uap)
return (error);
}
}
mp_fixme("Accessing vflags w/o vn lock.");
/*
* XXX We could delay dropping the lock above but
* union_dircheckp complicates things.
*/
vn_lock(vp, LK_EXCLUSIVE|LK_RETRY, td);
if ((vp->v_vflag & VV_ROOT) &&
(vp->v_mount->mnt_flag & MNT_UNION)) {
struct vnode *tvp = vp;
@ -3083,9 +3087,10 @@ ogetdirentries(td, uap)
VREF(vp);
fp->f_data = vp;
fp->f_offset = 0;
vrele(tvp);
vput(tvp);
goto unionread;
}
VOP_UNLOCK(vp, 0, td);
}
error = copyout(&loff, SCARG(uap, basep), sizeof(long));
fdrop(fp, td);
@ -3167,7 +3172,11 @@ getdirentries(td, uap)
return (error);
}
}
mp_fixme("Accessing vflag without vn lock.");
/*
* XXX We could delay dropping the lock above but
* union_dircheckp complicates things.
*/
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if ((vp->v_vflag & VV_ROOT) &&
(vp->v_mount->mnt_flag & MNT_UNION)) {
struct vnode *tvp = vp;
@ -3175,9 +3184,10 @@ getdirentries(td, uap)
VREF(vp);
fp->f_data = vp;
fp->f_offset = 0;
vrele(tvp);
vput(tvp);
goto unionread;
}
VOP_UNLOCK(vp, 0, td);
}
if (SCARG(uap, basep) != NULL) {
error = copyout(&loff, SCARG(uap, basep), sizeof(long));

View File

@ -3075,7 +3075,11 @@ ogetdirentries(td, uap)
return (error);
}
}
mp_fixme("Accessing vflags w/o vn lock.");
/*
* XXX We could delay dropping the lock above but
* union_dircheckp complicates things.
*/
vn_lock(vp, LK_EXCLUSIVE|LK_RETRY, td);
if ((vp->v_vflag & VV_ROOT) &&
(vp->v_mount->mnt_flag & MNT_UNION)) {
struct vnode *tvp = vp;
@ -3083,9 +3087,10 @@ ogetdirentries(td, uap)
VREF(vp);
fp->f_data = vp;
fp->f_offset = 0;
vrele(tvp);
vput(tvp);
goto unionread;
}
VOP_UNLOCK(vp, 0, td);
}
error = copyout(&loff, SCARG(uap, basep), sizeof(long));
fdrop(fp, td);
@ -3167,7 +3172,11 @@ getdirentries(td, uap)
return (error);
}
}
mp_fixme("Accessing vflag without vn lock.");
/*
* XXX We could delay dropping the lock above but
* union_dircheckp complicates things.
*/
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if ((vp->v_vflag & VV_ROOT) &&
(vp->v_mount->mnt_flag & MNT_UNION)) {
struct vnode *tvp = vp;
@ -3175,9 +3184,10 @@ getdirentries(td, uap)
VREF(vp);
fp->f_data = vp;
fp->f_offset = 0;
vrele(tvp);
vput(tvp);
goto unionread;
}
VOP_UNLOCK(vp, 0, td);
}
if (SCARG(uap, basep) != NULL) {
error = copyout(&loff, SCARG(uap, basep), sizeof(long));