mds: rdlock_path_xlock_dentry supports returning auth target inode#49691
mds: rdlock_path_xlock_dentry supports returning auth target inode#49691
Conversation
99274eb to
97b4f1a
Compare
97b4f1a to
109b698
Compare
|
Going through the changes now, but this requires a test case - please add one. |
109b698 to
c2c8c42
Compare
src/mds/MDCache.cc
Outdated
| if (pdnvec) | ||
| pdnvec->clear(); // do not confuse likes of rdlock_path_pin_ref(); | ||
| if (pin) | ||
| *pin = nullptr; |
There was a problem hiding this comment.
Is this a related change to the bug? If not, please have this as a separate commit (and explain why resetting *pin is correct or if it does not matter).
There was a problem hiding this comment.
Is this a related change to the bug? If not, please have this as a separate commit (and explain why resetting
*pinis correct or if it does not matter).
pdnvec and pin are used to return values to the caller and it is better to clear them when an error needs to be returned. pdnvec is cleared but pin is not in some places where errors need to be returned, so I add them. It is not related to this bug.
There was a problem hiding this comment.
ACK - thanks for explaining. Better to have this as a separate commit for clarity.
There was a problem hiding this comment.
ACK - thanks for explaining. Better to have this as a separate commit for clarity.
OK, I have deleted them.
| // do not xlock the tail dentry if target inode exists and caller wants it | ||
| if (xlock_dentry && (dnl->is_null() || !want_inode) && |
There was a problem hiding this comment.
doesn't the dentry linkage need to be valid here as well ?
There was a problem hiding this comment.
doesn't the dentry linkage need to be valid here as well ?
The tail dentry can be null and we can also create one if it doesn't exist. The caller gets a null tail dentry and then links it with an inode, a file or hard link can be created. And we need to provide a xlocked auth tail dentry to the caller because it needs to be modified.
|
@zhsgao Mind adding a test case for the fix? |
I have added it in a new commit. This bug will only be triggered in kernel client and ceph-fuse client can handle it normally, so add |
6b6cd5d to
44b85b9
Compare
|
A bug in the test framework of kernel client make the test unable to run, use PR #50001 to fix it. |
f4210c2 to
e5cf3f5
Compare
|
Looks fine. Added this is my test backlog for integration test runs. |
|
@zhsgao there are a couple of new failures with this change. I'll debug those. The good thing is that most other tests run fine. |
OK, I'll also take a look at these failures. Thanks! |
|
@zhsgao Looks like this change is causing this test failure: https://pulpito.ceph.com/vshankar-2023-03-16_06:43:29-fs-wip-vshankar-testing-20230315.085747-testing-default-smithi/7210002/ The MDS crashes with the following backtrace: Seems to be related to this change as the assert failure is related to an auth check:
|
|
Another instance of the MDS crash: https://pulpito.ceph.com/vshankar-2023-03-16_06:43:29-fs-wip-vshankar-testing-20230315.085747-testing-default-smithi/7210061/ |
`Server::handle_client_openc` will call `Server::handle_client_open` if the target inode exists. `Server::handle_client_open requires` the target inode to be auth if client sets `O_WRONLY` or `O_TRUNC`, but `Server::rdlock_path_xlock_dentry` can not ensure that. The assertion that the target inode is auth in `Server::handle_client_open` may fail and it will crash mds. So add a parameter to to support returning auth target inode if it exists and forward the request if necessary. The tail dentry may not be auth anymore when an auth target inode is provided as required by the caller, because we can't require both of them to be auth in one mds. This bug will only be triggered in kernel client, because ceph-fuse client will try to lookup the target before sending a create request to mds and it can send an open request instead if the target exists. But kernel client will send the create request to mds without lookup first because `atomic open` is supported to improve performance. Fixes: https://tracker.ceph.com/issues/58411 Signed-off-by: Zhansong Gao <zhsgao@hotmail.com>
…me mds as the inode Signed-off-by: Zhansong Gao <zhsgao@hotmail.com>
e5cf3f5 to
9945f3b
Compare
I have fixed it. I didn't check the code logic related to snapshot before. Thanks very much! |
Could you also explain a bit about the bug and/or the commit diff that fixes this? (makes it easier to review rather than going through large parts of changes over again) |
The crash occurs because |
|
jenkins test make check arm64 |
|
Here are the test runs: https://pulpito.ceph.com/?branch=wip-vshankar-testing-20230509.090020 There are a bit more failures in the fs suite than we normally run into (known issues, teuthology infra issues, etc..). I'm going to debug the new failures (mostly workunit failures and dead jobs due to timeout). |
|
@zhsgao I debugged the failed test and I think there is a bug in path_traverse but I need to confirm. Will update soon... |
OK! If the bug is confirmed, I will try to fix it as soon as possible. Thanks! |
Looks like this change was not causing the failures. I was wrong. Will update in a while. |
False alarm. No related failures found with this change. |
Server::handle_client_opencwill callServer::handle_client_openif the target inode exists.Server::handle_client_openrequires the target inode to be auth if client setsO_WRONLYorO_TRUNC, butServer::rdlock_path_xlock_dentrycan not ensure that. The assertion that the target inode is auth inServer::handle_client_openmay fail and it will crash mds. So add a parameter to to support returning auth target inode if it exists and forward the request if necessary. The tail dentry may not be auth anymore when an auth target inode is provided as required by the caller, because we can't require both of them to be auth in one mds.This bug will only be triggered in kernel client, because ceph-fuse client will try to lookup the target before sending a create request to mds and it can send an open request instead if the target exists. But kernel client will send the create request to mds without lookup first because
atomic openis supported to improve performance.Fixes: https://tracker.ceph.com/issues/58411
Signed-off-by: Zhansong Gao zhsgao@hotmail.com
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. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
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 windows