* [PATCH] 2.5.72: follow_mount / follow_link
@ 2003-06-24 14:41 Mike Waychison
2003-06-24 14:54 ` viro
0 siblings, 1 reply; 6+ messages in thread
From: Mike Waychison @ 2003-06-24 14:41 UTC (permalink / raw)
To: viro; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 865 bytes --]
Hi Al,
When a follow_link dentry call is made, the implementation expects the
dentry to be followed as well as a nameidata struct to be filled in.
The received nd->mnt is expected to contain the vfsmount of the dentry
being followed, so that a subsequent call to vfs_follow_link may
properly pivot off that mount and onto another vfsmount as the path of
the link is walked, thus keeping reference counts proper.
The changes made in fs/namei.c@1.42 break this behaviour iff the dentry
being follow_link'ed is a root dentry. This is because follow_mount
follows down next.mnt and not nd->mnt like it used to. So, if a root
dentry has a follow_link op, the nd->mnt it receives is in fact the
vfsmount of the mount it is mounted upon (which breaks reference counts).
Please apply the attached patch which was made against 2.5.72.
Thanks,
Mike Waychison
[-- Attachment #2: ndmnt.patch --]
[-- Type: text/plain, Size: 1178 bytes --]
# 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 mikew@nisserv.test.com 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);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] 2.5.72: follow_mount / follow_link
2003-06-24 14:41 [PATCH] 2.5.72: follow_mount / follow_link Mike Waychison
@ 2003-06-24 14:54 ` viro
2003-06-24 15:42 ` H. Peter Anvin
0 siblings, 1 reply; 6+ messages in thread
From: viro @ 2003-06-24 14:54 UTC (permalink / raw)
To: Mike Waychison; +Cc: linux-kernel
On Tue, Jun 24, 2003 at 10:41:59AM -0400, Mike Waychison wrote:
> The changes made in fs/namei.c@1.42 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] 2.5.72: follow_mount / follow_link
2003-06-24 14:54 ` viro
@ 2003-06-24 15:42 ` H. Peter Anvin
2003-06-24 23:50 ` jlnance
0 siblings, 1 reply; 6+ messages in thread
From: H. Peter Anvin @ 2003-06-24 15:42 UTC (permalink / raw)
To: linux-kernel
Followup to: <20030624145418.GP6754@parcelfarce.linux.theplanet.co.uk>
By author: viro@parcelfarce.linux.theplanet.co.uk
In newsgroup: linux.dev.kernel
>
> On Tue, Jun 24, 2003 at 10:41:59AM -0400, Mike Waychison wrote:
>
> > The changes made in fs/namei.c@1.42 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
--
<hpa@transmeta.com> at work, <hpa@zytor.com> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] 2.5.72: follow_mount / follow_link
2003-06-24 15:42 ` H. Peter Anvin
@ 2003-06-24 23:50 ` jlnance
2003-06-25 0:00 ` H. Peter Anvin
2003-06-25 0:07 ` H. Peter Anvin
0 siblings, 2 replies; 6+ messages in thread
From: jlnance @ 2003-06-24 23:50 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] 2.5.72: follow_mount / follow_link
2003-06-24 23:50 ` jlnance
@ 2003-06-25 0:00 ` H. Peter Anvin
2003-06-25 0:07 ` H. Peter Anvin
1 sibling, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2003-06-25 0:00 UTC (permalink / raw)
To: jlnance; +Cc: linux-kernel
jlnance@unity.ncsu.edu 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] 2.5.72: follow_mount / follow_link
2003-06-24 23:50 ` jlnance
2003-06-25 0:00 ` H. Peter Anvin
@ 2003-06-25 0:07 ` H. Peter Anvin
1 sibling, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2003-06-25 0:07 UTC (permalink / raw)
To: jlnance; +Cc: linux-kernel
jlnance@unity.ncsu.edu 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-06-24 23:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-24 14:41 [PATCH] 2.5.72: follow_mount / follow_link Mike Waychison
2003-06-24 14:54 ` viro
2003-06-24 15:42 ` H. Peter Anvin
2003-06-24 23:50 ` jlnance
2003-06-25 0:00 ` H. Peter Anvin
2003-06-25 0:07 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox