Skip to contentSkip to conversation

first access fails with ENOENT after autofs started

DISCUSSION wengang wang 3 participants 6 messages Jan 29, 2008 – Feb 4, 2008 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hi experts,

In RHEL kernel 2.6.18-53 and mainline kernel 2.6.24,
in function autofs4_lookup() in fs/autofs4/root.c,
if dentry is not found in function autofs4_lookup_unhashed(), a d_instantiate() is done on the dentry passed as parameter instead of d_add().

seems this cause a problem that the first access just after autofs started to
/path/to/<autofsMountPoint>/<nfsMountPoint> fail with the error ENOENT.

If I rolled back to use d_add(), there is no such problem. Is this a bug or I omitted something?

thanks,
wengang.

maintainer
#1 lore raw
Quoted 3 lines · wengang wang

Hi experts,

In RHEL kernel 2.6.18-53 and mainline kernel 2.6.24,

This was a known problem due to a couple of missing patches in the RHEL-5 kernel revision 53.

I'm not aware of a problem with 2.6.24.

Quoted 4 lines

in function autofs4_lookup() in fs/autofs4/root.c,
if dentry is not found in function autofs4_lookup_unhashed(), a d_instantiate() is done on the dentry passed as parameter instead of d_add().

d_instantiate is used to delay hashing the dentry until the following mkdir as this prevents a potential deadlock.

Quoted 7 lines

seems this cause a problem that the first access just after autofs started to
/path/to/<autofsMountPoint>/<nfsMountPoint> fail with the error ENOENT.

If I rolled back to use d_add(), there is no such problem. Is this a bug or I omitted something?

Considering there's virtually no information to go on here I have no idea but this hasn't been seen to be a problem other than in the RHEL kernel above.

You will need to provide a lot more information than this if you want me to investigate.

Ian

#2 lore raw

Thanks Ian for your reply.

Quoted 11 lines · Ian Kent
Quoted 4 lines · wengang wang

Hi experts,

In RHEL kernel 2.6.18-53 and mainline kernel 2.6.24,

This was a known problem due to a couple of missing patches in the RHEL-5 kernel revision 53.

yes.

Quoted 3 lines

I'm not aware of a problem with 2.6.24.

yes, there is no problem with 2.6.24.
By involving it, I just want to say the code
d_instantiate(); //not d_add()
is the same.

Quoted 18 lines
Quoted 5 lines

in function autofs4_lookup() in fs/autofs4/root.c,
if dentry is not found in function autofs4_lookup_unhashed(), a d_instantiate() is done on the dentry passed as parameter instead of d_add().

d_instantiate is used to delay hashing the dentry until the following mkdir as this prevents a potential deadlock.

Quoted 7 lines

seems this cause a problem that the first access just after autofs started to
/path/to/<autofsMountPoint>/<nfsMountPoint> fail with the error ENOENT.

If I rolled back to use d_add(), there is no such problem. Is this a bug or I omitted something?

Quoted 8 lines

Considering there's virtually no information to go on here I have no idea but this hasn't been seen to be a problem other than in the RHEL kernel above.

You will need to provide a lot more information than this if you want me to investigate.

detail for this problem is:
1) adding a line in /etc/auto.master
/topdir /etc/auto.topdir
2) in auto.topdir
subdir -fstype=nfs hostname:/path/to/exported/directory
3) /etc/init.d/autofs restart
4) ll /topdir/subdir
got NO SUCH DIRECTORY here.
by strace, lstat returned ENOENT.

according to your

This was a known problem due to a couple of missing patches in the RHEL-5 kernel revision 53.

I made a patch by comparing RHEL-5 53 kernel with 2.6.24. and seems it solves the problem.
the patch is as below:
----------------------------------------------------------------------------------------------------

fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500 renamed from fs/autofs4/root.c.orig 2008-01-29 22:20:18.000000000 -0500 +10 -2
@@ -662,10 +662,18 @@
         * doesn't do the right thing for all system calls, but it should
         * be OK for the operations we permit from an autofs.
         */
-       if (dentry->d_inode && d_unhashed(dentry)) {
+       if (!oz_mode && d_unhashed(dentry)) {
+               struct dentry *parent = dentry->d_parent;
+               struct dentry *new = d_lookup(parent, &dentry->d_name);
+               if (new != NULL)
+                       dentry = new;
+               else
+                       dentry = ERR_PTR(-ENOENT);
+
                if (unhashed)
                        dput(unhashed);
-               return ERR_PTR(-ENOENT);
+
+               return dentry;
        }
 
        if (unhashed)

----------------------------------------------------------------------------------------------------

is this patch ok and enough for RHEL-5 kernel revision 53?

Quoted 1 line

Ian

thanks,
wengang.

maintainer
#3 lore raw
Quoted 58 lines · wengang wang

Thanks Ian for your reply.

Quoted 11 lines · Ian Kent
Quoted 4 lines · wengang wang

Hi experts,

In RHEL kernel 2.6.18-53 and mainline kernel 2.6.24,

This was a known problem due to a couple of missing patches in the RHEL-5 kernel revision 53.

yes.

Quoted 3 lines

I'm not aware of a problem with 2.6.24.

yes, there is no problem with 2.6.24.
By involving it, I just want to say the code
d_instantiate(); //not d_add()
is the same.

Quoted 18 lines
Quoted 5 lines

in function autofs4_lookup() in fs/autofs4/root.c,
if dentry is not found in function autofs4_lookup_unhashed(), a d_instantiate() is done on the dentry passed as parameter instead of d_add().

d_instantiate is used to delay hashing the dentry until the following mkdir as this prevents a potential deadlock.

Quoted 7 lines

seems this cause a problem that the first access just after autofs started to
/path/to/<autofsMountPoint>/<nfsMountPoint> fail with the error ENOENT.

If I rolled back to use d_add(), there is no such problem. Is this a bug or I omitted something?

Quoted 8 lines

Considering there's virtually no information to go on here I have no idea but this hasn't been seen to be a problem other than in the RHEL kernel above.

You will need to provide a lot more information than this if you want me to investigate.

detail for this problem is:
1) adding a line in /etc/auto.master
/topdir /etc/auto.topdir
2) in auto.topdir
subdir -fstype=nfs hostname:/path/to/exported/directory
3) /etc/init.d/autofs restart
4) ll /topdir/subdir
got NO SUCH DIRECTORY here.
by strace, lstat returned ENOENT.

Quoted 7 lines

according to your

This was a known problem due to a couple of missing patches in the RHEL-5 kernel revision 53.

I made a patch by comparing RHEL-5 53 kernel with 2.6.24. and seems it solves the problem.

Why, an updated kernel is available for RHEL-5 and has been for some time. Try revision 53.1.4.

I started on getting this fixed as soon as I noticed the patches missing.

Quoted 27 lines

the patch is as below:
----------------------------------------------------------------------------------------------------

fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500 renamed from fs/autofs4/root.c.orig 2008-01-29 22:20:18.000000000 -0500 +10 -3
@@ -662,10 +662,18 @@
         * doesn't do the right thing for all system calls, but it should
         * be OK for the operations we permit from an autofs.
         */
-       if (dentry->d_inode && d_unhashed(dentry)) {
+       if (!oz_mode && d_unhashed(dentry)) {
+               struct dentry *parent = dentry->d_parent;
+               struct dentry *new = d_lookup(parent, &dentry->d_name);
+               if (new != NULL)
+                       dentry = new;
+               else
+                       dentry = ERR_PTR(-ENOENT);
+
                if (unhashed)
                        dput(unhashed);
-               return ERR_PTR(-ENOENT);
+
+               return dentry;
        }
 
        if (unhashed)
----------------------------------------------------------------------------------------------------
Quoted 1 line

is this patch ok and enough for RHEL-5 kernel revision 53?

Can't remember now but it's the dentry->d_inode -> !oz_mode change that is needed for the d_add -> d_instantiate deadlock fix and yes we also need to check if someone beat us to the mount with the d_lookup.

However, you really should use the supported updates.

Ian

#4 lore raw

Hi Ian,

I checked the patch for 53.1.4, and my patch is the same as that one:) will use 53.1.4 if there is no special patches on the under using version.

thanks,
wengang.

Quoted 124 lines · Ian Kent
Quoted 66 lines · wengang wang

Thanks Ian for your reply.

Quoted 13 lines · Ian Kent
Quoted 5 lines · wengang wang

Hi experts,

In RHEL kernel 2.6.18-53 and mainline kernel 2.6.24,

This was a known problem due to a couple of missing patches in the RHEL-5 kernel revision 53.

yes.

Quoted 4 lines

I'm not aware of a problem with 2.6.24.

yes, there is no problem with 2.6.24.
By involving it, I just want to say the code
d_instantiate(); //not d_add()
is the same.

Quoted 19 lines
Quoted 6 lines

in function autofs4_lookup() in fs/autofs4/root.c,
if dentry is not found in function autofs4_lookup_unhashed(), a d_instantiate() is done on the dentry passed as parameter instead of d_add().

d_instantiate is used to delay hashing the dentry until the following mkdir as this prevents a potential deadlock.

Quoted 8 lines

seems this cause a problem that the first access just after autofs started to
/path/to/<autofsMountPoint>/<nfsMountPoint> fail with the error ENOENT.

If I rolled back to use d_add(), there is no such problem. Is this a bug or I omitted something?

Quoted 9 lines

Considering there's virtually no information to go on here I have no idea but this hasn't been seen to be a problem other than in the RHEL kernel above.

You will need to provide a lot more information than this if you want me to investigate.

detail for this problem is:
1) adding a line in /etc/auto.master
/topdir /etc/auto.topdir
2) in auto.topdir
subdir -fstype=nfs hostname:/path/to/exported/directory
3) /etc/init.d/autofs restart
4) ll /topdir/subdir
got NO SUCH DIRECTORY here.
by strace, lstat returned ENOENT.

Quoted 8 lines

according to your

This was a known problem due to a couple of missing patches in the RHEL-5 kernel revision 53.

I made a patch by comparing RHEL-5 53 kernel with 2.6.24. and seems it solves the problem.

Why, an updated kernel is available for RHEL-5 and has been for some time. Try revision 53.1.4.

I started on getting this fixed as soon as I noticed the patches missing.

Quoted 27 lines

the patch is as below:
----------------------------------------------------------------------------------------------------

fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500 renamed from fs/autofs4/root.c.orig 2008-01-29 22:20:18.000000000 -0500 +10 -3
@@ -662,10 +662,18 @@
         * doesn't do the right thing for all system calls, but it should
         * be OK for the operations we permit from an autofs.
         */
-       if (dentry->d_inode && d_unhashed(dentry)) {
+       if (!oz_mode && d_unhashed(dentry)) {
+               struct dentry *parent = dentry->d_parent;
+               struct dentry *new = d_lookup(parent, &dentry->d_name);
+               if (new != NULL)
+                       dentry = new;
+               else
+                       dentry = ERR_PTR(-ENOENT);
+
                if (unhashed)
                        dput(unhashed);
-               return ERR_PTR(-ENOENT);
+
+               return dentry;
        }
 
        if (unhashed)
----------------------------------------------------------------------------------------------------
Quoted 2 lines

is this patch ok and enough for RHEL-5 kernel revision 53?

Can't remember now but it's the dentry->d_inode -> !oz_mode change that is needed for the d_add -> d_instantiate deadlock fix and yes we also need to check if someone beat us to the mount with the d_lookup.

However, you really should use the supported updates.

Ian

Signature · 7 lines
Wengang Wang
Member of Technical Staff
Oracle Asia R&D Center
Open Source Technologies Development

Tel:      +86 10 8278 6265
Mobile:   +86 13381078925
#5 lore raw

Dear experts.

I have problem transient chdir fails on kernel 2.6.9-67.ELsmp RHEL(WS Version4).

I'd been heard patch, have you any patch?
Know that update linux kernel, but can't update kernel. Because ECAD Tools(such as synopsys, cadense etc.).

Do you have any idea?

Thank you.

==================================================
JunPyo Kim, CE DT Team
[email protected]
+82-10-2894-4415 / +82-2-6903-4637

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of wengang wang
Sent: Wednesday, January 30, 2008 2:09 PM
To: Ian Kent
Cc: [email protected]
Subject: Re: [autofs] first access fails with ENOENT after autofs started

Hi Ian,

I checked the patch for 53.1.4, and my patch is the same as that one:) will use 53.1.4 if there is no special patches on the under using version.

thanks,
wengang.

Quoted 25 lines · Ian Kent
Quoted 23 lines · wengang wang

Thanks Ian for your reply.

Quoted 13 lines · Ian Kent
Quoted 5 lines · wengang wang

Hi experts,

In RHEL kernel 2.6.18-53 and mainline kernel 2.6.24,

This was a known problem due to a couple of missing patches in the RHEL-5 kernel revision 53.

yes.

Quoted 4 lines

I'm not aware of a problem with 2.6.24.

Quoted 8 lines
Quoted 8 lines

yes, there is no problem with 2.6.24.
By involving it, I just want to say the code
d_instantiate(); //not d_add()
is the same.

Quoted 3 lines
Quoted 3 lines

in function autofs4_lookup() in fs/autofs4/root.c,
if dentry is not found in function autofs4_lookup_unhashed(), a d_instantiate() is done on the dentry passed as parameter instead

of

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

d_add().

d_instantiate is used to delay hashing the dentry until the

following

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

mkdir as this prevents a potential deadlock.

Quoted 3 lines

seems this cause a problem that the first access just after autofs started to
/path/to/<autofsMountPoint>/<nfsMountPoint> fail with the error

ENOENT.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

If I rolled back to use d_add(), there is no such problem. Is this a bug or I omitted something?

Considering there's virtually no information to go on here I have no idea but this hasn't been seen to be a problem other than in the

RHEL

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

kernel above.

You will need to provide a lot more information than this if you

want me

Quoted 14 lines
Quoted 14 lines
Quoted 4 lines

to investigate.

detail for this problem is:
1) adding a line in /etc/auto.master
/topdir /etc/auto.topdir
2) in auto.topdir
subdir -fstype=nfs hostname:/path/to/exported/directory
3) /etc/init.d/autofs restart
4) ll /topdir/subdir
got NO SUCH DIRECTORY here.
by strace, lstat returned ENOENT.

Quoted 6 lines
Quoted 6 lines

according to your

This was a known problem due to a couple of missing patches in the RHEL-5 kernel revision 53.

I made a patch by comparing RHEL-5 53 kernel with 2.6.24. and seems

it

Quoted 12 lines
Quoted 2 lines

solves the problem.

Why, an updated kernel is available for RHEL-5 and has been for some time. Try revision 53.1.4.

I started on getting this fixed as soon as I noticed the patches missing.

Quoted 2 lines

the patch is as below:

------------------------------------------------------------------------
----------------------------

Quoted 4 lines

fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500 line 662

Quoted 4 lines
fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500 renamed from fs/autofs4/root.c.orig 2008-01-29 22:20:18.000000000 -0500 +0 -0
@@ -662,10 +662,18 @@
         * doesn't do the right thing for all system calls, but it

should

Quoted 6 lines

fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500

Quoted 6 lines
fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500 renamed from fs/autofs4/root.c.orig 2008-01-29 22:20:18.000000000 -0500 +3 -1
         * be OK for the operations we permit from an autofs.
         */
-       if (dentry->d_inode && d_unhashed(dentry)) {
+       if (!oz_mode && d_unhashed(dentry)) {
+               struct dentry *parent = dentry->d_parent;
+               struct dentry *new = d_lookup(parent,

&dentry->d_name);

Quoted 12 lines
Quoted 12 lines
fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500 renamed from fs/autofs4/root.c.orig 2008-01-29 22:20:18.000000000 -0500 +7 -1
+               if (new != NULL)
+                       dentry = new;
+               else
+                       dentry = ERR_PTR(-ENOENT);
+
                if (unhashed)
                        dput(unhashed);
-               return ERR_PTR(-ENOENT);
+
+               return dentry;
        }
 
Quoted 2 lines

fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500 line 679

Quoted 2 lines
fs/autofs4/root.c 2008-01-29 22:20:47.000000000 -0500 renamed from fs/autofs4/root.c.orig 2008-01-29 22:20:18.000000000 -0500 +0 -0
        if (unhashed)

------------------------------------------------------------------------
----------------------------

Quoted 5 lines
Quoted 3 lines

is this patch ok and enough for RHEL-5 kernel revision 53?

Can't remember now but it's the dentry->d_inode -> !oz_mode change

that

Quoted 9 lines

is needed for the d_add -> d_instantiate deadlock fix and yes we also need to check if someone beat us to the mount with the d_lookup.

However, you really should use the supported updates.

Ian

Signature · 12 lines
Wengang Wang
Member of Technical Staff
Oracle Asia R&D Center
Open Source Technologies Development

Tel:      +86 10 8278 6265
Mobile:   +86 13381078925

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs