From owner-freebsd-current@FreeBSD.ORG Tue Sep 6 07:57:12 2005 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9055016A41F for ; Tue, 6 Sep 2005 07:57:12 +0000 (GMT) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 470A343D45 for ; Tue, 6 Sep 2005 07:57:12 +0000 (GMT) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id j867v42t031957; Tue, 6 Sep 2005 00:57:08 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <200509060757.j867v42t031957@gw.catspoiler.org> Date: Tue, 6 Sep 2005 00:57:04 -0700 (PDT) From: Don Lewis To: phk@haven.freebsd.dk In-Reply-To: <63946.1125992673@phk.freebsd.dk> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: current@FreeBSD.org Subject: Re: patch for ext2fs unmount problem at shutdown X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2005 07:57:12 -0000 On 6 Sep, Poul-Henning Kamp wrote: > In message <200509060739.j867dT0x031916@gw.catspoiler.org>, Don Lewis writes: >>Attached below is a patch to fix the problem caused by having any ext2fs >>file systems mounted at system shutdown time that prevents any of the >>file systems from being unmounted and then being marked dirty when the >>system comes back up. It works by tweaking ext2fs so that it marks the >>bufs that it keeps locked as long as the file system is mounted, and >>tweaks the shutdown code to ignore these bufs when it is counting the >>number of busy buffers. > > Why is this necessary ? As far as I know we do an orderly unmount > of all filesystems at shutdown, so shouldn't ext2fs release the > buffers at that time ? We count the busy buffers before unmounting anything, and skip the unmount if the count is nonzero. 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(); } It would be nice if we only skipped unmounting those file systems that failed to sync.