mds: wait reintegrate to finish when unlinking
When unlinking a remote dentry while primary dentry has been just
unlinked and was trying to reintegrate, which will finally be a
RENAME client request to current MDS, the stray dentry.
If the RENAME request is sleeping and waiting for some resources
just after authpin the CInode, so the unlinking request will mark
the remote dentry as UNLINKING state and then add itself to the
wait list just waiting for the CInode to be authpined.
Then after the RENAME request is retried later it will add to a
wait list again and waiting for the UNLINKING state to be cleared.
And finally the RENAME and UNLINK requests will be deadlock.
This fix will block the UNLINK request if the reintegrate_stray
is going on for current dentry.
Fixes: https://tracker.ceph.com/issues/58340
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit
c3b36723defae32b0a3ef1ac37b58ec57d356b65)