Skip to contentSkip to conversation

ceph: don't let check_caps skip sending responses for revoke msgs

PATCH Superseded [email protected] 2 participants 3 messages Jun 27, 2023

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: don't let check_caps skip sending responses for revoke msgs

From: Xiubo Li <[email protected]>

If just before the revoke request, which will increase the 'seq', is sent out the clients released the corresponding caps and sent out the cap update request to MDS with old 'seq', the mds will miss checking the seqs and calculating the caps.

We should always send an ack for revoke requests.

Cc: [email protected]
Cc: Patrick Donnelly <[email protected]>
URL: https://tracker.ceph.com/issues/61782

---
 fs/ceph/caps.c | 9 +++++++++
 1 file changed, 9 insertions(+)
fs/ceph/caps.c +9 -0
index 1052885025b3..eee2fbca3430 100644
@@ -3737,6 +3737,15 @@ static void handle_cap_grant(struct inode *inode,
 	}
 	BUG_ON(cap->issued & ~cap->implemented);
 
+	/* don't let check_caps skip sending a response to MDS for revoke msgs */
+	if (le32_to_cpu(grant->op) == CEPH_CAP_OP_REVOKE) {
+		cap->mds_wanted = 0;
+		if (cap == ci->i_auth_cap)
+			check_caps = 1; /* check auth cap only */
+		else
+			check_caps = 2; /* check all caps */
+	}
+
 	if (extra_info->inline_version > 0 &&
 	    extra_info->inline_version >= ci->i_inline_version) {
 		ci->i_inline_version = extra_info->inline_version;
Signature · 1 line
2.40.1
#1 lore raw
Quoted 9 lines · On Tue, Jun 27, 2023 at 12:33 PM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

If just before the revoke request, which will increase the 'seq', is sent out the clients released the corresponding caps and sent out the cap update request to MDS with old 'seq', the mds will miss checking the seqs and calculating the caps.

We should always send an ack for revoke requests.

I think the commit message needs to be rephrased for better understanding to something like:

If a client sends out a cap update request with the old 'seq' just before a pending cap revoke request, then the MDS might miscalculate the 'seqs' and caps. It's therefore always a good idea to ack the cap revoke request with the bumped up 'seq'.

Xiubo, please let me know if this sounds okay to you.

Quoted 32 lines

Cc: [email protected]
Cc: Patrick Donnelly <[email protected]>
URL: https://tracker.ceph.com/issues/61782

---
 fs/ceph/caps.c | 9 +++++++++
 1 file changed, 9 insertions(+)
fs/ceph/caps.c +9 -1
index 1052885025b3..eee2fbca3430 100644
@@ -3737,6 +3737,15 @@ static void handle_cap_grant(struct inode *inode,
        }
        BUG_ON(cap->issued & ~cap->implemented);
 
+       /* don't let check_caps skip sending a response to MDS for revoke msgs */
+       if (le32_to_cpu(grant->op) == CEPH_CAP_OP_REVOKE) {
+               cap->mds_wanted = 0;
+               if (cap == ci->i_auth_cap)
+                       check_caps = 1; /* check auth cap only */
+               else
+                       check_caps = 2; /* check all caps */
+       }
+
        if (extra_info->inline_version > 0 &&
            extra_info->inline_version >= ci->i_inline_version) {
                ci->i_inline_version = extra_info->inline_version;
--

2.40.1

Signature · 1 line
Milind
author
#2 lore raw
Quoted 12 lines · Milind Changire
Quoted 8 lines · On Tue, Jun 27, 2023 at 12:33 PM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

If just before the revoke request, which will increase the 'seq', is sent out the clients released the corresponding caps and sent out the cap update request to MDS with old 'seq', the mds will miss checking the seqs and calculating the caps.

We should always send an ack for revoke requests.

I think the commit message needs to be rephrased for better understanding to something like:

Quoted 7 lines

If a client sends out a cap update request with the old 'seq' just before a pending cap revoke request, then the MDS might miscalculate the 'seqs' and caps. It's therefore always a good idea to ack the cap revoke request with the bumped up 'seq'.

Xiubo, please let me know if this sounds okay to you.

Milind,

Yeah, this looks much better.

I will update it.

Thanks

- Xiubo

Quoted 32 lines
Quoted 31 lines

Cc: [email protected]
Cc: Patrick Donnelly <[email protected]>
URL: https://tracker.ceph.com/issues/61782

---
  fs/ceph/caps.c | 9 +++++++++
  1 file changed, 9 insertions(+)
fs/ceph/caps.c +9 -1
index 1052885025b3..eee2fbca3430 100644
@@ -3737,6 +3737,15 @@ static void handle_cap_grant(struct inode *inode,
         }
         BUG_ON(cap->issued & ~cap->implemented);
 
+       /* don't let check_caps skip sending a response to MDS for revoke msgs */
+       if (le32_to_cpu(grant->op) == CEPH_CAP_OP_REVOKE) {
+               cap->mds_wanted = 0;
+               if (cap == ci->i_auth_cap)
+                       check_caps = 1; /* check auth cap only */
+               else
+                       check_caps = 2; /* check all caps */
+       }
+
         if (extra_info->inline_version > 0 &&
             extra_info->inline_version >= ci->i_inline_version) {
                 ci->i_inline_version = extra_info->inline_version;
--

2.40.1