Skip to content

Commit cc56430

Browse files
MaxKellermannidryomov
authored andcommitted
ceph: clear s_cap_reconnect when ceph_pagelist_encode_32() fails
This MDS reconnect error path leaves s_cap_reconnect set. send_mds_reconnect() sets the bit at the beginning of the reconnect, but the first failing operation after that, ceph_pagelist_encode_32(), can jump to `fail:` without clearing it. __ceph_remove_cap() consults that flag to decide whether cap releases should be queued. A reconnect-preparation failure therefore leaves the session in reconnect mode from the cap-release path's point of view and can strand release work until some later state transition repairs it. Signed-off-by: Max Kellermann <max.kellermann@ionos.com> Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 803447f commit cc56430

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

fs/ceph/mds_client.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4956,7 +4956,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc,
49564956
/* placeholder for nr_caps */
49574957
err = ceph_pagelist_encode_32(recon_state.pagelist, 0);
49584958
if (err)
4959-
goto fail;
4959+
goto fail_clear_cap_reconnect;
49604960

49614961
if (test_bit(CEPHFS_FEATURE_MULTI_RECONNECT, &session->s_features)) {
49624962
recon_state.msg_version = 3;
@@ -5046,6 +5046,10 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc,
50465046
ceph_pagelist_release(recon_state.pagelist);
50475047
return;
50485048

5049+
fail_clear_cap_reconnect:
5050+
spin_lock(&session->s_cap_lock);
5051+
session->s_cap_reconnect = 0;
5052+
spin_unlock(&session->s_cap_lock);
50495053
fail:
50505054
ceph_msg_put(reply);
50515055
up_read(&mdsc->snap_rwsem);

0 commit comments

Comments
 (0)