Module Name:    src
Committed By:   bad
Date:           Sun Aug 11 12:58:10 UTC 2024

Modified Files:
        src/sys/kern: vfs_mount.c
        src/tests/kernel: t_unmount.c

Log Message:
vfs_subr.c: in dounmount restore the async flag before checking it

This avoids the file system being put on the syncer work list and future
modified buffers being flushed to disk by the synce after an attempt to
unmount it fails.

Adjust the test case to not expect a failure.

fixes PR kern/58564.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/t_unmount.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.105 src/sys/kern/vfs_mount.c:1.106
--- src/sys/kern/vfs_mount.c:1.105	Fri Apr 19 00:45:41 2024
+++ src/sys/kern/vfs_mount.c	Sun Aug 11 12:58:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.105 2024/04/19 00:45:41 riastradh Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.106 2024/08/11 12:58:10 bad Exp $	*/
 
 /*-
  * Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.105 2024/04/19 00:45:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.106 2024/08/11 12:58:10 bad Exp $");
 
 #include "veriexec.h"
 
@@ -975,9 +975,9 @@ dounmount(struct mount *mp, int flags, s
 	}
 	if (error) {
 		mp->mnt_iflag &= ~IMNT_UNMOUNT;
+		mp->mnt_flag |= async;
 		if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0)
 			vfs_syncer_add_to_worklist(mp);
-		mp->mnt_flag |= async;
 		mutex_exit(mp->mnt_updating);
 		if (!was_suspended)
 			vfs_resume(mp);

Index: src/tests/kernel/t_unmount.c
diff -u src/tests/kernel/t_unmount.c:1.2 src/tests/kernel/t_unmount.c:1.3
--- src/tests/kernel/t_unmount.c:1.2	Sat Aug 10 14:44:54 2024
+++ src/tests/kernel/t_unmount.c	Sun Aug 11 12:58:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unmount.c,v 1.2 2024/08/10 14:44:54 bad Exp $	*/
+/*	$NetBSD: t_unmount.c,v 1.3 2024/08/11 12:58:10 bad Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2024\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_unmount.c,v 1.2 2024/08/10 14:44:54 bad Exp $");
+__RCSID("$NetBSD: t_unmount.c,v 1.3 2024/08/11 12:58:10 bad Exp $");
 
 #include <sys/types.h>
 #include <sys/mount.h>
@@ -94,7 +94,6 @@ ATF_TC_BODY(async, tc)
 	    (vp->v_mount->mnt_iflag & IMNT_ONWORKLIST) != 0);
 
 
-	atf_tc_expect_fail("mount point on syncer work list. PR kern/58564");
 	ATF_REQUIRE_MSG(((vp->v_mount->mnt_iflag & IMNT_ONWORKLIST) == 0),
 	    "mount point on syncer work list");
 }

Reply via email to