Bug 43262
Summary: | mkdir under automounted directory fails with EACCESS instead of EEXIST | ||
---|---|---|---|
Product: | File System | Reporter: | Andrew McNabb (amcnabb) |
Component: | NFS | Assignee: | Trond Myklebust (trondmy) |
Status: | RESOLVED DOCUMENTED | ||
Severity: | normal | CC: | alan |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | - | Subsystem: | |
Regression: | No | Bisected commit-id: |
Description
Andrew McNabb
2012-05-18 15:44:56 UTC
(From python bug) | I guess this is the magic in mkdir -p | | mkdir("expert", 0755) = -1 EACCES (Permission denied) | chdir("expert") = 0 | mkdir("tmp", 0755) = -1 EEXIST (File exists) | | I'm not sure how I feel about that. I think we have more or less a policy in os & shutil not to change directories | unless really necessary (like make_archive). (Also from the Python bug) | > Event if it wasn't done, calling mkdir() ought to trigger the mount. | | I’m not sure if/where the behavior is defined – let’s what the Linux people say. The thing to note is Linus has decreed that for efficiency reasons, autofs and other users of the d_automount field in struct dentry_operations will now only automount if you attempt to actually access the directory. The idea is to speed up 'ls -l' by avoiding unnecessary automount upcalls. The recommended way to access the automounted directory itself today is therefore to use the backslash-terminated notation /net/foo/bar/. So if you were to change your stat requests to stat('/net/prodigy/') then that would likely trigger the automount instead of returning ENOENT. Trond, thanks for the response. Just to clarify: 1) Did you mean to say that if you "change your stat requests to stat('/net/prodigy/.') then..."? 2) Intuitively, it seems like mkdir("/net/prodigy/tmp") would count as an access of "/net/prodigy" and would trigger a mount of "/net/prodigy". Does a mkdir of a subdirectory not count as an access of the parent directory? Yes, any access to a subdir or child of /net/prodigy should trigger an automount. I was looking at your 'stat()' calls in the python bug report prior to the mkdir() attempt. |