unacceptable bug in autofs kernel module
Dear developers,
Here is the bug in autofs3 module which causing so much pain. It simply stopped me from adding much more interesting features to Autodir http://www.intraperson.com/autodir/
Taken from Linux kernel 2.4 autofs module source.
file: root.c function: autofs_root_lookup. protocol: 3
/*
* If this dentry is unhashed, then we shouldn't honour this
* lookup even if the dentry is positive. Returning ENOENT here
* 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) )
return ERR_PTR(-ENOENT);
*/
if ( dentry->d_inode && d_unhashed(dentry) ) {
printk( "ENOENT for %s\n", dentry->d_name.name );
return ERR_PTR(-ENOENT);
}I added printk to easily trace it. To my surprise autofs 4 also has similar code.
Because of this, user space test program reporting like this:
fail : /test/t944 : No such file or directory fail : /test/t4187 : No such file or directory fail : /test/t100 : No such file or directory fail : /test/t806 : No such file or directory fail : /test/t3451 : No such file or directory fail : /test/t1790 : No such file or directory fail : /test/t3555 : No such file or directory fail : /test/t3098 : No such file or directory fail : /test/t4085 : No such file or directory fail : /test/t3935 : No such file or directory
with corresponding kernel messages are,
ENOENT for t944
ENOENT for t4187
ENOENT for t100
ENOENT for t806
ENOENT for t3451
ENOENT for t1790
ENOENT for t3555
ENOENT for t3098
ENOENT for t4085
ENOENT for t3935
The error rate as taken from months of stress tests -- ie ENOENT; is around 0.002% and increases as system load increases. Even at this rate I do not think it is acceptable in production systems.
Thanks in advance.
Regards
ramana
Signature · 1 line
http://www.intraperson.com
Ian Kent
maintainerQuoted 5 lines · ramana
Dear developers,
Here is the bug in autofs3 module which causing so much pain. It simply stopped me from adding much more interesting features to Autodir
http://www.intraperson.com/autodir/
Thanks for this.
You've provided some symptoms but you haven't provided any explanation as to why this is a bug.
Can you explain why you need the kernel to honour a lookup for an already deleted dentry?
This could be due to the way that autofs does a d_drop instead of a d_delete in the directory unlink callback. However, the dentry, for all intentional purposes, has already been deleted.
Quoted 73 lines
Taken from Linux kernel 2.4 autofs module source.
file: root.c function: autofs_root_lookup. protocol: 3/* * If this dentry is unhashed, then we shouldn't honour this * lookup even if the dentry is positive. Returning ENOENT here * 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) ) return ERR_PTR(-ENOENT); */ if ( dentry->d_inode && d_unhashed(dentry) ) { printk( "ENOENT for %s\n", dentry->d_name.name ); return ERR_PTR(-ENOENT); }I added printk to easily trace it. To my surprise autofs 4 also has similar code.
Because of this, user space test program reporting like this:
fail : /test/t944 : No such file or directory
fail : /test/t4187 : No such file or directory
fail : /test/t100 : No such file or directory
fail : /test/t806 : No such file or directory
fail : /test/t3451 : No such file or directory
fail : /test/t1790 : No such file or directory
fail : /test/t3555 : No such file or directory
fail : /test/t3098 : No such file or directory
fail : /test/t4085 : No such file or directory
fail : /test/t3935 : No such file or directorywith corresponding kernel messages are,
ENOENT for t944
ENOENT for t4187
ENOENT for t100
ENOENT for t806
ENOENT for t3451
ENOENT for t1790
ENOENT for t3555
ENOENT for t3098
ENOENT for t4085
ENOENT for t3935The error rate as taken from months of stress tests -- ie ENOENT; is around 0.002% and increases as system load increases. Even at this rate I do not think it is acceptable in production systems.
Thanks in advance.
Regards
ramanaSignature · 7 lines
http://www.intraperson.com _______________________________________________ autofs mailing list [email protected] http://linux.kernel.org/mailman/listinfo/autofs
Quoted 10 lines · Ian Kent
Quoted 5 lines · ramana
Dear developers,
Here is the bug in autofs3 module which causing so much pain. It simply stopped me from adding much more interesting features to Autodir http://www.intraperson.com/autodir/
Quoted 7 lines
Thanks for this.
You've provided some symptoms but you haven't provided any explanation as to why this is a bug.
Can you explain why you need the kernel to honour a lookup for an already deleted dentry?
If it it is deleted then it should cleanup if any and report back to the user space autofs/autodir daemon again that this directory is missing instead of directly reporting that entry does not exist because it is deleted. After all that is what autofs is all about.
What is important is that -t option is user settable option. If the user choses low value like 1 or 2 seconds these autofs directories will be deleted more frequently. But deletion does not mean they do not exist actually.
It it certainly bug. Let us view from user space application which is accessing these autofs directories. Most of the time they get access to the directories which exist and perfectly legal. And suddenly at some time kernel decides itself and reports it does not exist even without asking user space autofs/autodir daemon.
What is important here is, after a while, if I access it again after ENOENT, everything works perfectly. Is not this inconsistent behavior?
Above statement is true as I tested it from user space applications for millions of directory requests rather then looking from kernal point of view. If I access a autofs directory for 999 times and I get ENOENT for 1 time without proper reason from user space daemon, it is certainly bug.
Thanks for your reply.
Quoted 4 lines
This could be due to the way that autofs does a
d_dropinstead of ad_deletein the directory unlink callback. However, the dentry, for all intentional purposes, has already been deleted.
Regards
ramana
Signature · 1 line
http://www.intraperson.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ian Kent
maintainerQuoted 6 lines · ramana
Quoted 3 lines · Ian Kent
Do you have a simple way of reproducing this?
And the environment.
Version of kernel?
Version of autofs?
What autofs4 module?
Ian
Ian Kent
maintainerQuoted 2 lines · ramana
autofs 3 with Fdora core 1 but I suspect even autofs4 also will behave similarly as code does not look different with ENOENT replies.
autofs 3 is not being developed any more.
If you are testing you should use the latest autofs4. This can be done by using 2.6.10 or applying the appropriate patch.
If want to try this out let me know and I will post the latest patches I have to kernel.org now.
Ian
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ian Kent
maintainerQuoted 19 lines · ramana
Quoted 17 lines · Ian Kent
Quoted 4 lines · ramana
autofs 3 with Fdora core 1 but I suspect even autofs4 also will behave similarly as code does not look different with ENOENT replies.
autofs 3 is not being developed any more.
If you are testing you should use the latest autofs4. This can be done by using 2.6.10 or applying the appropriate patch.
If want to try this out let me know and I will post the latest patches I have to kernel.org now.
Quoted 7 lines
Quoted 5 lines
Ian
I would like to test it using latest patches rather then going for 2.6.10 as not everyone migrate to 2.6 right now.
I need to do a couple more small things so I'll get them done and upload the patches asap.
What kernel version will you use?
Quoted 5 lines
I know autofs 3 module not maintained anymore but I would like to clarify one issue here. It is autofs3 module not maintained or autofs3 protocol. It is becuase autofs4 module supports autofs3 protocol as far as my understanding.
I've tried to maintain compatability.
It's been a long time since I tested this at length and many changes have been made since without this compatibility testing.
So, yes autofs4 should be backward compatible and no I can't confirm how good or not it is now.
Ian
Quoted 3 lines · ramana
Here is the bug in autofs3 module which causing so much pain. It simply stopped me from adding much more interesting features to Autodir
http://www.intraperson.com/autodir/
[snip]
Quoted 4 lines
Because of this, user space test program reporting like this:
fail : /test/t944 : No such file or directory
fail : /test/t4187 : No such file or directory
Hmm.. I wonder if this might be related to a weirdness we're seeing. Running autofs-4.1.3 with previous latest patch to kernel (pre-2005 release) and users use LSF to submit batch jobs to hosts. On linux hosts, user level programs will sometimes exit quickly with a "file does not exist" error, even though you can login to the host and see the file/dir just fine. As a hacked work-around, we have a pre-exec script that tries to stat all the directories they need to force the mounts to happen before their program touches the files.
I didn't see any attempts to patch this bit.. did you have any ideas on how to
patch that particular piece of code? Or just comment it out?
Signature · 3 lines
Mike Marion-Unix SysAdmin/Staff Engineer-http://www.qualcomm.com Groundskeeper Willie: "oooh.. Me mule wouldn't walk in the mud. So I had to put 17 bullets in 'em." ==> Simpsons
Ian Kent
maintainerQuoted 11 lines · On Thu, 3 Feb 2005 [email protected] wrote:
Quoted 3 lines · ramana
Here is the bug in autofs3 module which causing so much pain. It simply stopped me from adding much more interesting features to Autodir
http://www.intraperson.com/autodir/[snip]
Quoted 4 lines
Because of this, user space test program reporting like this:
fail : /test/t944 : No such file or directory
fail : /test/t4187 : No such file or directory
Quoted 8 lines
Hmm.. I wonder if this might be related to a weirdness we're seeing. Running autofs-4.1.3 with previous latest patch to kernel (pre-2005 release) and users use LSF to submit batch jobs to hosts. On linux hosts, user level programs will sometimes exit quickly with a "file does not exist" error, even though you can login to the host and see the file/dir just fine. As a hacked work-around, we have a pre-exec script that tries to stat all the directories they need to force the mounts to happen before their program touches the files.
Does the stat actually mount anything?
It shouldn't?
Ian
Quoted 31 lines · Ian Kent
Quoted 16 lines · On Thu, 3 Feb 2005 [email protected] wrote:
Quoted 3 lines · ramana
Here is the bug in autofs3 module which causing so much pain. It simply stopped me from adding much more interesting features to Autodir http://www.intraperson.com/autodir/
[snip]
Quoted 6 lines
Because of this, user space test program reporting like this:
fail : /test/t944 : No such file or directory
fail : /test/t4187 : No such file or directoryQuoted 10 lines
Hmm.. I wonder if this might be related to a weirdness we're seeing. Running autofs-4.1.3 with previous latest patch to kernel (pre-2005 release) and users use LSF to submit batch jobs to hosts. On linux hosts, user level programs will sometimes exit quickly with a "file does not exist" error, even though you can login to the host and see the file/dir just fine. As a hacked work-around, we have a pre-exec script that tries to stat all the directories they need to force the mounts to happen before their program touches the files.
Quoted 8 lines
Does the stat actually mount anything?
It shouldn't?Ian
I moved latest version Autodir to autofs 4 kernel module and so far all stress tests tell me autofs4 protocol is performing well without these ENOENT errors. I have to do little bit more tests before concluding anything as final.
For more details check http://www.intraperson.com/autodir/.
DVersion: Autodir 0.93.0 and above.
Regards
ramana
Signature · 1 line
http://www.intraperson.com
Quoted 6 lines
I moved latest version Autodir to autofs 4 kernel module and so far all stress tests tell me autofs4 protocol is performing well without these ENOENT errors. I have to do little bit more tests before concluding anything as final.
For more details check http://www.intraperson.com/autodir/.
DVersion: Autodir 0.93.0 and above.
Recent tests done under little loaded machine, show me this problem still exist even in autofs4 kernel module.
Regards
ramana
Signature · 1 line
http://www.intraperson.com