From owner-svn-src-head@FreeBSD.ORG Wed Mar 19 01:13:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6A942706; Wed, 19 Mar 2014 01:13:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 565719FE; Wed, 19 Mar 2014 01:13:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2J1DhRP051460; Wed, 19 Mar 2014 01:13:43 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2J1Dgla051458; Wed, 19 Mar 2014 01:13:42 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201403190113.s2J1Dgla051458@svn.freebsd.org> From: Attilio Rao Date: Wed, 19 Mar 2014 01:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263328 - in head/sys: dev/md vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Mar 2014 01:13:43 -0000 Author: attilio Date: Wed Mar 19 01:13:42 2014 New Revision: 263328 URL: http://svnweb.freebsd.org/changeset/base/263328 Log: vm_page_grab() and vm_pager_get_pages() can drop the vm_object lock, then threads can sleep on the pip condition. Avoid to deadlock such threads by correctly awakening the sleeping ones after the pip is finished. swapoff side of the bug can likely result in shutdown deadlocks. Sponsored by: EMC / Isilon Storage Division Reported by: pho, pluknet Tested by: pho Modified: head/sys/dev/md/md.c head/sys/vm/swap_pager.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Wed Mar 19 00:55:12 2014 (r263327) +++ head/sys/dev/md/md.c Wed Mar 19 01:13:42 2014 (r263328) @@ -903,7 +903,7 @@ mdstart_swap(struct md_s *sc, struct bio offs = 0; ma_offs += len; } - vm_object_pip_subtract(sc->object, 1); + vm_object_pip_wakeup(sc->object); VM_OBJECT_WUNLOCK(sc->object); return (rv != VM_PAGER_ERROR ? 0 : ENOSPC); } Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Wed Mar 19 00:55:12 2014 (r263327) +++ head/sys/vm/swap_pager.c Wed Mar 19 01:13:42 2014 (r263328) @@ -1713,7 +1713,7 @@ swp_pager_force_pagein(vm_object_t objec vm_object_pip_add(object, 1); m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL); if (m->valid == VM_PAGE_BITS_ALL) { - vm_object_pip_subtract(object, 1); + vm_object_pip_wakeup(object); vm_page_dirty(m); vm_page_lock(m); vm_page_activate(m); @@ -1725,7 +1725,7 @@ swp_pager_force_pagein(vm_object_t objec if (swap_pager_getpages(object, &m, 1, 0) != VM_PAGER_OK) panic("swap_pager_force_pagein: read from swap failed");/*XXX*/ - vm_object_pip_subtract(object, 1); + vm_object_pip_wakeup(object); vm_page_dirty(m); vm_page_lock(m); vm_page_deactivate(m);