svn commit: r251762 - stable/9/sys/kern
John Baldwin
jhb at FreeBSD.org
Fri Jun 14 21:56:10 UTC 2013
Author: jhb
Date: Fri Jun 14 21:56:10 2013
New Revision: 251762
URL: http://svnweb.freebsd.org/changeset/base/251762
Log:
MFC 250220:
Fix FIONREAD on regular files. The computed result was being ignored and
it was being passed down to VOP_IOCTL() where it promptly resulted in
ENOTTY due to a missing else for the past 8 years. While here, use a
shared vnode lock while fetching the current file's size.
Modified:
stable/9/sys/kern/vfs_vnops.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/kern/vfs_vnops.c
==============================================================================
--- stable/9/sys/kern/vfs_vnops.c Fri Jun 14 21:14:36 2013 (r251761)
+++ stable/9/sys/kern/vfs_vnops.c Fri Jun 14 21:56:10 2013 (r251762)
@@ -1333,13 +1333,12 @@ vn_ioctl(fp, com, data, active_cred, td)
case VREG:
case VDIR:
if (com == FIONREAD) {
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ vn_lock(vp, LK_SHARED | LK_RETRY);
error = VOP_GETATTR(vp, &vattr, active_cred);
VOP_UNLOCK(vp, 0);
if (!error)
*(int *)data = vattr.va_size - fp->f_offset;
- }
- if (com == FIONBIO || com == FIOASYNC) /* XXX */
+ } else if (com == FIONBIO || com == FIOASYNC) /* XXX */
error = 0;
else
error = VOP_IOCTL(vp, com, data, fp->f_flag,
More information about the svn-src-stable-9
mailing list