rbd: drop original request earlier for existence check
Subsystems (2)
PATCH 1/1 rbd: drop original request earlier for existence check
The reference to the original request dropped at the end of rbd_img_obj_exists_callback() corresponds to the reference taken in rbd_img_obj_exists_submit() to account for the stat request referring to it. Move the put of that reference up right after clearing that pointer to make its purpose more obvious.
--- drivers/block/rbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/block/rbd.c +0 -0
@@ -2528,6 +2528,7 @@ static void rbd_img_obj_exists_callback(struct
rbd_obj_request *obj_request)
*/
orig_request = obj_request->obj_request;
obj_request->obj_request = NULL;
+ rbd_obj_request_put(orig_request);
rbd_assert(orig_request);
rbd_assert(orig_request->img_request);
@@ -2548,7 +2549,6 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)
if (!rbd_dev->parent_overlap) {
struct ceph_osd_client *osdc;
- rbd_obj_request_put(orig_request);
osdc = &rbd_dev->rbd_client->client->osdc; result = rbd_obj_request_submit(osdc, orig_request); if (!result)
@@ -2578,7 +2578,6 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)
out:
if (orig_request->result)
rbd_obj_request_complete(orig_request);
- rbd_obj_request_put(orig_request);
}
static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
Signature · 1 line
1.7.9.5
Quoted 5 lines · Alex Elder
The reference to the original request dropped at the end of
rbd_img_obj_exists_callback()corresponds to the reference taken inrbd_img_obj_exists_submit()to account for the stat request referring to it. Move the put of that reference up right after clearing that pointer to make its purpose more obvious.
This patch and the one I just posted are available in the "review/wip-postflatten" branch of the ceph-client git repository.
-Alex
Quoted 37 lines
Signed-off-by Alex Elder <[email protected]>--- drivers/block/rbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/block/rbd.c +1
-1@@ -2528,6 +2528,7 @@ static void rbd_img_obj_exists_callback(structrbd_obj_request *obj_request) */ orig_request = obj_request->obj_request; obj_request->obj_request =NULL ; +rbd_obj_request_put (orig_request);rbd_assert (orig_request);rbd_assert (orig_request->img_request);@@ -2548,7 +2549,6 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)if (!rbd_dev->parent_overlap) {struct ceph_osd_client *osdc; -rbd_obj_request_put (orig_request); osdc = &rbd_dev->rbd_client->client->osdc; result =rbd_obj_request_submit (osdc, orig_request);drivers/block/rbd.c +0
-1if (!result)@@ -2578,7 +2578,6 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) out:if (orig_request->result)rbd_obj_request_complete (orig_request); -rbd_obj_request_put (orig_request); }static int
rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
PATCH v2 1/1 rbd: drop original request earlier for existence check
In reply to Alex ElderThe reference to the original request dropped at the end of rbd_img_obj_exists_callback() corresponds to the reference taken in rbd_img_obj_exists_submit() to account for the stat request referring to it. Move the put of that reference up right after clearing that pointer to make its purpose more obvious.
---
v2: rebased to reflect changes in earlier patches
drivers/block/rbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/block/rbd.c +0 -0
@@ -2529,6 +2529,7 @@ static void rbd_img_obj_exists_callback(struct
rbd_obj_request *obj_request)
*/
orig_request = obj_request->obj_request;
obj_request->obj_request = NULL;
+ rbd_obj_request_put(orig_request);
rbd_assert(orig_request);
rbd_assert(orig_request->img_request);
@@ -2549,7 +2550,6 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)
if (!rbd_dev->parent_overlap) {
struct ceph_osd_client *osdc;
- rbd_obj_request_put(orig_request);
osdc = &rbd_dev->rbd_client->client->osdc; result = rbd_obj_request_submit(osdc, orig_request); if (!result)
@@ -2579,7 +2579,6 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)
out:
if (orig_request->result)
rbd_obj_request_complete(orig_request);
- rbd_obj_request_put(orig_request);
}
static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
Signature · 1 line
1.7.9.5
Quoted 45 lines · Alex Elder
The reference to the original request dropped at the end of
rbd_img_obj_exists_callback()corresponds to the reference taken inrbd_img_obj_exists_submit()to account for the stat request referring to it. Move the put of that reference up right after clearing that pointer to make its purpose more obvious.Signed-off-by Alex Elder <[email protected]>---
v2: rebased to reflect changes in earlier patchesdrivers/block/rbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/block/rbd.c +1
-1@@ -2529,6 +2529,7 @@ static void rbd_img_obj_exists_callback(structrbd_obj_request *obj_request) */ orig_request = obj_request->obj_request; obj_request->obj_request =NULL ; +rbd_obj_request_put (orig_request);rbd_assert (orig_request);rbd_assert (orig_request->img_request);@@ -2549,7 +2550,6 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)if (!rbd_dev->parent_overlap) {struct ceph_osd_client *osdc; -rbd_obj_request_put (orig_request); osdc = &rbd_dev->rbd_client->client->osdc; result =rbd_obj_request_submit (osdc, orig_request);if (!result)
drivers/block/rbd.c +0
-1@@ -2579,7 +2579,6 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) out:if (orig_request->result)rbd_obj_request_complete (orig_request); -rbd_obj_request_put (orig_request); }static int
rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)