Skip to contentSkip to conversation

ceph: fix mdsmap decode for v >= 17

PATCH In review Luís Henriques 2 participants 4 messages Oct 27, 2022 – Oct 30, 2022 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: fix mdsmap decode for v >= 17

Commit d93231a6bc8a ("ceph: prevent a client from exceeding the MDS maximum xattr size") was merged before the corresponding MDS-side changes have been merged. With the introduction of 'bal_rank_mask' in the mdsmap, the decoding of maps with v>=17 is now incorrect. Fix this by skipping the 'bal_rank_mask' string decoding.

Fixes d93231a6bc8a ("ceph: prevent a client from exceeding the MDS maximum xattr size")

---
Hi!

This inconsistency was introduced by ceph PR #43284; I think that, before picking this patch, we need to get PR #46357 merged to avoid new problems.

Cheers,
--
Luís

 fs/ceph/mdsmap.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ceph/mdsmap.c +2 -0
index 3fbabc98e1f7..fe4f1a6c3465 100644
@@ -379,6 +379,8 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
 		ceph_decode_skip_8(p, end, bad_ext);
 		/* required_client_features */
 		ceph_decode_skip_set(p, end, 64, bad_ext);
+		/* bal_rank_mask */
+		ceph_decode_skip_string(p, end, bad_ext);
 		ceph_decode_64_safe(p, end, m->m_max_xattr_size, bad_ext);
 	} else {
 		/* This forces the usage of the (sync) SETXATTR Op */
#1 lore raw
Quoted 28 lines · Luís Henriques

Commit d93231a6bc8a ("ceph: prevent a client from exceeding the MDS maximum xattr size") was merged before the corresponding MDS-side changes have been merged. With the introduction of 'bal_rank_mask' in the mdsmap, the decoding of maps with v>=17 is now incorrect. Fix this by skipping the 'bal_rank_mask' string decoding.

Fixes d93231a6bc8a ("ceph: prevent a client from exceeding the MDS maximum xattr size")

---
Hi!

This inconsistency was introduced by ceph PR #43284; I think that, before picking this patch, we need to get PR #46357 merged to avoid new problems.

Cheers,
--
Luís

  fs/ceph/mdsmap.c | 2 ++
  1 file changed, 2 insertions(+)
fs/ceph/mdsmap.c +0 -0
index 3fbabc98e1f7..fe4f1a6c3465 100644

fs/ceph/mdsmap.c struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) · line 386

Quoted 8 lines
fs/ceph/mdsmap.c +2 -0
@@ -379,6 +379,8 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
  		ceph_decode_skip_8(p, end, bad_ext);
  		/* required_client_features */
  		ceph_decode_skip_set(p, end, 64, bad_ext);
+		/* bal_rank_mask */
+		ceph_decode_skip_string(p, end, bad_ext);
  		ceph_decode_64_safe(p, end, m->m_max_xattr_size, bad_ext);
  	} else {
  		/* This forces the usage of the (sync) SETXATTR Op */

Luis,

Because the ceph PR #43284 will break kclient here and your xattr size patch got merged long time ago, we should fix it in ceph. More detail please see my comments in:

https://github.com/ceph/ceph/pull/46357#issuecomment-1294290492

Thanks!

- Xiubo

#2 lore raw
Quoted 40 lines · Xiubo Li
Quoted 28 lines · Luís Henriques

Commit d93231a6bc8a ("ceph: prevent a client from exceeding the MDS maximum xattr size") was merged before the corresponding MDS-side changes have been merged. With the introduction of 'bal_rank_mask' in the mdsmap, the decoding of maps with v>=17 is now incorrect. Fix this by skipping the 'bal_rank_mask' string decoding.

Fixes d93231a6bc8a ("ceph: prevent a client from exceeding the MDS maximum xattr size")

---
Hi!

This inconsistency was introduced by ceph PR #43284; I think that, before picking this patch, we need to get PR #46357 merged to avoid new problems.

Cheers,
--
Luís

  fs/ceph/mdsmap.c | 2 ++
  1 file changed, 2 insertions(+)
fs/ceph/mdsmap.c +0 -0
index 3fbabc98e1f7..fe4f1a6c3465 100644

fs/ceph/mdsmap.c struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) · line 386

Quoted 8 lines
fs/ceph/mdsmap.c +2 -0
@@ -379,6 +379,8 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
  		ceph_decode_skip_8(p, end, bad_ext);
  		/* required_client_features */
  		ceph_decode_skip_set(p, end, 64, bad_ext);
+		/* bal_rank_mask */
+		ceph_decode_skip_string(p, end, bad_ext);
  		ceph_decode_64_safe(p, end, m->m_max_xattr_size, bad_ext);
  	} else {
  		/* This forces the usage of the (sync) SETXATTR Op */

Luis,

Quoted 5 lines

Because the ceph PR #43284 will break kclient here and your xattr size patch got merged long time ago, we should fix it in ceph. More detail please see my comments in:

https://github.com/ceph/ceph/pull/46357#issuecomment-1294290492

OK, agreed. I'll update this PR to try to fix it on the MDS side instead. And let's try to have it merged as soon as possible to prevent further issues.

Cheers,
--
Luís

#3 lore raw
Quoted 40 lines · Luís Henriques
Quoted 39 lines · Xiubo Li
Quoted 28 lines · Luís Henriques

Commit d93231a6bc8a ("ceph: prevent a client from exceeding the MDS maximum xattr size") was merged before the corresponding MDS-side changes have been merged. With the introduction of 'bal_rank_mask' in the mdsmap, the decoding of maps with v>=17 is now incorrect. Fix this by skipping the 'bal_rank_mask' string decoding.

Fixes d93231a6bc8a ("ceph: prevent a client from exceeding the MDS maximum xattr size")

---
Hi!

This inconsistency was introduced by ceph PR #43284; I think that, before picking this patch, we need to get PR #46357 merged to avoid new problems.

Cheers,
--
Luís

   fs/ceph/mdsmap.c | 2 ++
   1 file changed, 2 insertions(+)
fs/ceph/mdsmap.c +0 -0
index 3fbabc98e1f7..fe4f1a6c3465 100644

fs/ceph/mdsmap.c struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2) · line 386

Quoted 8 lines
fs/ceph/mdsmap.c +2 -0
@@ -379,6 +379,8 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
   		ceph_decode_skip_8(p, end, bad_ext);
   		/* required_client_features */
   		ceph_decode_skip_set(p, end, 64, bad_ext);
+		/* bal_rank_mask */
+		ceph_decode_skip_string(p, end, bad_ext);
   		ceph_decode_64_safe(p, end, m->m_max_xattr_size, bad_ext);
   	} else {
   		/* This forces the usage of the (sync) SETXATTR Op */

Luis,

Quoted 8 lines
Quoted 5 lines

Because the ceph PR #43284 will break kclient here and your xattr size patch got merged long time ago, we should fix it in ceph. More detail please see my comments in:

https://github.com/ceph/ceph/pull/46357#issuecomment-1294290492

OK, agreed. I'll update this PR to try to fix it on the MDS side instead. And let's try to have it merged as soon as possible to prevent further issues.

Sounds good!

- Xiubo

Quoted 4 lines

Cheers,
--
Luís