Date: Fri, 22 Mar 2013 16:44:16 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248618 - user/attilio/vmobj-readlock/sys/vm Message-ID: <201303221644.r2MGiGFC025269@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Fri Mar 22 16:44:15 2013 New Revision: 248618 URL: http://svnweb.freebsd.org/changeset/base/248618 Log: Fix a problem when the page identity was changing after sleeping in vm_page_sleep* primitives. The lock can change as the page's object lock is not held, relocking then the wrong object in the end. Sponsored by: EMC / Isilon storage division Reported and tested by: pho Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.c Fri Mar 22 14:10:15 2013 (r248617) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.c Fri Mar 22 16:44:15 2013 (r248618) @@ -757,12 +757,21 @@ vm_page_readahead_finish(vm_page_t m) int vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg) { + vm_object_t obj; VM_OBJECT_ASSERT_WLOCKED(m->object); if ((m->oflags & VPO_BUSY) || (also_m_busy && m->busy)) { - VM_OBJECT_WUNLOCK(m->object); + /* + * The page-specific object must be cached because page + * identity can change during the sleep, causing the + * re-lock of a different object. + * It is assumed that a reference to the object is already + * held by the callers. + */ + obj = m->object; + VM_OBJECT_WUNLOCK(obj); vm_page_sleep(m, msg); - VM_OBJECT_WLOCK(m->object); + VM_OBJECT_WLOCK(obj); return (TRUE); } return (FALSE);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303221644.r2MGiGFC025269>