[PATCH] Minor sys_umount fix (changes semantics slightly)

Malcolm Beattie (mbeattie@sable.ox.ac.uk)
Wed, 15 Dec 1999 12:46:10 +0000 (GMT)


Here's a one-letter patch for 2.3.x to sys_umount to allow it to
unmount filesystems whose root inode is a symlink.

I'm using such a pseudo-filesystem to support MLS so that you can
divert access to /etc (or whatever) to /etc/foo (or wherever) for
tasks in compartment foo. Without this patch, there's no way to
unmount the filesystem since sys_umount does a namei() which follows
the root inode symlink. Replacing it with lnamei() fixes this (and
barring adding a special umount flag, there's no other way).

However, this changes umount semantics very slightly: currently, with
a 2.2 kernel, if you have a symlink /foo to /some/mountpoint then
umount("/foo") will unmount /some/mountpoint but after this patch
that will no longer work. If this inconveniences anyone greatly,
please scream (but I will then point out that it is impossible to
distinguish the cases in the kernel without an extra umount flag
which would be a horrible wart and even be visible in umount(8)).

------------------------------ cut here ------------------------------
--- fs/super.c Sun Oct 31 07:19:22 1999
+++ fs/super.c.new Wed Dec 15 12:33:39 1999
@@ -777,7 +777,7 @@
return -EPERM;

lock_kernel();
- dentry = namei(name);
+ dentry = lnamei(name);
retval = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
struct inode * inode = dentry->d_inode;
------------------------------ cut here ------------------------------

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Unix Systems Programmer
Oxford University Computing Services

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/