From owner-freebsd-current@FreeBSD.ORG Wed Dec 1 15:04:03 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9DED106564A for ; Wed, 1 Dec 2010 15:04:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 732558FC16 for ; Wed, 1 Dec 2010 15:04:03 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id oB1ERmxt020669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Dec 2010 16:27:48 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id oB1ERm8X041927; Wed, 1 Dec 2010 16:27:48 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id oB1ERmd7041926; Wed, 1 Dec 2010 16:27:48 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 1 Dec 2010 16:27:48 +0200 From: Kostik Belousov To: Peter Holm Message-ID: <20101201142748.GN2392@deviant.kiev.zoral.com.ua> References: <1FA8A18C-9350-4C2D-B034-768566ACB718@gmail.com> <20101201110008.GA50719@x2.osted.lan> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Nu+27GzWfrM0D7m+" Content-Disposition: inline In-Reply-To: <20101201110008.GA50719@x2.osted.lan> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Garrett Cooper , Marshall Kirk McKusick , current@freebsd.org Subject: Re: How a full fsck screwed up my SU+J filesystem 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: Wed, 01 Dec 2010 15:04:04 -0000 --Nu+27GzWfrM0D7m+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 01, 2010 at 12:00:08PM +0100, Peter Holm wrote: > On Wed, Dec 01, 2010 at 01:28:06AM -0800, Garrett Cooper wrote: > > So... I was doing a portmaster -af today because vlc stopped playing a= udio (for some reason ... I kind of went on a pkg_cutleaves rampage and pro= bably deinstalled too much stuff), and the machine hardlocked during an upg= rade. I did a soft reboot and saw messages along the lines of "your journal= and filesystem mount time mismatched; running a full fsck". I figured "ok,= sure..." and let it do it's thing. Problem was that it pruned a lot of stu= ff from my /usr partition -- including the .sujournal !!! So now it's stuck= at Mounting local file systems: stating: > >=20 > > Failed to find journal. Use tunefs to create one > > Failed to start journal: 2 > >=20 > > (I assume the 2 means ENOENT). All of the above were printf(9)'s from = the kernel. > > Now the machine won't continue in multiuser mode (doesn't respond to i= nterrupts, no panic, etc). Going into ddb, I don't see anything in info_thr= eads (just a bunch of references to sched_switch, a few to fork_trampoline,= cpustop_handler, and kdb_enter). I'm going to try and massage the machine = back to life from single user mode, but the fact that this died in this way= (i.e. .sujournal getting nuked by a full fsck) is a bit disheartening for = SU+J :(... It would be nice if at least the fsck aborted before going and n= uking the journal :/... (or at the very least if the file wasn't removable = -- i.e. SF_NOUNLINK). > > Here's to hoping I can resuscitate the filesystem... > > Thanks, > > -Garrett_______________________________________________ >=20 > Thank you for reporting this. >=20 > I was able to reproduce the problem by: >=20 > tunefs -j enable /dev/md5a > mount /dev/md5a /mnt > chflags 0 /mnt/.sujournal > rm -f /mnt/.sujournal > umount /mnt > mount /dev/md5a /mnt >=20 > The mount(1) is now stuck in mntref. >=20 > http://people.freebsd.org/~pho/stress/log/kostik404.txt >=20 > A sequence of "tunefs -j disable" + "tunefs -j enable" should get > you going. The action is of the category "do not do it then" for sure. The problem in kostik404 is due to ffs_mount() did not cleaned up the vnodes instantiated during the mount. Activating softdep journal instantiates at least root vnode, and a journal vnode, if found. The following patch fixed it for me. diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 94951e4..72f40da 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -928,6 +928,7 @@ ffs_mountfs(devvp, mp, td) if ((fs->fs_flags & FS_DOSOFTDEP) && (error =3D softdep_mount(devvp, mp, fs, cred)) !=3D 0) { free(fs->fs_csp, M_UFSMNT); + ffs_flushfiles(mp, FORCECLOSE, td); goto out; } if (fs->fs_snapinum[0] !=3D 0) --Nu+27GzWfrM0D7m+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkz2W2QACgkQC3+MBN1Mb4iqggCeNPP2xM8RVCRMnRURL8SvLVLT 57UAniW3pf+qBzfDwWIORAP3bFTRPBUX =iqzH -----END PGP SIGNATURE----- --Nu+27GzWfrM0D7m+--