mds: fix deadlock between unlinking and linkmerge#52199
Conversation
batrick
left a comment
There was a problem hiding this comment.
I think there is a simpler fix here. The core problem is that StrayManager::reintegrate_stray sets the dentry state to REINTEGRATING before the rename op is even dispatched and acquired the necessary locks. Until that happens, we've simply recorded an intent (the op) without actually changing anything or acquiring any locks.
Had Server::handle_client_rename set the reintegration state after acquiring locks and checking for any pending unlinks, we would not have hit this deadlock, no?
Going further, we know it's a reintegration op whenever it's a |
Not sure I totally get it. The root cause is that the |
|
@batrick I have simplified the code, please take a look again. Thanks. |
|
jenkins test api |
Yes, I understood the cause. The problem, as I see it, is that we're setting |
|
@lxbsz let's talk more about this after standup if it's not clear. I don't want to lose track of this again. |
|
Also, I'm talking about this code: Line 700 in a4b76ef |
|
jenkins test make check |
|
Tests run in ~2 hours - https://shaman.ceph.com/builds/ceph/wip-vshankar-testing-20230828.044427/ (if teuthology behaves :) |
|
Going to run this through testing myself too. |
I ran it last week and the (re)run are in comment #52199 (comment). Failures are known issues, so this is good for merge. |
|
I hope to go through the results tomorrow. I've been busy with a customer case today. |
Here tehy are if you want to have an advance look: https://pulpito.ceph.com/pdonnell-2023-09-09_19:00:20-fs-wip-batrick-testing-20230909.145638-distro-default-smithi/ |
I will have a look today anyway (my test runs show this change is mergeable). |
From: /teuthology/pdonnell-2023-09-09_19:00:20-fs-wip-batrick-testing-20230909.145638-distro-default-smithi/7392394/remote/smithi104/log/df7acbaa-4f54-11ee-9ab7-7b867c8bd7da/ceph-mon.a.log.gz I'll look more tomorrow but just a heads up @lxbsz |
[Edit] This was caused by #46331 and I also reverted the corresponding commits. Since the |
This reverts commit 48f9a89. Fixes: https://tracker.ceph.com/issues/61818 Signed-off-by: Xiubo Li <xiubli@redhat.com>
This reverts commit 478db14. Fixes: https://tracker.ceph.com/issues/61818 Signed-off-by: Xiubo Li <xiubli@redhat.com>
This reverts commit c3b3672. Fixes: https://tracker.ceph.com/issues/61818 Signed-off-by: Xiubo Li <xiubli@redhat.com>
This reverts commit 417f247. Fixes: https://tracker.ceph.com/issues/61818 Signed-off-by: Xiubo Li <xiubli@redhat.com>
…me dentries" This reverts commit d4b9431. Fixes: https://tracker.ceph.com/issues/61818 Signed-off-by: Xiubo Li <xiubli@redhat.com>
If one inode has more than one hardlink and after the primary dentry is unlinked it will located the inode in the stray dir temporarily, which is pending reintegration. Just before the linkmerge/migrate is triggered a link request comes it will fail with -EXDEV. Just skip it and continue the linking. Fixes: https://tracker.ceph.com/issues/56695 Signed-off-by: Xiubo Li <xiubli@redhat.com>
I misunderstood what you said @lxbsz when you pinged me separately regarding this. I get it now (sorry - too many PRs to look at). |
* refs/pull/52199/head: mds: continue linking if targeti is temporarily located in stray dir Revert "mds: wait unlink to finish to avoid conflict when creating same dentries" Revert "mds: clear the STATE_UNLINKING state when the unlink fails" Revert "mds: wait reintegrate to finish when unlinking" Revert "mds: notify the waiters in replica MDSs" Revert "mds: wait the linkmerge/migrate to finish after unlink"
|
@lxbsz the changes associated with this PR are a bit tangled. Can you please go through all the backports for the relevant reverts and close or update them (that they will soon be reverted when this is backported). Make sure the tracker tickets are coherent and consistent. |
@batrick Sure, I will do that today. Thanks! |
In case of one inode have multiple hardlinks, and if an unlink
request removes the primary dentry and just before the linkmerge
is triggered a new unlink request comes. The new unlink request
will need the linkmerge to finish.
We should just wait the linkmerge to finish before handling the
new unlink request for the same inode.
Fixes: https://tracker.ceph.com/issues/58340
Fixes: https://tracker.ceph.com/issues/61818
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