Date: Tue, 1 Nov 2016 17:11:10 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308174 - head/sys/vm Message-ID: <201611011711.uA1HBAKR043695@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Tue Nov 1 17:11:10 2016 New Revision: 308174 URL: https://svnweb.freebsd.org/changeset/base/308174 Log: Move and revise a comment about the relation between the object's paging- in-progress count and the vnode. Prior to r188331, we always acquired the vnode lock before incrementing the object's paging-in-progress count. Now, we increment it before attempting to acquire the vnode lock with LK_NOWAIT, but we never sleep acquiring the vnode lock while we have the count incremented. Reviewed by: kib MFC after: 3 days Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Nov 1 16:03:31 2016 (r308173) +++ head/sys/vm/vm_fault.c Tue Nov 1 17:11:10 2016 (r308174) @@ -420,8 +420,7 @@ fast_failed: * they will stay around as well. * * Bump the paging-in-progress count to prevent size changes (e.g. - * truncation operations) during I/O. This must be done after - * obtaining the vnode lock in order to avoid possible deadlocks. + * truncation operations) during I/O. */ vm_object_reference_locked(fs.first_object); vm_object_pip_add(fs.first_object, 1); @@ -647,7 +646,13 @@ readrest: if (locked != LK_EXCLUSIVE) locked = LK_SHARED; - /* Do not sleep for vnode lock while fs.m is busy */ + + /* + * We must not sleep acquiring the vnode lock + * while we have the page exclusive busied or + * the object's paging-in-progress count + * incremented. Otherwise, we could deadlock. + */ error = vget(vp, locked | LK_CANRECURSE | LK_NOWAIT, curthread); if (error != 0) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611011711.uA1HBAKR043695>