Module Name:    src
Committed By:   bad
Date:           Sun Aug 11 13:09:58 UTC 2024

Modified Files:
        src/sys/kern: vfs_mount.c vfs_syscalls.c

Log Message:
explain why MNT_ASYNC is temporarily cleared

related to PR kern/58564.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.566 -r1.567 src/sys/kern/vfs_syscalls.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.106 src/sys/kern/vfs_mount.c:1.107
--- src/sys/kern/vfs_mount.c:1.106	Sun Aug 11 12:58:10 2024
+++ src/sys/kern/vfs_mount.c	Sun Aug 11 13:09:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.106 2024/08/11 12:58:10 bad Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.107 2024/08/11 13:09:58 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.106 2024/08/11 12:58:10 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.107 2024/08/11 13:09:58 bad Exp $");
 
 #include "veriexec.h"
 
@@ -961,6 +961,10 @@ dounmount(struct mount *mp, int flags, s
 
 	mp->mnt_iflag |= IMNT_UNMOUNT;
 	mutex_enter(mp->mnt_updating);
+	/*
+	 * Temporarily clear the MNT_ASYNC flags so that bwrite() doesn't
+	 * convert the sync writes to delayed writes.
+	 */
 	async = mp->mnt_flag & MNT_ASYNC;
 	mp->mnt_flag &= ~MNT_ASYNC;
 	cache_purgevfs(mp);	/* remove cache entries for this file sys */

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.566 src/sys/kern/vfs_syscalls.c:1.567
--- src/sys/kern/vfs_syscalls.c:1.566	Thu Jul  4 16:42:37 2024
+++ src/sys/kern/vfs_syscalls.c	Sun Aug 11 13:09:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.566 2024/07/04 16:42:37 christos Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.567 2024/08/11 13:09:58 bad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019, 2020, 2023 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.566 2024/07/04 16:42:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.567 2024/08/11 13:09:58 bad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -741,6 +741,11 @@ do_sys_sync(struct lwp *l)
 	while ((mp = mountlist_iterator_next(iter)) != NULL) {
 		mutex_enter(mp->mnt_updating);
 		if ((mp->mnt_flag & MNT_RDONLY) == 0) {
+			/*
+			 * Temporarily clear the MNT_ASYNC flags so that
+			 * bwrite() doesnt convert the sync writes to
+			 * delayed writes.
+			 */
 			asyncflag = mp->mnt_flag & MNT_ASYNC;
 			mp->mnt_flag &= ~MNT_ASYNC;
 			VFS_SYNC(mp, MNT_NOWAIT, l->l_cred);

Reply via email to