rbd: mark the original request as done if stat request fails
[cascardo/linux.git] / drivers / block / rbd.c
index fb7f86d..5e55d1c 100644 (file)
@@ -2742,8 +2742,8 @@ out_err:
  * When the read completes, this page array will be transferred to
  * the original object request for the copyup operation.
  *
- * If an error occurs, record it as the result of the original
- * object request and mark it done so it gets completed.
+ * If an error occurs, it is recorded as the result of the original
+ * object request in rbd_img_obj_exists_callback().
  */
 static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
 {
@@ -2813,10 +2813,6 @@ out_err:
                ceph_release_page_vector(pages, page_count);
        if (parent_request)
                rbd_img_request_put(parent_request);
-       obj_request->result = result;
-       obj_request->xferred = 0;
-       obj_request_done_set(obj_request);
-
        return result;
 }
 
@@ -2868,19 +2864,25 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)
                obj_request_existence_set(orig_request, true);
        } else if (result == -ENOENT) {
                obj_request_existence_set(orig_request, false);
-       } else if (result) {
-               orig_request->result = result;
-               goto out;
+       } else {
+               goto fail_orig_request;
        }
 
        /*
         * Resubmit the original request now that we have recorded
         * whether the target object exists.
         */
-       orig_request->result = rbd_img_obj_request_submit(orig_request);
-out:
-       if (orig_request->result)
-               rbd_obj_request_complete(orig_request);
+       result = rbd_img_obj_request_submit(orig_request);
+       if (result)
+               goto fail_orig_request;
+
+       return;
+
+fail_orig_request:
+       orig_request->result = result;
+       orig_request->xferred = 0;
+       obj_request_done_set(orig_request);
+       rbd_obj_request_complete(orig_request);
 }
 
 static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)