Skip to content

Commit 1606e7f

Browse files
committed
Merge PR ceph#56602 into main
* refs/pull/56602/head: mds: always make getattr wait for xlock to be released by the previous client Reviewed-by: Patrick Donnelly <[email protected]> Reviewed-by: Venky Shankar <[email protected]> Reviewed-by: Leonid Usov <[email protected]> Reviewed-by: Greg Farnum <[email protected]>
2 parents 9ac05d9 + b1ea37c commit 1606e7f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/mds/Server.cc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4106,6 +4106,7 @@ CDir* Server::try_open_auth_dirfrag(CInode *diri, frag_t fg, const MDRequestRef&
41064106
void Server::handle_client_getattr(const MDRequestRef& mdr, bool is_lookup)
41074107
{
41084108
const cref_t<MClientRequest> &req = mdr->client_request;
4109+
client_t client = mdr->get_client();
41094110

41104111
if (req->get_filepath().depth() == 0 && is_lookup) {
41114112
// refpath can't be empty for lookup but it can for
@@ -4127,6 +4128,17 @@ void Server::handle_client_getattr(const MDRequestRef& mdr, bool is_lookup)
41274128
if (r > 0)
41284129
return; // delayed
41294130

4131+
// Do not batch if any xlock is held
4132+
if (!r) {
4133+
CInode *in = mdr->in[0];
4134+
if (((mask & CEPH_CAP_LINK_SHARED) && (in->linklock.is_xlocked_by_client(client))) ||
4135+
((mask & CEPH_CAP_AUTH_SHARED) && (in->authlock.is_xlocked_by_client(client))) ||
4136+
((mask & CEPH_CAP_XATTR_SHARED) && (in->xattrlock.is_xlocked_by_client(client))) ||
4137+
((mask & CEPH_CAP_FILE_SHARED) && (in->filelock.is_xlocked_by_client(client)))) {
4138+
r = -1;
4139+
}
4140+
}
4141+
41304142
if (r < 0) {
41314143
// fall-thru. let rdlock_path_pin_ref() check again.
41324144
} else if (is_lookup) {
@@ -4168,7 +4180,6 @@ void Server::handle_client_getattr(const MDRequestRef& mdr, bool is_lookup)
41684180
* handling this case here is easier than weakening rdlock
41694181
* semantics... that would cause problems elsewhere.
41704182
*/
4171-
client_t client = mdr->get_client();
41724183
int issued = 0;
41734184
Capability *cap = ref->get_client_cap(client);
41744185
if (cap && (mdr->snapid == CEPH_NOSNAP ||

0 commit comments

Comments
 (0)