diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2009-05-28 17:34:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-29 11:40:02 -0400 |
commit | bd6daba909d8484bd2ccf6017db4028d7a420927 (patch) | |
tree | e5c5fa2ddb9b3658a24c15ca4050c71f68dc634f | |
parent | b2e1feaf0af6b8a826b86748a19ddc2013ab7dbd (diff) |
procfs: make errno values consistent when open pident vs exit(2) race occurs
proc_pident_instantiate() has following call flow.
proc_pident_lookup()
proc_pident_instantiate()
proc_pid_make_inode()
And, proc_pident_lookup() has following error handling.
const struct pid_entry *p, *last;
error = ERR_PTR(-ENOENT);
if (!task)
goto out_no_task;
Then, proc_pident_instantiate should return ENOENT too when racing against
exit(2) occur.
EINAL has two bad reason.
- it implies caller is wrong. bad the race isn't caller's mistake.
- man 2 open don't explain EINVAL. user often don't handle it.
Note: Other proc_pid_make_inode() caller already use ENOENT properly.
Acked-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/proc/base.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index fb45615943c2..3326bbf9ab95 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1956,7 +1956,7 @@ static struct dentry *proc_pident_instantiate(struct inode *dir, | |||
1956 | const struct pid_entry *p = ptr; | 1956 | const struct pid_entry *p = ptr; |
1957 | struct inode *inode; | 1957 | struct inode *inode; |
1958 | struct proc_inode *ei; | 1958 | struct proc_inode *ei; |
1959 | struct dentry *error = ERR_PTR(-EINVAL); | 1959 | struct dentry *error = ERR_PTR(-ENOENT); |
1960 | 1960 | ||
1961 | inode = proc_pid_make_inode(dir->i_sb, task); | 1961 | inode = proc_pid_make_inode(dir->i_sb, task); |
1962 | if (!inode) | 1962 | if (!inode) |