client: do not proceed with I/O if filehandle is invalid#55457
client: do not proceed with I/O if filehandle is invalid#55457
Conversation
f6da755 to
188c5d3
Compare
|
last push made some minor naming corrections |
|
Why are low level interface methods being exercised rather than the usual high level methods ? |
|
I meant to ask "Why are you explicitly invoking the low-level APIs directly in your test rather then invoking the high level entry points?" |
ah right, so it's the way nonblocking.cc is being used. it is intended to test ll_preadv_pwritev thoroughly. (atleast that is what im following looking at the existing test case) |
src/client/Client.cc
Outdated
| { | ||
| ceph_assert(ceph_mutex_is_locked_by_me(client_lock)); | ||
|
|
||
| if (fh == NULL || !fh_exists(fh)) { |
There was a problem hiding this comment.
Have you checked other unchecked uses to the file handles?
There was a problem hiding this comment.
... and this isn't really async specific, isn't it? (given that the test case is in nonblocking.cc).
There was a problem hiding this comment.
... and this isn't really async specific, isn't it? (given that the test case is in nonblocking.cc).
right, not specific to async
There was a problem hiding this comment.
Have you checked other unchecked uses to the file handles?
I found most cases handled in respective APIs, this seems to be the only condition(so far) that wasn't checked. If you can think of any/find any do let me know.
There was a problem hiding this comment.
is it possible that a file handle has no inode associated with it?
There was a problem hiding this comment.
... and this isn't really async specific, isn't it? (given that the test case is in nonblocking.cc).
right, not specific to async
Move the test to generic location then?
There was a problem hiding this comment.
can goto src/test/libcephfs/test.cc
There was a problem hiding this comment.
We have two kind of APIs:
- that accept
fd(an int) as an arg - that accept pointer to file handle as an arg. (sync + async)
Most APIs fall in 1st case and all of them have a check for file handle pointer's validness:
Fh *fh = get_filehandle(fd);
if (!fh)
return -CEPHFS_EBADF;
we already have tests for this in test.cc (test case named BadFileDesc). So the sync calls are sorted.
It is only the 2nd case where APIs directly make use of the file handle pointers and there are only three of them i.e. ll_preadv_pwritev, ll_writev and ll_readv.
My current implementation adds the check to helper func _preadv_pwritev_locked that all three of these use but the APIs that fall in 1st case make sure they check for it before passing in the fh to the helpers. So my question is what should be done, should I add these checks in all the three APIs (which i feel looks redundant) or keep it the way it is i.e. have the helper check for it? @mchangir @vshankar
There was a problem hiding this comment.
My current implementation adds the check to helper func
_preadv_pwritev_lockedthat all three of these use but the APIs that fall in 1st case make sure they check for it before passing in thefhto the helpers. So my question is what should be done, should I add these checks in all the three APIs (which i feel looks redundant) or keep it the way it is i.e. have the helper check for it? @mchangir @vshankar
Just have the fd checked in _preadv_pwritev_locked.
There was a problem hiding this comment.
this breaks up higher level APIs, eventually every API calls Client::_preadv_pwritev_locked but the thing is high level APIs add fh to the fd_map while low level APIs make use of ll_unclosed_fh_set so if the file is opened using high level API like open or openat then those calls will fails since it wont be able to find the fh in ll_unclosed_fh_set as it was never added to it(the helper I added looks in ll_unclosed_fh_set)
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
Fixes: https://tracker.ceph.com/issues/64313 Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
66d093a to
8b6230c
Compare
|
a fh pointer is stored in |
Are you mixing using the high and low level calls? If yes, that need to be avoided - you either use the high level or the low level, isn't it @dparmar18 ? |
Is someone is shooting themselves in the foot, we can only do so much, isn't it? |
|
@dparmar18 I'm now totally confused as what this change is aiming to fix - it was much clear earlier, sorry! |
Well at least they can be warned, but if this doesn't make sense then I'll switch to calling the helper from the low level APIs since this helper can't be used in Client::_preadv_pwritev_locked because it is used by both high and low level APIs |
yeah since it is incomplete, it is bound to create confusions, wait a bit im pushing the changes since i know the answer for #55457 (comment) |
It is named _ll_fh_exists meaning it is a helper func only to be used with low level APIs. Fixes: https://tracker.ceph.com/issues/64313 Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
24c962a to
6a23327
Compare
Along with some minor adjustments to the code to make use of same int for all the ops. Fixes: https://tracker.ceph.com/issues/64313 Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
and guard the `if (!mref_reader.is_state_satisfied())` stmt with braces. Fixes: https://tracker.ceph.com/issues/64313 Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
|
|
jenkins test api |
* refs/pull/55457/head: client: check for bad file handle in low level I/O APIs client: check for bad file handle in ll_preadv_pwritev client: add function to check if file handle exists src/test: test async I/O with invalid/closed file handle
|
Reruning tests with #55909 and #55908 included. See - https://pulpito.ceph.com/vshankar-2024-03-04_08:26:39-fs-wip-vshankar-testing-20240304.042522-testing-default-smithi/ |
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e