Make sure to hold vnode lock when calling into VOP_GETATTR().

Discussed with:	mckusick, phk
This commit is contained in:
rwatson 2002-02-10 21:44:30 +00:00
parent ef612b7ce4
commit 2bbae54d18
3 changed files with 12 additions and 1 deletions

View File

@ -1727,7 +1727,9 @@ lseek(td, uap)
offset += fp->f_offset;
break;
case L_XTND:
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_GETATTR(vp, &vattr, cred, td);
VOP_UNLOCK(vp, 0, td);
if (error)
return (error);
if (noneg &&

View File

@ -1727,7 +1727,9 @@ lseek(td, uap)
offset += fp->f_offset;
break;
case L_XTND:
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_GETATTR(vp, &vattr, cred, td);
VOP_UNLOCK(vp, 0, td);
if (error)
return (error);
if (noneg &&

View File

@ -485,8 +485,13 @@ vn_statfile(fp, sb, td)
struct thread *td;
{
struct vnode *vp = (struct vnode *)fp->f_data;
int error;
return vn_stat(vp, sb, td);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = vn_stat(vp, sb, td);
VOP_UNLOCK(vp, 0, td);
return (error);
}
int
@ -617,7 +622,9 @@ vn_ioctl(fp, com, data, td)
case VREG:
case VDIR:
if (com == FIONREAD) {
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td);
VOP_UNLOCK(vp, 0, td);
if (error)
return (error);
*(int *)data = vattr.va_size - fp->f_offset;