ceph: fix incorrectly decoding the mdsmap bug
PATCH 1/1 ceph: fix incorrectly decoding the mdsmap bug
From: Xiubo Li <[email protected]>
When decreasing the 'max_mds' in the cephfs cluster, when the extra MDS or MDSes are not removed yet, the mdsmap may only decreased the 'max_mds' but still having the that or those MDSes 'in' or in the export targets list.
--- fs/ceph/mdsmap.c | 4 ---- 1 file changed, 4 deletions(-)
fs/ceph/mdsmap.c +0 -4
@@ -263,10 +263,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) goto nomem;for (j =0 ; j < num_export_targets; j++) { target =ceph_decode_32 (&pexport_targets); -if (target >= m->possible_max_rank) { - err = -EIO ; - goto corrupt; - } info->export_targets[j] = target; } }else {
Signature · 1 line
2.31.1
Quoted 17 lines · On Fri, 2021-11-05 at 17:34 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
When decreasing the '
max_mds' in the cephfs cluster, when the extra MDS or MDSes are not removed yet, the mdsmap may only decreased the 'max_mds' but still having the that or those MDSes 'in' or in the export targets list.Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/mdsmap.c | 4 ---- 1 file changed, 4 deletions(-)fs/ceph/mdsmap.c +0
-0
fs/ceph/mdsmap.c struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) · line 268
Quoted 10 lines
fs/ceph/mdsmap.c +0
-4@@ -263,10 +263,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) goto nomem;for (j =0 ; j < num_export_targets; j++) { target =ceph_decode_32 (&pexport_targets); -if (target >= m->possible_max_rank) { - err = -EIO ; - goto corrupt; - } info->export_targets[j] = target; } }else {
Thanks Xiubo, looks good. Given the severity when mdsmap decoding fails, I think we should probably mark this for stable too. Let me know if you have any objections.
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 23 lines · Jeff Layton
Quoted 22 lines · On Fri, 2021-11-05 at 17:34 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
When decreasing the '
max_mds' in the cephfs cluster, when the extra MDS or MDSes are not removed yet, the mdsmap may only decreased the 'max_mds' but still having the that or those MDSes 'in' or in the export targets list.Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/mdsmap.c | 4 ---- 1 file changed, 4 deletions(-)fs/ceph/mdsmap.c +0
-2@@ -263,10 +263,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) goto nomem;for (j =0 ; j < num_export_targets; j++) { target =ceph_decode_32 (&pexport_targets); -if (target >= m->possible_max_rank) { - err = -EIO ;
Quoted 8 lines
fs/ceph/mdsmap.c struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) · line 268
Quoted 5 lines
fs/ceph/mdsmap.c +0
-2- goto corrupt; - } info->export_targets[j] = target; } }else {Thanks Xiubo, looks good. Given the severity when mdsmap decoding fails, I think we should probably mark this for stable too. Let me know if you have any objections.
Yeah, it should be.