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
This commit is contained in:
Attilio Rao 2014-03-19 01:13:42 +00:00
parent c149e542a5
commit 0d8243cc34
2 changed files with 3 additions and 3 deletions

View File

@ -903,7 +903,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
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);
}

View File

@ -1713,7 +1713,7 @@ swp_pager_force_pagein(vm_object_t object, vm_pindex_t pindex)
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 object, vm_pindex_t pindex)
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);