your root directory? Or make symlinks in the root directory to
mount points? Bad!),
These are bad? What alternatives can we use so that Linux and OSX
systems can use UNC names properly.
[[this message was edited 08/01/06 for clarification]]
I knew someone would take the bait.
It's good you ask, because yes, putting symlinks in root
that link to mounts are as bad putting your mount points
in the root directory. (Basically, it causes the same problem for the OS)
When the OS opens any file on the file system (eg. any files in
/bin, /usr, /lib, etc), the OS has to walk the root directory until
it finds the directory entry for the file you're requesting.
Let's say someone logins in as root and tries to run /bin/ls,
and your symlink in the root dir comes before /lib or /bin during
the OS search, and if the mount is hung, the shell will hang
when it tries to walk over the symlink. (it touches the link,
and thus the mount, and hangs)
Remember: the order of directory entries on the disk may not
be alphabetical, and may be hashed (randomized).
The idea is to never put mount points (or symlinks to mount points)
in the root dir; put them *one level down*, so the OS doesn't have
to step over them.
EXAMPLE:
This is bad, because it effectively puts a symlink called /mountpoint
in the root dir:
mount somehost:/somedir /some/mountpoint
ln -s /some/mountpoint /mountpoint <-- BAD
..but this is good:
mount somehost:/somedir /some/mountpoint
mkdir /net <-- GOOD
cd /net; ln -s /some/mountpoint mountpoint <-- GOOD
..because "/net" is a regular directory, with the symlink
to the mount safely /inside/ of it. Programs walking the root
directory won't have any trouble stepping over the /net directory,
as it won't resolve to a mount.
This allows root to login to the machine (your root login should
not have anything in its path that refers to NFS drives), and
be able to do admin tasks, even if all the mounts are hung.
On my system, when I have shell scripts that live on a file server
I want root to be able to access, instead of adding these dirs to
root's path, I make *aliases* in root's login to refer to them, eg:
alias phone /net/mountpoint/scripts/phone # phone list script
This way, there's no chance of my accidentally triggering a hung
mount just by typing innocuous commands like ls(1) that will hang
up in the PATH. The hung mount would only hang my shell if I
actually invoked the above alias.
Under most situations, you may not encounter this problem,
even if you have mounts and/or symlinks in the root dir, because
often you'll be lucky that the dirs you create are installed
*after* the critical /lib, /bin and /usr dirs.
But even though you might be safe.. Don't Tempt Fate!
You don't want to be in a situation where a hung mount
causes all root logins to hang because that mount's directory
is in root's PATH, preventing you from logging in to fix the
problem..!
--
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Cel: (Tel# suppressed)
Fax: (Tel# suppressed)
|