From owner-freebsd-arch@FreeBSD.ORG Tue Sep 23 19:12:30 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E95E1065678; Tue, 23 Sep 2008 19:12:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id C6FEF8FC0C; Tue, 23 Sep 2008 19:12:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m8NJCNcj074806; Tue, 23 Sep 2008 15:12:23 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: arch@freebsd.org Date: Tue, 23 Sep 2008 15:09:40 -0400 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200809231509.40279.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Tue, 23 Sep 2008 15:12:24 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/8316/Tue Sep 23 05:40:56 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: pjd@freebsd.org Subject: Using a file-backed swap via md0 results in panic on reboot.. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Sep 2008 19:12:30 -0000 So if you attach an md device to a file and then use that md0 device for swap, you will get a panic on shutdown if the swap file was in use. The reason is that we remove swap devices _after_ unmounting the filesystems in boot(): if (nbusy) { /* * Failed to sync all blocks. Indicate this and don't * unmount filesystems (thus forcing an fsck on reboot). */ printf("Giving up on %d buffers\n", nbusy); DELAY(5000000); /* 5 seconds */ } else { if (!first_buf_printf) printf("Final sync complete\n"); /* * Unmount filesystems */ if (panicstr == 0) vfs_unmountall(); } swapoff_all(); DELAY(100000); /* wait for console output to finish */ Is there any reason we can't move the swapoff_all()? Should we perhaps only do it in "clean" case? Alternatively, should the swapoff_all() during shutdown have a special flag so that it doesn't actually read in any data from disk and just throws away the data instead? Sample panic: Waiting (max 60 seconds) for system process `vnlru' to stop...done Waiting (max 60 seconds) for system process `syncer' to stop... Syncing disks, vnodes remaining...2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 done Waiting (max 60 seconds) for system process `bufdaemon' to stop...done All buffers synced. Swap device ad0s1b removed. swap_pager: I/O error - pagein failed; blkno 2097177,size 4096, error 5 panic: swap_pager_force_pagein: read from swap failed cpuid = 0 KDB: stack backtrace: panic() at panic+0x2c5 swapoff_one() at swapoff_one+0x5bb swapoff_all() at swapoff_all+0xe4 boot() at boot+0x871 reboot() at reboot+0x45 syscall() at syscall+0x642 Xfast_syscall() at Xfast_syscall+0xa8 -- John Baldwin