Date: Tue, 27 Aug 2013 03:11:49 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r254947 - stable/9/sys/kern Message-ID: <201308270311.r7R3Bnr0035339@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Aug 27 03:11:49 2013 New Revision: 254947 URL: http://svnweb.freebsd.org/changeset/base/254947 Log: Partial MFC of r253927 (by attilio): Remove unnecessary soft busy of the page before to do vn_rdwr() in kern_sendfile() which is unnecessary. MFC note: NFS implementation of VOP_READ() sometimes upgrades the vnode lock, which causes drop of the shared lock and sleep for exclusive. As result, busying of the page before the call to vn_rdwr() makes NFS code to wait for vnode lock while page is busy, which contradicts the proper order of vnode lock -> busy. The r250027, merged as part of r250907, started calling vm_page_grab() under the vnode lock. The page grab waits for the page busy state to drain, which makes the parallel sendfile(2) invocations on the same vnode vulnerable to the LOR described above. Note that r250027 only exposed the problem, which might be caused by other means as well, e.g. by parallel sendfile(2) and truncate(2). Sponsored by: The FreeBSD Foundation Modified: stable/9/sys/kern/uipc_syscalls.c Modified: stable/9/sys/kern/uipc_syscalls.c ============================================================================== --- stable/9/sys/kern/uipc_syscalls.c Tue Aug 27 01:40:13 2013 (r254946) +++ stable/9/sys/kern/uipc_syscalls.c Tue Aug 27 03:11:49 2013 (r254947) @@ -2124,11 +2124,6 @@ retry_space: else { ssize_t resid; - /* - * Ensure that our page is still around - * when the I/O completes. - */ - vm_page_io_start(pg); VM_OBJECT_UNLOCK(obj); /* @@ -2144,10 +2139,8 @@ retry_space: IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), td->td_ucred, NOCRED, &resid, td); VFS_UNLOCK_GIANT(vfslocked); - VM_OBJECT_LOCK(obj); - vm_page_io_finish(pg); - if (!error) - VM_OBJECT_UNLOCK(obj); + if (error) + VM_OBJECT_LOCK(obj); mbstat.sf_iocnt++; } if (error) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308270311.r7R3Bnr0035339>