client: Handle empty pathnames for ceph_chownat() and ceph_statxat()#59936
client: Handle empty pathnames for ceph_chownat() and ceph_statxat()#59936
ceph_chownat() and ceph_statxat()#59936Conversation
|
|
5e6b231 to
91f9ab9
Compare
|
jenkins test make check |
|
jenkins test make check arm64 |
|
jenkins test windows |
|
jenkins test make check arm64 |
|
jenkins test windows |
dparmar18
left a comment
There was a problem hiding this comment.
what i thought in my last approval was a comment, sorry!
|
Windows test failure ticket: https://tracker.ceph.com/issues/68282 Also appears in #58936. Doesn't appear to be caused by this PR. |
chrisphoffman
left a comment
There was a problem hiding this comment.
Can you also do a teuthology run to show that the linux code path passes?
91f9ab9 to
9462874
Compare
Someone else will have to perform a teuthology run on my behalf I guess. |
|
jenkins test api |
|
The Windows CI failure is legitimate, the test is failing on a clean Linux-only vstart environment: The other Windows failure was legitimate as well, #58936 (forcefully merged) broke MDS, which now crashes whenever we attempt to do a mount: #58936 (comment) |
chrisphoffman
left a comment
There was a problem hiding this comment.
I'm also seeing the same test failure as seen in: #59936 (comment)
Can you track this down?
9462874 to
143528c
Compare
Oh..that was a silly mistake from my side mixing up the order of |
chrisphoffman
left a comment
There was a problem hiding this comment.
Running into an issue on linux:
$ ceph_test_libcephfs --gtest_filter=*Statxat
Note: Google Test filter = *Statxat
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from LibCephFS
[ RUN ] LibCephFS.Statxat
ceph/src/test/libcephfs/test.cc:2713: Failure
Expected equality of these values:
ceph_statxat(cmount, dir_fd, "", &stx, 0, 0x1000)
Which is: -22
0
[ FAILED ] LibCephFS.Statxat (60 ms)
[----------] 1 test from LibCephFS (60 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (60 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] LibCephFS.Statxat
1 FAILED TEST
Do you have a linux based machine to do local tests on? After you address the above, can you run both tests you modified and post here the output passing?
Fine, this time its Alright I won't bother you hereafter until I make the tests work as expected. Thanks for running it through all this while. |
chrisphoffman
left a comment
There was a problem hiding this comment.
Tests look good!
Since we're adding support for AT_EMPTY_PATH for some calls, I recommend we look and add support to all calls that normally handle it. That way we won't have to circle back to this in the future.
For example:
link, stat, lstat etc
There was a problem hiding this comment.
Since we're adding support for
AT_EMPTY_PATHfor some calls, I recommend we look and add support to all calls that normally handle it. That way we won't have to circle back to this in the future.
This was briefly touched on previously here and the current PR was a followup to that discussion.
For example:
link,stat,lstatetc
IIUC, AT_EMPTY_PATH flag is only relevant with *at() calls and not others. With an implementation missing for linkat() I don't think we are left with any APIs accepting AT_EMPTY_PATH. faccessat() and utimensat() are comparatively recent additions(since Linux 5.8) to honour this flag which I prefer to be considered after a while(as we might still have systems with Linux < 5.8).
235e3b1 to
4598444
Compare
I missed that, wanted to make sure we followed up on remaining calls. Thanks!
I came up with those examples above from the man pages. I agree it seems like it should only apply at *at() calls. That being said, I'm still a bit confused if this is actually the case. There's See: Lines 8583 to 8588 in 4598444 See the man page here to see nit: While that shows there's no code that needs to be changed, I recommend changes in libcephfs.h show AT_EMPTY_PATH does work now for ceph/src/include/cephfs/libcephfs.h Line 953 in 4598444 |
chrisphoffman
left a comment
There was a problem hiding this comment.
LGTM- thanks for all your work and discussion!
tl;dr longer version Given that, I think it would make more sense to reference statx(2) than fstatat(2) in the commit message/PR description. Let me know if I should update once more.
I think the earlier explanation invalidates the above suggestion. |
man fchownat(2)[1] says the following:
. . .
AT_EMPTY_PATH (since Linux 2.6.39)
If pathname is an empty string, operate on the file referred to by
dirfd (which may have been obtained using the open(2) O_PATH flag).
In this case, dirfd can refer to any type of file, not just a
directory. If dirfd is AT_FDCWD, the call operates on the current
working directory.
. . .
Look out for an empty pathname and use the relative fd's inode in the
presence of AT_EMPTY_PATH flag before calling internal _setattr().
Fixes: https://tracker.ceph.com/issues/68189
Review with: git show -w
[1] https://www.man7.org/linux/man-pages/man2/fchownat.2.html
Signed-off-by: Anoop C S <[email protected]>
flags parameter for ceph_statxat() API is supposed to accept only AT_STATX_DONT_SYNC and AT_SYMLINK_NOFOLLOW. Modify the corresponding documentation to reflect the acceptance of above two flags. Signed-off-by: Anoop C S <[email protected]>
man statx(2)[1] says the following:
. . .
AT_EMPTY_PATH
If pathname is an empty string, operate on the file referred to by
dirfd (which may have been obtained using the open(2) O_PATH flag).
In this case, dirfd can refer to any type of file, not just a
directory.
If dirfd is AT_FDCWD, the call operates on the current working
directory.
. . .
Look out for an empty pathname and use the relative fd's inode in the
presence of AT_EMPTY_PATH flag before calling internal _getattr().
Fixes: https://tracker.ceph.com/issues/68189
Review with: git show -w
[1] https://www.man7.org/linux/man-pages/man2/statx.2.html
Signed-off-by: Anoop C S <[email protected]>
4598444 to
edd7fe7
Compare
|
I've updated commit message and PR description to link statx(2) instead of fstatat(2). |
|
@vshankar can I have the final blessings here? |
|
This PR is under test in https://tracker.ceph.com/issues/69069. |
* refs/pull/59936/head: client: Gracefully handle empty pathname for statxat() libcephfs.h: Fix API documentation for ceph_statxat client: Gracefully handle empty pathname for chownat() Reviewed-by: Dhairya Parmar <[email protected]> Reviewed-by: Christopher Hoffman <[email protected]>
@mchangir Where are we with the teuthology runs? Is this good to go in now? |
looks okay ... I've just finished reviewing the QA run |
If the test run passes, please go ahead and merge. @mchangir |
man fchownat(2) and man statx(2) explains about the special case where empty pathnames are valid with
AT_EMPTY_PATHflag specified. But current client code crashes for ceph_chownat() and ceph_statxat() under this situation which should be gracefully handled as per the standards.Fixes: https://tracker.ceph.com/issues/68189
Review with:
git show -w