From nobody Sat Nov 12 23:37:48 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 4N8sSX70Frz4hFsH; Sat, 12 Nov 2022 23:37:48 +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 4N8sSX6RzJz47KJ; Sat, 12 Nov 2022 23:37:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668296268; 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=4izVgbxWzuAOUBuO4X4EeJnebzuj8bICu+nGZ4clsIw=; b=V7QgcYOODGxuFVvTr27FzS2Qq3LlzMo551gxM1XflRn6BTqgM9fxFwwHiaCynA/o8TMDgh AJ5OPxEFmeEVfudLQUQSZ1m7htyuLqsTFhHWP3n13GDhN0uUN5GFwqBsgKMlnKA2OF+Nr8 1hJIRxP/iTeOjX/oT+kyIs3Y539V+CglJmnsnE6gb45Crt/MYdrkryc1fSZE0EZTZI9Ghe 9qf9CZ3LEwlxu3RfjHk/D1qMeHv+1cEWI9js6AKadXt+Pk6+bUGSCEU8eiz2/GOcrSWuYx fTtMpEN9ghtxXfXgf67FUaKHE+bx0Vd4TUPFwrxuqxRgVkAnlmmbXLFg0hG8Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668296268; 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=4izVgbxWzuAOUBuO4X4EeJnebzuj8bICu+nGZ4clsIw=; b=DHry96WPFs98VB4ReZpwNGuIWbksn4U0rxAlGe/cIuOn1iYj0ChtrZgBYWsQ/etZUyykB1 U4vI92BN0IVEcjAuhaRje/wF6gfjSpAyrH380OGi4NVMZwrjGEMceHuGxsTlZjuK+MVQ1s erOa5V1A4J2TnbUXb+9oUK1ztvN78twaZ08AuouAY9aGfaii2hS/WShcE8bsZ7yth43mNB CKoRBgJ3PJ9Ib2UVagTeCSjlm4B4guqAy4OZbxUzzKaCKqSNhiaMTNfdm+/U9wl6XuxHm0 8UtFX9ny/y5aRtw3CNx2m7SbsW6MWRm5nwU0VYjb6dPoAHKe/dhVFnWHFLwcEw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668296268; a=rsa-sha256; cv=none; b=aOFnB5Qk6ACIyyzjQG8DqoYUsAGelD1jlhdTbuHjvxyg7dW2iOIu4TmgBFnTzwzY4cIPlY Z6lhDXsXZIP0AbcVjdcV3r9pymNkSV1Q1NFplExk4K4ARjrpe74qeAumc70baWIma4oFZv 6LdcjTqIlOxAojOJ2Zq6SwJiEHGdwvksAvY0jDQ3ugPcPFQGypB/huVv6G7iyAJWaG+kPc 590gJlEz86Pvm27EXtIH/wiY6aYBK8s81Q+VhZYrJXCulK+OFjM1Ec32Y707T4ss1i8JV/ TPTGAS890us7rX3eusu/aXKoInNvatXBgFEyvuUCxqSWuhgdKlHnJTcjE3QjsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4N8sSX5FsJzhG3; Sat, 12 Nov 2022 23:37:48 +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 2ACNbmp6085075; Sat, 12 Nov 2022 23:37:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ACNbmRk085074; Sat, 12 Nov 2022 23:37:48 GMT (envelope-from git) Date: Sat, 12 Nov 2022 23:37:48 GMT Message-Id: <202211122337.2ACNbmRk085074@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: 5c7ba6bdf83f - main - Fix for tunefs(8) unable to add a UFS/FFS soft update journal. 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: 5c7ba6bdf83fda82cce70f384e2ec8218f13002e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=5c7ba6bdf83fda82cce70f384e2ec8218f13002e commit 5c7ba6bdf83fda82cce70f384e2ec8218f13002e Author: Kirk McKusick AuthorDate: 2022-11-12 23:36:07 +0000 Commit: Kirk McKusick CommitDate: 2022-11-12 23:37:27 +0000 Fix for tunefs(8) unable to add a UFS/FFS soft update journal. The reported bug is UFS: bad file descriptor: soft update journaling can not be enabled on some FreeBSD-provided disk images – failed to write updated cg. The UFS library (libufs(3)) failed to reopen its disk descriptor when first attempting to update a cylinder group. The error only occurred when trying to add journaling to a filesystem whose first cylinder group was too full to hold the journal. PR: 259090 MFC after: 1 week Sponsored by: The FreeBSD Foundation --- lib/libufs/cgroup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libufs/cgroup.c b/lib/libufs/cgroup.c index 90b28eadad2c..2058d16e9b6d 100644 --- a/lib/libufs/cgroup.c +++ b/lib/libufs/cgroup.c @@ -268,6 +268,10 @@ cgwrite1(struct uufsd *disk, int cg) static char errmsg[BUFSIZ]; if (cg == disk->d_cg.cg_cgx) { + if (ufs_disk_write(disk) == -1) { + ERROR(disk, "failed to open disk for writing"); + return (-1); + } if (cgput(disk->d_fd, &disk->d_fs, &disk->d_cg) == 0) return (0); ERROR(disk, NULL);