[LU-6625] symlink() sets wrong errno, ENOENT Created: 21/May/15 Updated: 04/Jun/15 Resolved: 04/Jun/15 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Hiroya Nozaki | Assignee: | Niu Yawei (Inactive) |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | patch | ||
| Attachments: |
|
| Severity: | 3 |
| Rank (Obsolete): | 9223372036854775807 |
| Description |
|
the online-manual on symlink() tells that symlink() should set errno EEXIST if specified link-path already exists. But it actually sets ENOENT when the last ward of the link-path is "/". It looks to me that the last ward is "/" is awkward. But the directory specified as link-path actually exists so I think we should set errno EEXIST. This patch modifies a if-statement in ll_lookup_nd for client to look up MDS properly and for symlink() to set errno EEXIST. By the way, you can see the difference of errno between lustre and ext3 with the attached trivial test program |
| Comments |
| Comment by Gerrit Updater [ 21/May/15 ] |
|
Hiroya Nozaki (nozaki.hiroya@jp.fujitsu.com) uploaded a new patch: http://review.whamcloud.com/14902 |
| Comment by Niu Yawei (Inactive) [ 29/May/15 ] |
|
The reason of kernel returning -ENOENT for such case is: see lookup_create(): /*
* Special case - lookup gave negative, but... we had foo/bar/
* From the vfs_mknod() POV we just have a negative dentry -
* all is fine. Let's be bastards - you had / on the end, you've
* been asking for (non-existent) directory. -ENOENT for you.
*/
if (unlikely(!is_dir && nd->last.name[nd->last.len])) {
dput(dentry);
dentry = ERR_PTR(-ENOENT);
}
I don't think we need to fix this in Lustre, and actually -ENOENT does make sense to me as the comment said above. BTW: Because local filesystem needn't do revalidation, ext3 returns -EEXIST for such case. |
| Comment by Gerrit Updater [ 02/Jun/15 ] |
|
Andreas Dilger (andreas.dilger@intel.com) uploaded a new patch: http://review.whamcloud.com/15110 |
| Comment by Hiroya Nozaki [ 04/Jun/15 ] |
|
hm, sounds reasonable. |
| Comment by Niu Yawei (Inactive) [ 04/Jun/15 ] |
|
Thank you, Hiroya. |