From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 14 22:06:45 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CDFF4D2D; Fri, 14 Jun 2013 22:06:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C04C31B11; Fri, 14 Jun 2013 22:06:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5EM6j0T094235; Fri, 14 Jun 2013 22:06:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5EM6jYc094234; Fri, 14 Jun 2013 22:06:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306142206.r5EM6jYc094234@svn.freebsd.org> From: John Baldwin Date: Fri, 14 Jun 2013 22:06:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251764 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 22:06:45 -0000 Author: jhb Date: Fri Jun 14 22:06:45 2013 New Revision: 251764 URL: http://svnweb.freebsd.org/changeset/base/251764 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/8/sys/kern/vfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/vfs_vnops.c ============================================================================== --- stable/8/sys/kern/vfs_vnops.c Fri Jun 14 22:06:18 2013 (r251763) +++ stable/8/sys/kern/vfs_vnops.c Fri Jun 14 22:06:45 2013 (r251764) @@ -952,13 +952,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,