Subject: Re: relative mountpoints
To: Andreas Wrede <>
From: Brian C. Grayson <>
List: current-users
Date: 10/06/1997 14:18:20
Andreas Wrede wrote:
> If mount(8) is called with a relative path as the mount point for the 
> filesystem, it will mount(2) it with the relative path. umount(8) will 
> always turn a relative path into an absolute path before umount(2)ing the 
> filesystem.  This makes it impossible to umount a filesystem that was 
> mounted with a relative path.
> Unless I am missing something, this is probably not the intended behaviour.  
> But which one is right? I suspect mounting on a relative mount point is a 
> bad idea but I could see some interesting possibilities.

  See my post from Sep 29, and particularly the reply by der
Mouse, which mentions that a fix (the -R option) has already
been send-pr'd and is waiting for someone to check it in.
His patch provides the ability to say ``yes, I know you want to
change this to an absolute path before attempting the unmount,
but _don't_.  Use it exactly as is.''

  Are there any good reasons why PR# 441 wasn't used?  According
to the audit trail, it was closed because the fix for #3016
(which noticed the checks for S_ISDIR or S_ISBLK for the mount
point were a bit too restrictive) obsoleted it.  However, even
with the #3016 changes, the situation discussed above (relative
paths) will still fail, due to the realpath() stuff mentioned
in my post.  In the current source, ``name'' is realpath()'d,
and ``name'' is set to point to the result, before any checks
or copies are done to save this info.  This is completely
independent from the later checks for S_ISDIR and S_ISBLK.
Plus, the patch in #441 also fixes the man page to document -F
and -R.

  The patch by der Mouse, methinks, will solve the relative-path
problem.  Should I just submit yet-another-PR on the subject,
to make sure this is not forgotten?

  P.S.  If anyone needs a quick fix for unmounting
relative-path-mounted objects, use the following cheesy program:

int main (int argc, char** argv) 
{  if (unmount(argv[1], 0)) err(-1, "%s", argv[1]); }

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