[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: File symlink_test.c    
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.
Moreover ext3 returns 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
Subject: LU-6625 llite: symlink() sets wrong errno, ENOENT
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: ac5fd86f91923259007a2d1984c44f104f300550

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
Subject: LU-6625 obdclass: remove malloc fault injection
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 0ec71e5838903eafd54421496ebc5a4a5c924593

Comment by Hiroya Nozaki [ 04/Jun/15 ]

hm, sounds reasonable.
OK, thank you !! I'm afraid to say but could you please close this ticket as not a bug ??

Comment by Niu Yawei (Inactive) [ 04/Jun/15 ]

Thank you, Hiroya.

Generated at Sat Feb 10 02:01:50 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.