git: e30fcdaae2e6 - main - newfs: Don't combine GEOM journaling with SU

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Sat, 21 Mar 2026 07:22:08 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=e30fcdaae2e68458da83d5420e6034c5f384e5f2

commit e30fcdaae2e68458da83d5420e6034c5f384e5f2
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-03-21 07:21:28 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-03-21 07:21:45 +0000

    newfs: Don't combine GEOM journaling with SU
    
    GEOM journaling shouldn't be used at the same time as soft updates, so
    don't enable soft updates if GEOM journaling has been requested, and
    error out if both are explicitly requested.
    
    MFC after:      1 week
    PR:             293896
    Reviewed by:    mckusick
    Differential Revision:  https://reviews.freebsd.org/D55999
---
 sbin/newfs/newfs.8 | 14 ++++++++++----
 sbin/newfs/newfs.c |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8
index 6416e0f0ec8d..3aa3890479bf 100644
--- a/sbin/newfs/newfs.8
+++ b/sbin/newfs/newfs.8
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 7, 2026
+.Dd March 20, 2026
 .Dt NEWFS 8
 .Os
 .Sh NAME
@@ -84,6 +84,8 @@ Enable journaling on the new file system via gjournal.
 See
 .Xr gjournal 8
 for details.
+This is incompatible with soft updates
+.Pq Fl U .
 .It Fl L Ar volname
 Add a volume label to the new file system.
 Legal characters are alphanumerics, dashes, and underscores.
@@ -98,12 +100,14 @@ The default format is UFS2.
 For backward compatibility.
 .It Fl U
 Enable soft updates on the new file system.
+This is incompatible with GEOM journaling
+.Pq Fl J .
 If neither
 .Fl U
 nor
 .Fl u
 is specified, soft updates are enabled by default for UFS2 format file
-systems and disabled otherwise.
+systems unless GEOM journaling was requested and disabled otherwise.
 .It Fl u
 Do not enable soft updates on the new file system.
 If neither
@@ -176,8 +180,10 @@ One inode is required for each distinct file, so this value effectively
 specifies the average file size on the file system.
 .It Fl j
 Enable soft updates journaling on the new file system.
-This implies
-.Fl U .
+This implies soft updates
+.Pq Fl U
+and is incompatible with GEOM journaling
+.Pq Fl J .
 This flag is implemented by running the
 .Xr tunefs 8
 utility found in the user's
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 78f0bfcf458d..a54aae6ef6fc 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -390,7 +390,9 @@ main(int argc, char *argv[])
 	}
 	/* Use soft updates by default for UFS2 and above */
 	if (Uflag < 0)
-		Uflag = Oflag > 1;
+		Uflag = Oflag > 1 && !Jflag;
+	if (Uflag && Jflag)
+		errx(1, "Cannot enable both soft updates and GEOM journaling");
 	realsectorsize = sectorsize;
 	if (sectorsize != DEV_BSIZE) {		/* XXX */
 		int secperblk = sectorsize / DEV_BSIZE;