NetBSD Problem Report #57903
From www@netbsd.org Sat Feb 3 21:42:27 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 727BC1A9238
for <gnats-bugs@gnats.NetBSD.org>; Sat, 3 Feb 2024 21:42:27 +0000 (UTC)
Message-Id: <20240203214225.E3D5C1A9239@mollari.NetBSD.org>
Date: Sat, 3 Feb 2024 21:42:25 +0000 (UTC)
From: rbranco@suse.de
Reply-To: rbranco@suse.de
To: gnats-bugs@NetBSD.org
Subject: umount: Add -d option to umount to detach vnode device
X-Send-Pr-Version: www-1.0
>Number: 57903
>Category: bin
>Synopsis: umount: Add -d option to umount to detach vnode device
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Feb 03 21:45:00 +0000 2024
>Last-Modified: Fri May 30 00:00:01 +0000 2025
>Originator: Ricardo Branco
>Release: NetBSD 10.0_RC3
>Organization:
>Environment:
>Description:
Add a -d option to umount(8) to detach a vnode device. A similar option exists in Linux's umount(8) and also FreeBSD.
>How-To-Repeat:
>Fix:
Fix: https://github.com/NetBSD/src/pull/31
>Audit-Trail:
From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/57903: umount: Add -d option to umount to detach vnode
device
Date: Wed, 26 Mar 2025 21:05:32 -0400
The existing code doesn't work in all cases. Consider the following an
uninitiated user (e.g., me) might think could work:
# vndconfig vnd0 riscv64.img
# dmesg | grep vnd0
[ 21730.535797] vnd0: GPT GUID: 66d6e832-e832-46d6-b2e8-d66632e8d666
[ 21730.535797] dk0 at vnd0: "EFI", 163840 blocks at 32768, type: msdos
[ 21730.535797] dk1 at vnd0: "netbsd-root", 2211840 blocks at 196608,
type: ffs
# mount /dev/dk0 /mnt
# umount -d /mnt
umount: invalid vnd device: /dev/dk0
Here we have indirection because of wedges: one vnode disk can expose
more than one potential disk wedge. Even if only one wedge is mounted,
it won't be cleared because there's a check that expects the mount
point=C2=A0is directly associated with a vnd device.
if (strncmp(dev, "/dev/vnd", sizeof("/dev/vnd") - 1)) {
if (!all)
warnx("invalid vnd device: %s", dev);
return -1;
}
Regardless, this layering means we can't simply pass something like dk0
anyway, as the action applied (as-is) would be submitted against the
wedge device, not the vnd, meaning
VNDIOCCLR: Inappropriate ioctl for device
would be encountered instead.
It would need to walk backwards from the mounted structure to find the
vnd that originally made it available. (And only unconfigure if there
are no other mount points in use, of course.)
Dave
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/57903: umount: Add -d option to umount to detach vnode device
Date: Thu, 27 Mar 2025 14:43:33 +0700
Date: Thu, 27 Mar 2025 01:10:02 +0000 (UTC)
From: "David H. Gutteridge via gnats" <gnats-admin@NetBSD.org>
Message-ID: <20250327011002.3F5411A923D@mollari.NetBSD.org>
| It would need to walk backwards from the mounted structure to find the
| vnd that originally made it available. (And only unconfigure if there
| are no other mount points in use, of course.)
Another reason for a generic ioctl for all devices, wedges could use it
to remove themselves, and then pass the same ioctl back to its parent
device, if that also unconfigures itself, it does the same to its parent.
Once some device/file which does not understand the ioctl is reached,
it all just stops (and providing at least something was unconfigured,
succeeds).
An entirely plausible setup is to have a GPT partition in a cgd living in
a vnd in a file on the filesystem. And even more than vnd's where it is
no more than a slight convenience, I'd think unconfiguring a cgd once it
is no longer mounted would be a much more desirable goal.
kre
From: "David H. Gutteridge" <gutteridge@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57903 CVS commit: src/sbin/umount
Date: Thu, 29 May 2025 23:58:34 +0000
Module Name: src
Committed By: gutteridge
Date: Thu May 29 23:58:33 UTC 2025
Modified Files:
src/sbin/umount: umount.8
Log Message:
umount.8: note a limitation of the -d option
(As discussed in PR bin/57903.)
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sbin/umount/umount.8
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(Contact us)
$NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.