git: 9855d25dbd52 - stable/15 - mdmfs: Fix soft updates logic

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Sat, 31 Jan 2026 17:49:40 UTC
The branch stable/15 has been updated by des:

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

commit 9855d25dbd521cd521a94b52259e9abdf235a008
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-01-22 18:16:37 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-01-31 17:49:24 +0000

    mdmfs: Fix soft updates logic
    
    Now that newfs(8) has a command-line argument to disable soft updates,
    use that instead of running tunefs(8) after the fact to turn them off.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Sponsored by:   NetApp, Inc.
    Reviewed by:    mckusick, imp
    Differential Revision:  https://reviews.freebsd.org/D54783
    
    (cherry picked from commit 4b9620433855b75989164c1a8a8a2e1a9b5fbff2)
---
 sbin/mdmfs/mdmfs.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/sbin/mdmfs/mdmfs.c b/sbin/mdmfs/mdmfs.c
index 69149b3fb465..cd0bf7c96143 100644
--- a/sbin/mdmfs/mdmfs.c
+++ b/sbin/mdmfs/mdmfs.c
@@ -104,7 +104,7 @@ main(int argc, char **argv)
 	bool detach, softdep, autounit, newfs;
 	const char *mtpoint, *size_arg, *skel, *unitstr;
 	char *p;
-	int ch, idx, rv;
+	int ch, idx;
 	void *set;
 	unsigned long ul;
 
@@ -343,8 +343,7 @@ main(int argc, char **argv)
 	
 		if (!have_mdtype)
 			mdtype = MD_SWAP;
-		if (softdep)
-			argappend(&newfs_arg, "-U");
+		argappend(&newfs_arg, softdep ? "-U" : "-u");
 		if (mdtype != MD_VNODE && !newfs)
 			errx(1, "-P requires a vnode-backed disk");
 	
@@ -357,13 +356,6 @@ main(int argc, char **argv)
 			do_mdconfig_attach(mdconfig_arg, mdtype);
 		if (newfs)
 			do_newfs(newfs_arg);
-		if (!softdep) {
-			rv = run(NULL, "%s %s /dev/%s%d", _PATH_TUNEFS,
-			    "-n disable", mdname, unit);
-			if (rv)
-				errx(1, "tunefs exited %s %d", run_exitstr(rv),
-				    run_exitnumber(rv));
-		}
 		do_mount_md(mount_arg, mtpoint);
 	}