Skip to contentSkip to conversation

libceph: fix misleading ceph_osdc_cancel_request() comment

PATCH In review Ilya Dryomov 3 participants 3 messages May 17, 2022 – May 18, 2022 Ceph common code (libceph)

lore
Share & tools
lore

Ilya Dryomov

author maintainer
#0 lore raw

PATCH 1/1 libceph: fix misleading ceph_osdc_cancel_request() comment

cancel_request() never guaranteed that after its return the OSD client would be completely done with the OSD request. The callback (if specified) can still be invoked and a ref can still be held.

---
 net/ceph/osd_client.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
net/ceph/osd_client.c +7 -2
index 4b88f2a4a6e2..9d82bb42e958 100644
@@ -4591,8 +4591,13 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
 EXPORT_SYMBOL(ceph_osdc_start_request);
 
 /*
- * Unregister a registered request.  The request is not completed:
- * ->r_result isn't set and __complete_request() isn't called.
+ * Unregister request.  If @req was registered, it isn't completed:
+ * r_result isn't set and __complete_request() isn't invoked.
+ *
+ * If @req wasn't registered, this call may have raced with
+ * handle_reply(), in which case r_result would already be set and
+ * __complete_request() would be getting invoked, possibly even
+ * concurrently with this call.
  */
 void ceph_osdc_cancel_request(struct ceph_osd_request *req)
 {
Signature · 1 line
2.19.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Ilya Dryomov

cancel_request() never guaranteed that after its return the OSD client would be completely done with the OSD request. The callback (if specified) can still be invoked and a ref can still be held.

---
  net/ceph/osd_client.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
net/ceph/osd_client.c +0 -2
index 4b88f2a4a6e2..9d82bb42e958 100644
@@ -4591,8 +4591,13 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
  EXPORT_SYMBOL(ceph_osdc_start_request);
 
  /*
- * Unregister a registered request.  The request is not completed:
- * ->r_result isn't set and __complete_request() isn't called.

net/ceph/osd_client.c int ceph_osdc_start_request(struct ceph_osd_client *osdc, · line 4603

Quoted 10 lines
net/ceph/osd_client.c +7 -0
+ * Unregister request.  If @req was registered, it isn't completed:
+ * r_result isn't set and __complete_request() isn't invoked.
+ *
+ * If @req wasn't registered, this call may have raced with
+ * handle_reply(), in which case r_result would already be set and
+ * __complete_request() would be getting invoked, possibly even
+ * concurrently with this call.
   */
  void ceph_osdc_cancel_request(struct ceph_osd_request *req)
  {
Reviewed-by on v1 1/1
#2 lore raw
In reply to Ilya Dryomov
Quoted 19 lines · Ilya Dryomov

cancel_request() never guaranteed that after its return the OSD client would be completely done with the OSD request. The callback (if specified) can still be invoked and a ref can still be held.

---
 net/ceph/osd_client.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
net/ceph/osd_client.c +0 -2
index 4b88f2a4a6e2..9d82bb42e958 100644
@@ -4591,8 +4591,13 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
 EXPORT_SYMBOL(ceph_osdc_start_request);
 
 /*
- * Unregister a registered request.  The request is not completed:
- * ->r_result isn't set and __complete_request() isn't called.

net/ceph/osd_client.c int ceph_osdc_start_request(struct ceph_osd_client *osdc, · line 4603

Quoted 10 lines
net/ceph/osd_client.c +7 -0
+ * Unregister request.  If @req was registered, it isn't completed:
+ * r_result isn't set and __complete_request() isn't invoked.
+ *
+ * If @req wasn't registered, this call may have raced with
+ * handle_reply(), in which case r_result would already be set and
+ * __complete_request() would be getting invoked, possibly even
+ * concurrently with this call.
  */
 void ceph_osdc_cancel_request(struct ceph_osd_request *req)
 {