Skip to contentSkip to conversation

ceph: skip the memories when received a higher version of message

PATCH In review [email protected] 2 participants 4 messages Mar 1, 2022 – Mar 2, 2022 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ceph: skip the memories when received a higher version of message

From: Xiubo Li <[email protected]>

We should skip the extra memories which are from the higher version just likes the libcephfs client does.

URL: https://tracker.ceph.com/issues/54430

---
 fs/ceph/mds_client.c | 3 +++
 1 file changed, 3 insertions(+)
fs/ceph/mds_client.c +3 -0
index 94b4c6508044..608d077f2eeb 100644
@@ -313,6 +313,7 @@ static int parse_reply_info_lease(void **p, void *end,
 {
 	u8 struct_v;
 	u32 struct_len;
+	void *lend;
 
 	if (features == (u64)-1) {
 		u8 struct_compat;
@@ -332,6 +333,7 @@ static int parse_reply_info_lease(void **p, void *end,
 		*altname = NULL;
 	}
 
+	lend = *p + struct_len;
 	ceph_decode_need(p, end, struct_len, bad);
 	*lease = *p;
 	*p += sizeof(**lease);
@@ -347,6 +349,7 @@ static int parse_reply_info_lease(void **p, void *end,
 			*altname_len = 0;
 		}
 	}
+	*p = lend;
 	return 0;
 bad:
 	return -EIO;
Signature · 1 line
2.27.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 32 lines · On Tue, 2022-03-01 at 22:39 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

We should skip the extra memories which are from the higher version just likes the libcephfs client does.

URL: https://tracker.ceph.com/issues/54430

---
 fs/ceph/mds_client.c | 3 +++
 1 file changed, 3 insertions(+)
fs/ceph/mds_client.c +2 -0
index 94b4c6508044..608d077f2eeb 100644
@@ -313,6 +313,7 @@ static int parse_reply_info_lease(void **p, void *end,
 {
 	u8 struct_v;
 	u32 struct_len;
+	void *lend;
 
 	if (features == (u64)-1) {
 		u8 struct_compat;
@@ -332,6 +333,7 @@ static int parse_reply_info_lease(void **p, void *end,
 		*altname = NULL;
 	}
 
+	lend = *p + struct_len;
 	ceph_decode_need(p, end, struct_len, bad);
 	*lease = *p;
 	*p += sizeof(**lease);

fs/ceph/mds_client.c static int parse_reply_info_lease(void **p, void *end, · line 355

Quoted 7 lines
fs/ceph/mds_client.c +1 -0
@@ -347,6 +349,7 @@ static int parse_reply_info_lease(void **p, void *end,
 			*altname_len = 0;
 		}
 	}
+	*p = lend;
 	return 0;
 bad:
 	return -EIO;

Feel free to fold this into the appropriate patch in wip-fscrypt if you like...

author
#2 lore raw
Quoted 43 lines · Jeff Layton
Quoted 32 lines · On Tue, 2022-03-01 at 22:39 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

We should skip the extra memories which are from the higher version just likes the libcephfs client does.

URL: https://tracker.ceph.com/issues/54430

---
  fs/ceph/mds_client.c | 3 +++
  1 file changed, 3 insertions(+)
fs/ceph/mds_client.c +2 -0
index 94b4c6508044..608d077f2eeb 100644
@@ -313,6 +313,7 @@ static int parse_reply_info_lease(void **p, void *end,
  {
  	u8 struct_v;
  	u32 struct_len;
+	void *lend;
 
  	if (features == (u64)-1) {
  		u8 struct_compat;
@@ -332,6 +333,7 @@ static int parse_reply_info_lease(void **p, void *end,
  		*altname = NULL;
  	}
 
+	lend = *p + struct_len;
  	ceph_decode_need(p, end, struct_len, bad);
  	*lease = *p;
  	*p += sizeof(**lease);

fs/ceph/mds_client.c static int parse_reply_info_lease(void **p, void *end, · line 355

Quoted 7 lines
fs/ceph/mds_client.c +1 -0
@@ -347,6 +349,7 @@ static int parse_reply_info_lease(void **p, void *end,
  			*altname_len = 0;
  		}
  	}
+	*p = lend;
  	return 0;
  bad:
  	return -EIO;

Feel free to fold this into the appropriate patch in wip-fscrypt if you like...

Quoted 2 lines

Sure.

author
#3 lore raw
In reply to Jeff Layton
Quoted 43 lines · Jeff Layton
Quoted 32 lines · On Tue, 2022-03-01 at 22:39 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

We should skip the extra memories which are from the higher version just likes the libcephfs client does.

URL: https://tracker.ceph.com/issues/54430

---
  fs/ceph/mds_client.c | 3 +++
  1 file changed, 3 insertions(+)
fs/ceph/mds_client.c +2 -0
index 94b4c6508044..608d077f2eeb 100644
@@ -313,6 +313,7 @@ static int parse_reply_info_lease(void **p, void *end,
  {
  	u8 struct_v;
  	u32 struct_len;
+	void *lend;
 
  	if (features == (u64)-1) {
  		u8 struct_compat;
@@ -332,6 +333,7 @@ static int parse_reply_info_lease(void **p, void *end,
  		*altname = NULL;
  	}
 
+	lend = *p + struct_len;
  	ceph_decode_need(p, end, struct_len, bad);
  	*lease = *p;
  	*p += sizeof(**lease);

fs/ceph/mds_client.c static int parse_reply_info_lease(void **p, void *end, · line 355

Quoted 7 lines
fs/ceph/mds_client.c +1 -0
@@ -347,6 +349,7 @@ static int parse_reply_info_lease(void **p, void *end,
  			*altname_len = 0;
  		}
  	}
+	*p = lend;
  	return 0;
  bad:
  	return -EIO;

Feel free to fold this into the appropriate patch in wip-fscrypt if you like...

Quoted 1 line

Hi Jeff,

Done and I also have rebased wip-fscrypt branch to the testing branch. Since I need some patches from testing branch to continue my another snapshot related patch series.

- Xiubo