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 Fix: Apply this patch: 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.--7XjIAXa8be2EFYonGxMxJiZ1tPXUSy5gpsxcRYIRl3AQfgk3 Content-Type: text/plain; name="file.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="file.diff" --- 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, "/"); 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.
Hi Logix, Try this patch. Most of it will be commited to FreeBSD- Current soon. All your problems should be solved then: http://www.freebsd.org/~alfred/mount.diff Cheers, Martin
State Changed From-To: open->closed This has been fixed in -CURRENT and 3.3/3.4.