NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60240: mount(2): wrong sense of IMNT_MPSAFE for kernel lock condition



>Number:         60240
>Category:       kern
>Synopsis:       mount(2): wrong sense of IMNT_MPSAFE for kernel lock condition
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 08 13:00:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10
>Organization:
The NetMPSAFE Mountation
>Environment:
>Description:

	If a file system is MP-safe, it doesn't need the kernel lock to
	go through mount/unmount (mostly for mount update, since on
	first mount, the vfs layer doesn't yet know whether the file
	system is MP-safe or not).

	In an attempt to implement this optimization, I applied the
	following patch a while back:

changeset:   1027819:11f6ceaf4f76
branch:      trunk
user:        riastradh <riastradh%NetBSD.org@localhost>
date:        Tue Sep 13 09:13:19 2022 +0000
summary:     vfs(9): For MP-safe mounts, don't kernel lock in mount/unmount.
...
+       int mpsafe = mp->mnt_iflag & IMNT_MPSAFE;
...
-       KERNEL_LOCK(1, NULL);
...
+       if (mpsafe) {
+               KERNEL_LOCK(1, NULL);
+       }
...
-       KERNEL_UNLOCK_ONE(NULL);
+       if (mpsafe) {
+               KERNEL_UNLOCK_ONE(NULL);
+       }

	Unfortunately, I am boolean-challenged, and so this took the
	kernel lock _only_ for MP-safe file systems.  And only on
	update mounts.

>How-To-Repeat:

	code inspection

>Fix:

https://mail-index.netbsd.org/source-changes/2026/05/08/msg161945.html




Home | Main Index | Thread Index | Old Index