NetBSD-Bugs archive

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

kern/58564: async mounts revert to being synced after failed unmount



	Note: There was a bad value `non-critica' for the field `Severity'.
	It was set to the default value of `serious'.

>Number:         58564
>Category:       kern
>Synopsis:       when unmount an async mount fails the mount point erroneously gets put on the kernel syncer's worklist.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bad
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 08 21:35:00 +0000 2024
>Originator:     Christoph Badura <bad%bsd.de@localhost>
>Release:        NetBSD 10.99.11
>Organization:
Bozotic Software Testing Labs
	<organization of PR author (multiple lines)>
>Environment:
	<The following information is extracted from your kernel. Please>
	<append output of "ldd", "ident" where relevant (multiple lines).>
System: NetBSD nbcurrent 10.99.11 NetBSD 10.99.11 (GENERIC) #4: Mon Jul 29 18:24:41 CEST 2024 bad@inspiral-coalescence-ringdown:/Users/bad/netbsd-gsoc/obj/obj.amd64/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
sys/kern/vfs_mount.c:dounmount()

before calling the VFS_SYNC() and VFS_UNMOUNT() ops, dounmount removes the
MNT_ASYNC flag from mp->mnt_flag.  (Apparently so that the bwrite()s don't
get converted into delayed writes.
https://nxr.netbsd.org/xref/src/sys/kern/vfs_bio.c#862)

If either VFS op errors, dounmount() it restores the aysnc flag setting.
Alas only after the test to put the mount point on the vfs syncer worklist,
which checks if the that flag is set in mp->mnt_flag.

Hence, an async-mounted file system that fails to unmount reverts to having
it's dirty buffers periodically synced.

Found during random code inspection:
https://nxr.netbsd.org/xref/src/sys/kern/vfs_mount.c?r=1.105#980
    976		if (error) {
    977 		mp->mnt_iflag &= ~IMNT_UNMOUNT;
    978 		if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0)
    979 			vfs_syncer_add_to_worklist(mp);
    980 		mp->mnt_flag |= async;

	<precise description of the problem (multiple lines)>
>How-To-Repeat:
mount -t tmpfs -oasync tmpfs /mnt
cd /mnt
umount /mnt
	<code/input/activities to reproduce the problem (multiple lines)>
>Fix:
Obvious.
	<how to correct or work around the problem, if known (multiple lines)>

>Unformatted:
 	<Please check that the above is correct for the bug being reported,>
 	<and append source date of snapshot, if applicable (one line).>


Home | Main Index | Thread Index | Old Index