From owner-freebsd-bugs@FreeBSD.ORG Tue Nov 10 23:20:03 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CFDC106568D for ; Tue, 10 Nov 2009 23:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 102C78FC27 for ; Tue, 10 Nov 2009 23:20:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nAANK2A0092169 for ; Tue, 10 Nov 2009 23:20:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nAANK2RF092168; Tue, 10 Nov 2009 23:20:02 GMT (envelope-from gnats) Resent-Date: Tue, 10 Nov 2009 23:20:02 GMT Resent-Message-Id: <200911102320.nAANK2RF092168@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alekseev Sergey Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D042F1065670 for ; Tue, 10 Nov 2009 23:14:47 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id A56DD8FC1C for ; Tue, 10 Nov 2009 23:14:47 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id nAANEkN8042503 for ; Tue, 10 Nov 2009 23:14:47 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id nAANEkxP042501; Tue, 10 Nov 2009 23:14:46 GMT (envelope-from nobody) Message-Id: <200911102314.nAANEkxP042501@www.freebsd.org> Date: Tue, 10 Nov 2009 23:14:46 GMT From: Alekseev Sergey To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/140461: Fail to read from swap. The swap_pager.c contains incomplete routine as stated in its comments X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2009 23:20:03 -0000 >Number: 140461 >Category: kern >Synopsis: Fail to read from swap. The swap_pager.c contains incomplete routine as stated in its comments >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Nov 10 23:20:02 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Alekseev Sergey >Release: FreeBSD 7.2-RELEASE-p4 >Organization: >Environment: FreeBSD varnie.my.domain 7.2-RELEASE-p4 FreeBSD 7.2-RELEASE-p4 #0: Sat Oct 10 04:13:17 YEKST 2009 varnie@varnie.my.domain:/usr/obj/usr/src/sys/GENERIC i386 >Description: Few days ago i've added an additional swap on the partition (500MB) using the instructions (http://www.freebsd.org/doc/en/books/handbook/adding-swap-space.html). When i tried to shutdown i got the panic error: "savecore: reboot after panic: swap_pager_force_pagein: read from swap failed savecore: writing core to vmcore.2" and the FreeBSD box rebooted producing vmcore dump. During my researches i've found that the /usr/src/sys/vm/swap_pager.c contains *unfinished* function named "swp_pager_force_pagein". it is pretty clear it is incomplete from its comments. here it is: ////// /* * SWP_PAGER_FORCE_PAGEIN() - force a swap block to be paged in * * This routine dissociates the page at the given index within a * swap block from its backing store, paging it in if necessary. * If the page is paged in, it is placed in the inactive queue, * since it had its backing store ripped out from under it. * We also attempt to swap in all other pages in the swap block, * we only guarantee that the one at the specified index is * paged in. * * XXX - The code to page the whole block in doesn't work, so we * revert to the one-by-one behavior for now. Sigh. */ static inline void swp_pager_force_pagein(vm_object_t object, vm_pindex_t pindex) { vm_page_t m; vm_object_pip_add(object, 1); m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL|VM_ALLOC_RETRY); if (m->valid == VM_PAGE_BITS_ALL) { vm_object_pip_subtract(object, 1); vm_page_lock_queues(); vm_page_activate(m); vm_page_dirty(m); vm_page_unlock_queues(); vm_page_wakeup(m); vm_pager_page_unswapped(m); return; } 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_page_lock_queues(); vm_page_dirty(m); vm_page_dontneed(m); vm_page_unlock_queues(); vm_page_wakeup(m); vm_pager_page_unswapped(m); } ////// The programmer marked an unfinished piece of code with "/*XXX*/" and commented that "The code to page the whole block in doesn't work, so we revert to the one-by-one behavior for now. Sigh." I think it has to be finished/updated. Thank you for your efforts. ps: by the way, my hard-drive is healthy and contains no bad-blocks. i've checked it with several utils. >How-To-Repeat: add big enough additional swap in partition and try to shutdown the FreeBSD box properly. >Fix: >Release-Note: >Audit-Trail: >Unformatted: