Ian Dowse | 5 Jul 2003 17:05
Picon
Picon
Favicon

Re: Unmounting by filesystem ID

In message <1057413470.716.3.camel <at> localhost>, "Vladimir B. Grebenschikov" writ
es:
>May be you fix issue of umounting by known vnode ?
>problem is in mounting different devices under chroot.
>in list of mounts they differ only by device id, and it is rather=20
>difficult to umount filesystem if I known absolute path but do not enter
>to chroot.

The MNT_BYFSID approach makes it always possible to indicate to the
kernel which filesystem is to be unmounted, but some more work is
needed in the umount(8) utility to handle unusual cases.

The simplest way for umount to reliably pick the right file system
would be to have it call statfs(2) on the supplied path, and then
use the resulting filesystem ID to do the unmount(2) call. That
would allow you to unmount a filesystem that was mounted from within
a chroot by just specifying the full path to the filesystem even
though it is not the path that df or mount show.

Unfortunately, statfs(2) may get stuck if the path leads to (or
traverses) a network filesystem that is not responding. In this
case it is better for the umount utility to use getfsstat(2) with
the MNT_NOWAIT flag, and pick the filesystem that has the path that
was specified. This will do the wrong thing if for example you two
/var filesystems listed because one was mounted from inside a chroot.
There is also the problem of checking that the path points to the
root of the filesystem as statfs(2) works on any file or directory.

I think umount can probably be made do something reasonable in most
cases by having it use extra mechanisms such as statfs(2) only when
(Continue reading)

Dan Nelson | 5 Jul 2003 19:25
Gravatar

Re: Unmounting by filesystem ID

In the last episode (Jul 05), Ian Dowse said:
> In message <1057413470.716.3.camel <at> localhost>, "Vladimir B. Grebenschikov" writes:
> >May be you fix issue of umounting by known vnode ? problem is in
> >mounting different devices under chroot. in list of mounts they
> >differ only by device id, and it is rather=20 difficult to umount
> >filesystem if I known absolute path but do not enter to chroot.
> 
> The MNT_BYFSID approach makes it always possible to indicate to the
> kernel which filesystem is to be unmounted, but some more work is
> needed in the umount(8) utility to handle unusual cases.

Can mount(8) be changed to print the fsid?   Maybe hide it under -v if
it's a long value?  This seems like the only solution that can cover
the case where you have stacked two identical NFS mounts, one on top of
the other.  I've done this occasionally to force the kernel to retry
access to a server that has just come back after a reboot.

amd could probably benefit from dismounting using fsid if possible,
too.  Although it'd have to try fsid then path for the case where root
has dismounted then remounted one of its filesystems behind its back
(I've done this too, to change nfsv2 mounts to v3, etc).

--

-- 
	Dan Nelson
	dnelson <at> allantgroup.com
_______________________________________________
freebsd-arch <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe <at> freebsd.org"

(Continue reading)


Gmane