2003-06-24 14:32:04

by Mike Waychison

[permalink] [raw]
Subject: [PATCH] 2.5.72: follow_mount / follow_link

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1348 -> 1.1349
# fs/namei.c 1.76 -> 1.77
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/06/23 [email protected] 1.1349
# namei.c:
# nameidata should have the mnt we are looking at when doing a follow_link after a follow_mount
# --------------------------------------------
#
diff -Nru a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c Tue Jun 24 13:29:37 2003
+++ b/fs/namei.c Tue Jun 24 13:29:37 2003
@@ -655,6 +655,7 @@

if (inode->i_op->follow_link) {
mntget(next.mnt);
+ nd->mnt = next.mnt;
err = do_follow_link(next.dentry, nd);
dput(next.dentry);
mntput(next.mnt);
@@ -708,6 +709,7 @@
if ((lookup_flags & LOOKUP_FOLLOW)
&& inode && inode->i_op && inode->i_op->follow_link) {
mntget(next.mnt);
+ nd->mnt = next.mnt;
err = do_follow_link(next.dentry, nd);
dput(next.dentry);
mntput(next.mnt);


Attachments:
ndmnt.patch (1.15 kB)

2003-06-24 14:40:12

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] 2.5.72: follow_mount / follow_link

On Tue, Jun 24, 2003 at 10:41:59AM -0400, Mike Waychison wrote:

> The changes made in fs/[email protected] break this behaviour iff the dentry
> being follow_link'ed is a root dentry. This is becauseo

... mixing symlinks and mounting is ripe with very ugly races and corner
cases. Not allowed - symlink can't be a mountpoint or a mounted object.

2003-06-24 15:31:05

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] 2.5.72: follow_mount / follow_link

Followup to: <[email protected]>
By author: [email protected]
In newsgroup: linux.dev.kernel
>
> On Tue, Jun 24, 2003 at 10:41:59AM -0400, Mike Waychison wrote:
>
> > The changes made in fs/[email protected] break this behaviour iff the dentry
> > being follow_link'ed is a root dentry. This is becauseo
>
> ... mixing symlinks and mounting is ripe with very ugly races and corner
> cases. Not allowed - symlink can't be a mountpoint or a mounted object.
>

Unfortunately, this is probably the only realistic way to ever get
working direct mounts, so please don't dismiss it out of hand.
follow_link on a directory has turned out to be a really useful way of
doing automounting.

-hpa
--
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64

2003-06-24 23:37:09

by jlnance

[permalink] [raw]
Subject: Re: [PATCH] 2.5.72: follow_mount / follow_link

On Tue, Jun 24, 2003 at 08:42:56AM -0700, H. Peter Anvin wrote:

> Unfortunately, this is probably the only realistic way to ever get
> working direct mounts, so please don't dismiss it out of hand.
> follow_link on a directory has turned out to be a really useful way of
> doing automounting.

Hi Peter,
I have always wondered why direct mounts, as well as things like
/net/host are difficult with Linux. If you have a couple of minutes,
would you explain the problem? Also, do you have any idea how Solaris
does this and is it easier there?

Thanks,

Jim

2003-06-24 23:47:24

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] 2.5.72: follow_mount / follow_link

[email protected] wrote:
> On Tue, Jun 24, 2003 at 08:42:56AM -0700, H. Peter Anvin wrote:
>
>
>>Unfortunately, this is probably the only realistic way to ever get
>>working direct mounts, so please don't dismiss it out of hand.
>>follow_link on a directory has turned out to be a really useful way of
>>doing automounting.
>
>
> Hi Peter,
> I have always wondered why direct mounts, as well as things like
> /net/host are difficult with Linux. If you have a couple of minutes,
> would you explain the problem? Also, do you have any idea how Solaris
> does this and is it easier there?
>

It's a pretty long lecture, and I have had it enough time that I'm not
really keen on repeating it every time anyone asks. Look at the
archives of the autofs mailing list on linux.kernel.org.

-hpa


2003-06-24 23:53:26

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] 2.5.72: follow_mount / follow_link

[email protected] wrote:
> On Tue, Jun 24, 2003 at 08:42:56AM -0700, H. Peter Anvin wrote:
>
>
>>Unfortunately, this is probably the only realistic way to ever get
>>working direct mounts, so please don't dismiss it out of hand.
>>follow_link on a directory has turned out to be a really useful way of
>>doing automounting.
>
>
> Hi Peter,
> I have always wondered why direct mounts, as well as things like
> /net/host are difficult with Linux. If you have a couple of minutes,
> would you explain the problem? Also, do you have any idea how Solaris
> does this and is it easier there?
>

Oh yes... no, I don't know what Solaris does, although I suspect they
had to adjust their VFS to *make* it work (management directive: this
shalt work) even if that meant overall performance loss.

If you don't find something in the autofs archives get back to me or
corner me on IRC sometime.

-hpa