Subject: umount of ~/bin hard to do, but unmount isn't
To: None <current-users@NetBSD.ORG>
From: Brian C. Grayson <bgrayson@ece.utexas.edu>
List: current-users
Date: 09/29/1997 12:19:01
  My home directory is NFS-mounted, so ~/bin is
/home/orac/bgrayson/bin, while the real path is
/a/orac/home/orac/bgrayson/bin.  If I do a union mount, and
specify directories via ~/, I can not umount them using
/sbin/umount.  However, if I simply call the unmount syscall
directly via a short program, it works fine.  All of this is done
at user level.  Transcript below:

> mount_union -oro ~/bin ~/foodir
> mount | grep foo
<above>:/a/orac/home/orac/bgrayson/bin on /home/orac/bgrayson/foodir
  type union (nodev, nosuid, read-only)
> umount ~/foodir
umount: /a/orac/home/orac/bgrayson/foodir: not currently mounted
> mount | grep foo
<above>:/a/orac/home/orac/bgrayson/bin on /home/orac/bgrayson/foodir
  type union (nodev, nosuid, read-only)
> cat dummyumount.c
int main (int argc, char** argv) 
{  if (unmount(argv[1], 0)) err(-1, "%s", argv[1]); }
> gmake dummyumount
gcc     dummyumount.c   -o dummyumount
> dummyumount ~/foodir
> mount | grep foo

  Would it be worthwhile adding an option to umount (or perhaps
default behavior) of, if all else fails, try doing an unmount()
call on the given arguments, with no realname parsing?  Or
perhaps the getmntname() routine
(/usr/src/sbin/umount/umount.c:314) should be modified to take
a perhaps-not-real-name, and check for matches against both the
given name and the realpath(name)?  Send-pr-worthy?

  Brian
-- 
Brian Grayson (bgrayson@ece.utexas.edu)
Graduate Student, Electrical and Computer Engineering
The University of Texas at Austin
Office:  ENS 406       (512) 471-8011
Finger bgrayson@orac.ece.utexas.edu for PGP key.