[PATCH 26/28] VFS: Introduce MNT_NOFOLLOW

From: Mike Waychison
Date: Mon Oct 25 2004 - 10:10:34 EST


Umounting direct mounts requires the ability to umount without following
->follow_link. We do this by adding a new flag called MNT_NOFOLLOW to
umount2.

Signed-off-by: Mike Waychison <michael.waychison@xxxxxxx>
---

fs/namespace.c | 3 ++-
include/linux/fs.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.9-quilt/include/linux/fs.h
===================================================================
--- linux-2.6.9-quilt.orig/include/linux/fs.h 2004-10-22 17:17:43.766810576 -0400
+++ linux-2.6.9-quilt/include/linux/fs.h 2004-10-22 17:17:47.808196192 -0400
@@ -735,6 +735,7 @@ extern int send_sigurg(struct fown_struc

#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
#define MNT_DETACH 0x00000002 /* Just detach from the tree */
+#define MNT_NOFOLLOW 0x00000004 /* Do not follow symlinks */

extern struct list_head super_blocks;
extern spinlock_t sb_lock;
Index: linux-2.6.9-quilt/fs/namespace.c
===================================================================
--- linux-2.6.9-quilt.orig/fs/namespace.c 2004-10-22 17:17:45.491548376 -0400
+++ linux-2.6.9-quilt/fs/namespace.c 2004-10-22 17:17:47.809196040 -0400
@@ -693,8 +693,9 @@ asmlinkage long sys_umount(char __user *
{
struct nameidata nd;
int retval;
+ int walk_flags = flags & MNT_NOFOLLOW ? 0 : LOOKUP_FOLLOW;

- retval = __user_walk(name, LOOKUP_FOLLOW, &nd);
+ retval = __user_walk(name, walk_flags, &nd);
if (retval)
goto out;
retval = -EINVAL;

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