From owner-svn-src-all@FreeBSD.ORG Mon Mar 30 16:40:25 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9BD2BF8C; Mon, 30 Mar 2015 16:40:25 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7394BD14; Mon, 30 Mar 2015 16:40:25 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 82826B9CB; Mon, 30 Mar 2015 12:40:24 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Subject: Re: svn commit: r280760 - head/sys/ufs/ffs Date: Mon, 30 Mar 2015 11:05:18 -0400 Message-ID: <1562745.HBh4GIei5X@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <201503271355.t2RDtuLt071068@svn.freebsd.org> References: <201503271355.t2RDtuLt071068@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 30 Mar 2015 12:40:24 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2015 16:40:25 -0000 On Friday, March 27, 2015 01:55:56 PM Konstantin Belousov wrote: > Author: kib > Date: Fri Mar 27 13:55:56 2015 > New Revision: 280760 > URL: https://svnweb.freebsd.org/changeset/base/280760 > > Log: > Fix the hand after the immediate reboot when the following command > sequence is performed on UFS SU+J rootfs: > cp -Rp /sbin/init /sbin/init.old > mv -f /sbin/init.old /sbin/init > > Hang occurs on the rootfs unmount. There are two issues: > > 1. Removed init binary, which is still mapped, creates a reference to > the removed vnode. The inodeblock for such vnode must have active > inodedep, which is (eventually) linked through the unlinked list. This > means that ffs_sync(MNT_SUSPEND) cannot succeed, because number of > softdep workitems for the mp is always > 0. FFS is suspended during > unmount, so unmount just hangs. > > 2. As noted above, the inodedep is linked eventually. It is not > linked until the superblock is written. But at the vfs_unmountall() > time, when the rootfs is unmounted, the call is made to > ffs_unmount()->ffs_sync() before vflush(), and ffs_sync() only calls > ffs_sbupdate() after all workitems are flushed. It is masked for > normal system operations, because syncer works in parallel and > eventually flushes superblock. Syncer is stopped when rootfs > unmounted, so ffs_sync() must do sb update on its own. > > Correct the issues listed above. For MNT_SUSPEND, count the number of > linked unlinked inodedeps (this is not a typo) and substract the count > of such workitems from the total. For the second issue, the > ffs_sbupdate() is called right after device sync in ffs_sync() loop. > > There is third problem, occuring with both SU and SU+J. The > softdep_waitidle() loop, which waits for softdep_flush() thread to > clear the worklist, only waits 20ms max. It seems that the 1 tick, > specified for msleep(9), was a typo. > > Add fsync(devvp, MNT_WAIT) call to softdep_waitidle(), which seems to > significantly help the softdep thread, and change the MNT_LAZY update > at the reboot time to MNT_WAIT for similar reasons. Note that > userspace cannot create more work while devvp is flushed, since the > mount point is always suspended before the call to softdep_waitidle() > in unmount or remount path. Nice find! -- John Baldwin