Date: Sat, 11 Sep 1999 05:25:56 +0200 (CEST) From: Harold Gutch <logix@foobar.franken.de> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/13692: umount(8) does not unmount filesystems with a trailing slash Message-ID: <199909110325.FAA04567@foobar.franken.de>
index | next in thread | raw e-mail
>Number: 13692
>Category: bin
>Synopsis: umount(8) does not unmount filesystems with a trailing slash
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Sep 10 20:30:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator: Harold Gutch
>Release: FreeBSD 2.2.8-STABLE i386
>Organization:
>Environment:
FreeBSD 2.2.8, the bug persists in 3.x as well
>Description:
umount(8) will not unmount a filesystem if
a) you supply the directory-name instead of the devicenode (or
host:directory-combination when using NFS) as an argument
and b) the directory on which the filesystem is mounted (member
f_mntonname of the struct statfs) has a trailing slash
>How-To-Repeat:
# mount_nfs remotehost:/remote/dir /local/dir/
# mount -t nfs
remotehost:/remote/dir on /local/dir/
# umount /local/dir/
umount: /local/dir: not currently mounted
# umount /local/dir
umount: /local/dir: not currently mounted
# umount remotehost:/remote/dir
# mount -t nfs
#
Note: You will need to call mount_nfs, mount_cd9660, mount_msdos etc.
directly, as mount(8) catches this and removes the trailing slash.
>Fix:
Apply this patch:
--- umount.c.sav Thu Dec 4 08:36:22 1997
+++ umount.c Sat Sep 11 05:29:27 1999
@@ -282,23 +282,34 @@
{
struct statfs *mntbuf;
int i, mntsize;
+ char *longname;
+
+ if (NULL == (longname = malloc(strlen(name) + 2)))
+ err(1, NULL);
+ strcpy(longname, name);
+ strcat(longname, "/");
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
warn("getmntinfo");
+ free(longname);
return (NULL);
}
for (i = 0; i < mntsize; i++) {
if ((what == MNTON) && !strcmp(mntbuf[i].f_mntfromname, name)) {
if (type)
*type = mntbuf[i].f_type;
+ free(longname);
return (mntbuf[i].f_mntonname);
}
- if ((what == MNTFROM) && !strcmp(mntbuf[i].f_mntonname, name)) {
+ if (((what == MNTFROM) && (!strcmp(mntbuf[i].f_mntonname, name))
+ || (!strcmp(mntbuf[i].f_mntonname, longname)))) {
if (type)
*type = mntbuf[i].f_type;
+ free(longname);
return (mntbuf[i].f_mntfromname);
}
}
+ free(longname);
return (NULL);
}
Alternatively mount_msdos, mount_cd9660 etc. need to be fixed to remove
trailing slashes.
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909110325.FAA04567>
