From nobody Mon Feb 28 05:38:43 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 17AA519E5EAC; Mon, 28 Feb 2022 05:38:44 +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 4K6Th407hVz3q6W; Mon, 28 Feb 2022 05:38:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646026724; 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=khs4c7pogJZ5ONdQ7cgWLy6+ITVPZfTyFs/DvVniios=; b=VgGDWWevyz3Ue1kRRkg5FzC04MYXpRB5EH1CZpvIZ9y4xLJ9XeGPQnEA0sqb5SNE2Poo3U HZsVCQrxVCZlZkPiLMTbVzUfJKzxwfXYJ+zsfNyvMwC4/h6B+q5g7gEWO9MxNaWFiAYs75 fVFA+nLMYd9HhF+/UMj8YOeDlFtRxKxo6SZE+in+4D0fEHOJnJM2/2nU7wKhb8TG8V3BX+ HoBBL4TKqIJJV1RDKZRIKz9wawwa31tXsMKJ6yPGZ3kHrq7jdytFCMDu/tNNfH60dbz6HI 2n0AIYsl+iMznk7SEuGL9m8Qyh7y2tbDCvDEONugXUusGD6EEVF0ofWXMELCrA== 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 D4A9C15E81; Mon, 28 Feb 2022 05:38: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 21S5chMP071497; Mon, 28 Feb 2022 05:38:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21S5chau071496; Mon, 28 Feb 2022 05:38:43 GMT (envelope-from git) Date: Mon, 28 Feb 2022 05:38:43 GMT Message-Id: <202202280538.21S5chau071496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: a0c3799828e5 - stable/13 - fsck_ffs: don't try to write in read-only mode 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a0c3799828e52151560e37855f14ee39a3e8aca0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646026724; 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=khs4c7pogJZ5ONdQ7cgWLy6+ITVPZfTyFs/DvVniios=; b=g9htYZ9QBmXa4/kZSBwTZPKVGNmtNtQJOyVNAzLmDtURGbmoke0p5s0DRLBXWQmQPtkhfC iszVtT4MaADO30vCkZ/O/ryqGXgL5p3rlaV1eQg0I/ha+od9y+DLSUhP80gLOo7Uj/5jQ7 Mlp+XPH/xor9hOTx/46r6LxVJtXRnruAs1iKrTZWsTLaMzB1ClH8N1byepIch9RKlr04aV jeBVTcY3+uC5jQaQjyUcOwoG97zAjqzos8WZEguEIW7cKHYBWznA82Pde7VKyNdQ4AqKOt kCuGeRRbt03L6rRF7YSYKbmBG0zSAEIxI3wKA12s/oGdk4ZeI8QIfL8njfhDtg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646026724; a=rsa-sha256; cv=none; b=mQKbOMrKvLY/WxG/Kq8kSfsgqy14pRxGVBe6bDb9HKBsKA3fnauGCe7aH+056oIRYsqyHl ecK3ZHLrtD0/m/4SITx9wH4mh42mmFPqub704BcyNBD8Y6Cow2Migi09nCFD4eorboumYE e5ymEDytPXx+QEMLqkYenRz22FgtatSAoo9SlHgRq3fCyEUcZNwvGPM++maTvaY1MpWd9c 7o/JpGPtisiW/i9UWxQ7tck6eBRZFIc14AKaMHV9xy7KmWAg645lnAjiXIirA3BeO9gZXS GpLZqZVsHLc1L9aRsPJpulIkuztkCIcACC5wOlc1jN5jxhAI9cGEVYq4eGc4Vw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=a0c3799828e52151560e37855f14ee39a3e8aca0 commit a0c3799828e52151560e37855f14ee39a3e8aca0 Author: Chuck Silvers AuthorDate: 2021-06-29 21:29:15 +0000 Commit: Kirk McKusick CommitDate: 2022-02-28 05:36:06 +0000 fsck_ffs: don't try to write in read-only mode (cherry picked from commit ed1a156b038dee0e7a02c2935186ad5d8f4c36c1) Sponsored by: Netflix --- sbin/fsck_ffs/main.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 45bb279ce374..2724893a5b9a 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -364,17 +364,19 @@ checkfilesys(char *filesys) sujrecovery = 0; printf("** Skipping journal, falling through to full fsck\n\n"); } - /* - * Write the superblock so we don't try to recover the - * journal on another pass. If this is the only change - * to the filesystem, we do not want it to be called - * out as modified. - */ - sblock.fs_mtime = time(NULL); - sbdirty(); - ofsmodified = fsmodified; - flush(fswritefd, &sblk); - fsmodified = ofsmodified; + if (fswritefd != -1) { + /* + * Write the superblock so we don't try to recover the + * journal on another pass. If this is the only change + * to the filesystem, we do not want it to be called + * out as modified. + */ + sblock.fs_mtime = time(NULL); + sbdirty(); + ofsmodified = fsmodified; + flush(fswritefd, &sblk); + fsmodified = ofsmodified; + } } /* * If the filesystem was run on an old kernel that did not