Skip to contentSkip to conversation

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

PATCH Superseded [email protected] 3 participants 4 messages Jun 28, 2023 – Jun 29, 2023

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

From: Xiubo Li <[email protected]>

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'.

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

---

V2:
- Rephrased the commit comment for better understanding from Milind

 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
Reviewed-by on v2 1/1
#1 lore raw

Looks good to me.

Quoted 44 lines · On Wed, Jun 28, 2023 at 5:29 AM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

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'.

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

---

V2:
- Rephrased the commit comment for better understanding from Milind

 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
#2 lore raw
In reply to [email protected]

Patch looks good to me. Sorry I must nitpick the commit message wording:

If a client sends out a cap update dropping caps with the prior 'seq' just before an incoming cap revoke request, then the client may drop the revoke because it believes it's already released the requested capabilities. This causes
the MDS to wait indefinitely for the client to respond to the revoke. It's therefore always a good idea to ack the cap revoke request with the bumped up 'seq'.

Quoted 44 lines · On Tue, Jun 27, 2023 at 7:59 PM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

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'.

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

---

V2:
- Rephrased the commit comment for better understanding from Milind

 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 · 5 lines
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D
author
#3 lore raw
Quoted 9 lines · Patrick Donnelly

Patch looks good to me. Sorry I must nitpick the commit message wording:

If a client sends out a cap update dropping caps with the prior 'seq' just before an incoming cap revoke request, then the client may drop the revoke because it believes it's already released the requested capabilities. This causes
the MDS to wait indefinitely for the client to respond to the revoke. It's therefore always a good idea to ack the cap revoke request with the bumped up 'seq'.

Updated it by sending out the V3.

Thanks

- Xiubo

Quoted 45 lines · On Tue, Jun 27, 2023 at 7:59 PM <[email protected]> wrote:
Quoted 43 lines

From: Xiubo Li <[email protected]>

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'.

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

---

V2:
- Rephrased the commit comment for better understanding from Milind

  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