提交 71c20a06 编写于 作者: I Ilya Dryomov

rbd: rbd_obj_request_wait() should cancel the request if interrupted

rbd_obj_request_wait() should cancel the underlying OSD request if
interrupted.  Otherwise libceph will hold onto it indefinitely, causing
assert failures or leaking the original object request.

This also adds an rbd wrapper around ceph_osdc_cancel_request() to
match rbd_obj_request_submit() and rbd_obj_request_wait().
Signed-off-by: NIlya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: NAlex Elder <elder@linaro.org>
上级 c9f9b93d
......@@ -1527,11 +1527,37 @@ static bool obj_request_type_valid(enum obj_request_type type)
static int rbd_obj_request_submit(struct ceph_osd_client *osdc,
struct rbd_obj_request *obj_request)
{
dout("%s: osdc %p obj %p\n", __func__, osdc, obj_request);
dout("%s %p\n", __func__, obj_request);
return ceph_osdc_start_request(osdc, obj_request->osd_req, false);
}
static void rbd_obj_request_end(struct rbd_obj_request *obj_request)
{
dout("%s %p\n", __func__, obj_request);
ceph_osdc_cancel_request(obj_request->osd_req);
}
/*
* Wait for an object request to complete. If interrupted, cancel the
* underlying osd request.
*/
static int rbd_obj_request_wait(struct rbd_obj_request *obj_request)
{
int ret;
dout("%s %p\n", __func__, obj_request);
ret = wait_for_completion_interruptible(&obj_request->completion);
if (ret < 0) {
dout("%s %p interrupted\n", __func__, obj_request);
rbd_obj_request_end(obj_request);
return ret;
}
dout("%s %p done\n", __func__, obj_request);
return 0;
}
static void rbd_img_request_complete(struct rbd_img_request *img_request)
{
......@@ -1558,15 +1584,6 @@ static void rbd_img_request_complete(struct rbd_img_request *img_request)
rbd_img_request_put(img_request);
}
/* Caller is responsible for rbd_obj_request_destroy(obj_request) */
static int rbd_obj_request_wait(struct rbd_obj_request *obj_request)
{
dout("%s: obj %p\n", __func__, obj_request);
return wait_for_completion_interruptible(&obj_request->completion);
}
/*
* The default/initial value for all image request flags is 0. Each
* is conditionally set to 1 at image request initialization time
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册