From nobody Wed Aug 24 06:29:42 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MCGRC1pjVz4ZNrK; Wed, 24 Aug 2022 06:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MCGRC1Hn5z3P0f; Wed, 24 Aug 2022 06:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661322583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6OAXH3VUaNWKpLE3wkl3RZBYdY5EfKsX3bEC3pyyvAM=; b=VRwdbC/Ane1asQ1Q6rC2HxwDGg/hjv3pmmfzGQ4T95qvGJ5hbTJraGtcoiI0uiF67Pu38j nSoznmXtzQAPmSuAAVbXfmKGAGSBUteXp8QARr+gdL7uZx7B+2ydEQWte+r4hVu+u93HxD zaGF9xLQ1zOGlPA+C6oLNTjAJkwORvpl33W/C762b2TNcvBgoI/kZqo3SC8ohUwrCC/6Nn 15vpYQdtQe5Ct3ClJA5Pt1Dxxt8QUYh5HUeB/4gPsQ8rQEUHKCOh/gg1M4W1LqCQeZQ8cK jQEj1E64PCUvol0+uqGiaTLqbPMe869WGeHWNdk/7+vUd0gR7JZiGmd/Oo1aBw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MCGRC09Grzyc7; Wed, 24 Aug 2022 06:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27O6Tgta066793; Wed, 24 Aug 2022 06:29:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27O6Tgi8066792; Wed, 24 Aug 2022 06:29:42 GMT (envelope-from git) Date: Wed, 24 Aug 2022 06:29:42 GMT Message-Id: <202208240629.27O6Tgi8066792@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: be639cc8eef0 - main - Update standard superblock when successful using an alternate superblock. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be639cc8eef01a2b8849939eb07cfde476146794 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661322583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6OAXH3VUaNWKpLE3wkl3RZBYdY5EfKsX3bEC3pyyvAM=; b=HEJAFqJcR2uiLcqX+I3LY5njtOz+rGoe1PXyY/fUFUToEqxYKURP3ECZfqut1yb3+K4Pr7 /oXjvWP3yCOSAq2dIpK50Albg+JkFZqiQMxQosPvk/6RYkYF2gw8iUHt8AX1dAPpSsfamH Kh/pnMV/YGlmy1PMoaV+q/YgLZ19SfLDCbg7CvYzgA/AGRVMzLgiaG3P6GpVpNCAvpE0vc H5IL+UckTf+NhY5uPJmiD1xsa3SUGT7qpLBW5hAnOi27aVQNyJ2JrQ37a9cfb/2fq+/mLQ S15oh/nVCVNPB8MshtBTjcjm5qWA71uTC747etFac9zwotRS/uKgoBLUIrxj2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661322583; a=rsa-sha256; cv=none; b=jRfeP3JmqwV7bmqkOWcBFMNLBnxKLXMQsDEUULwM20WaOor1g8BFclmI41tB3KBCOhN6+z J1ikIMBfue0i2v6tHCHL0Iw6alrYmNOzjxXn7X5CJTnGyirpsQ2omeTlScd6IWOzokkXYq Af7anjweuf05dFWKcedFiwYrX49Ab8EzyO69873uEHhPyZ62+j74n0AgWC1wFjyEeTcI8Y 2l6lDLVF9TFIMBXFU9nIRerQNT2XGes0UvWBybzmPfjKLcIjFjPwdkbVXy/NpsPtS96Afg V83j212y0O9lYQjCuHIbi9lE0eo4goBdXRkBcenJTmqbC2MMp/NRcj9CQnPJgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=be639cc8eef01a2b8849939eb07cfde476146794 commit be639cc8eef01a2b8849939eb07cfde476146794 Author: Kirk McKusick AuthorDate: 2022-08-24 06:28:30 +0000 Commit: Kirk McKusick CommitDate: 2022-08-24 06:29:17 +0000 Update standard superblock when successful using an alternate superblock. Historically fsck_ffs(8) would only use alternate superblocks when running in manual mode. When the standard superblock fails, it now tries to find and use a backup superblocks even when running in `preen' mode. If an alternate superblock is found and the filesystem is successfully cleaned up using it, write the alternate superblock back to the standard superblock so that the filesystem can be subsequently mounted and used. Reported by: Peter Holm Tested by: Peter Holm Sponsored by: The FreeBSD Foundation --- sbin/fsck_ffs/fsutil.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 424f8d9794f6..57853abe5442 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -682,14 +682,17 @@ ckfini(int markclean) if (debug) printf("Flush the superblock\n"); flush(fswritefd, &sblk); - if (havesb && cursnapshot == 0 && sblock.fs_magic == FS_UFS2_MAGIC && - sblk.b_bno != sblock.fs_sblockloc / dev_bsize && - !preen && reply("UPDATE STANDARD SUPERBLOCK")) { - /* Change the write destination to standard superblock */ - sblock.fs_sblockactualloc = sblock.fs_sblockloc; - sblk.b_bno = sblock.fs_sblockloc / dev_bsize; - sbdirty(); - flush(fswritefd, &sblk); + if (havesb && cursnapshot == 0 && + sblk.b_bno != sblock.fs_sblockloc / dev_bsize) { + if (preen || reply("UPDATE STANDARD SUPERBLOCK")) { + /* Change write destination to standard superblock */ + sblock.fs_sblockactualloc = sblock.fs_sblockloc; + sblk.b_bno = sblock.fs_sblockloc / dev_bsize; + sbdirty(); + flush(fswritefd, &sblk); + } else { + markclean = 0; + } } if (cursnapshot == 0 && sblock.fs_clean != markclean) { if ((sblock.fs_clean = markclean) != 0) {