diff options
-rw-r--r-- | sys/kern/vfs_extattr.c | 2 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 2 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 9 |
3 files changed, 12 insertions, 1 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 9b623e3..ebd45db 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -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 && diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 9b623e3..ebd45db 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -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 && diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index d7c4bc8..e9b3e90 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -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; |