Hi,
after renaming a directory that has a mountpoint in its subtree,
umount will fail.
# rm -rf /mnt/FOO
# mkdir -p /mnt/foo/bar
# mount -t mfs /dev/sd0b /mnt/foo/bar
# mv /mnt/foo /mnt/FOO
# umount /mnt/foo/bar
umount: /mnt/foo/bar: No such file or directory
# umount /mnt/FOO/bar
umount: /mnt/FOO/bar: not currently mounted
With the diff below, it works.
# ./umount /mnt/FOO/bar
Only problem is that you get an unspecific error message if there
is really no mountpoint.
# ./umount /root
umount: /root: Invalid argument
As a user cannot get rid of its mountpoint, I would prefer the
variant with the ugly error message.
ok?
bluhm
Index: sbin/umount/umount.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sbin/umount/umount.c,v
retrieving revision 1.29
diff -u -p -r1.29 umount.c
--- sbin/umount/umount.c 28 Jun 2019 13:32:46 -0000 1.29
+++ sbin/umount/umount.c 22 Aug 2019 21:10:12 -0000
@@ -183,8 +183,12 @@ umountfs(char *oname)
mntpt = oname;
if (!(newname = getmntname(oname, MNTFROM, type)) &&
!(mntpt = getmntname(oname, MNTON, type))) {
- warnx("%s: not currently mounted", oname);
- return (1);
+ /*
+ * If path to mountpoint has been renamed,
+ * the list in the kernel is wrong. Try to
+ * unmount anyway with the path from the user.
+ */
+ mntpt = oname;
}
}
if (newname)