[PATCH 25/28] VFS: statfs(64) shouldn't follow last component symlink

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


Mount-related userspace tools will require the ability to detect whether what
looks like a regular directory is actually a autofs trigger. To handle this,
tools can statfs a given directory and check to see if statfs->f_type ==
AUTOFSNG_SUPER_MAGIC before walking into the directory (and causing the a
filesystem to automount).

To make this happen, we cannot allow statfs to follow_link.

NOTE: This may break any userspace that assumes it can statfs across a
last-component symlink. I can't think of any real world breakage however, as
mount(8) will drop the real path in /etc/mtab and /proc/mounts will always
show the true path.

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

open.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.9-quilt/fs/open.c
===================================================================
--- linux-2.6.9-quilt.orig/fs/open.c 2004-08-14 01:36:13.000000000 -0400
+++ linux-2.6.9-quilt/fs/open.c 2004-10-22 17:17:47.180291648 -0400
@@ -121,7 +121,7 @@ asmlinkage long sys_statfs(const char __
struct nameidata nd;
int error;

- error = user_path_walk(path, &nd);
+ error = user_path_walk_link(path, &nd);
if (!error) {
struct statfs tmp;
error = vfs_statfs_native(nd.dentry->d_inode->i_sb, &tmp);
@@ -140,7 +140,7 @@ asmlinkage long sys_statfs64(const char

if (sz != sizeof(*buf))
return -EINVAL;
- error = user_path_walk(path, &nd);
+ error = user_path_walk_link(path, &nd);
if (!error) {
struct statfs64 tmp;
error = vfs_statfs64(nd.dentry->d_inode->i_sb, &tmp);

-
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/