summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2013-08-29 17:36:03 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-09 12:24:26 -0800
commitb10f19aaa9a8e818254731a6219754b5015d7588 (patch)
tree9ef785656dabb8c17796cb8df323a17a70ebe9a7 /drivers/block
parent282e0636dcf5ee3329d9266de64386f21dd4d7d6 (diff)
downloadlinux-3.10-b10f19aaa9a8e818254731a6219754b5015d7588.tar.gz
linux-3.10-b10f19aaa9a8e818254731a6219754b5015d7588.tar.bz2
linux-3.10-b10f19aaa9a8e818254731a6219754b5015d7588.zip
rbd: make rbd_obj_notify_ack() synchronous
commit 20e0af67ce88c657d0601977b9941a2256afbdaa upstream. The only user of rbd_obj_notify_ack() is rbd_watch_cb(). It used asynchronously with no tracking of when the notify ack completes, so it may still be in progress when the osd_client is shut down. This results in a BUG() since the osd client assumes no requests are in flight when it stops. Since all notifies are flushed before the osd_client is stopped, waiting for the notify ack to complete before returning from the watch callback ensures there are no notify acks in flight during shutdown. Rename rbd_obj_notify_ack() to rbd_obj_notify_ack_sync() to reflect its new synchronous nature. Signed-off-by: Josh Durgin <josh.durgin@inktank.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index d9c3326c571..a1dff1cf1bc 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2819,7 +2819,7 @@ out_err:
obj_request_done_set(obj_request);
}
-static int rbd_obj_notify_ack(struct rbd_device *rbd_dev, u64 notify_id)
+static int rbd_obj_notify_ack_sync(struct rbd_device *rbd_dev, u64 notify_id)
{
struct rbd_obj_request *obj_request;
struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
@@ -2834,16 +2834,17 @@ static int rbd_obj_notify_ack(struct rbd_device *rbd_dev, u64 notify_id)
obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, obj_request);
if (!obj_request->osd_req)
goto out;
- obj_request->callback = rbd_obj_request_put;
osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_NOTIFY_ACK,
notify_id, 0, 0);
rbd_osd_req_format_read(obj_request);
ret = rbd_obj_request_submit(osdc, obj_request);
-out:
if (ret)
- rbd_obj_request_put(obj_request);
+ goto out;
+ ret = rbd_obj_request_wait(obj_request);
+out:
+ rbd_obj_request_put(obj_request);
return ret;
}
@@ -2863,7 +2864,7 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
if (ret)
rbd_warn(rbd_dev, ": header refresh error (%d)\n", ret);
- rbd_obj_notify_ack(rbd_dev, notify_id);
+ rbd_obj_notify_ack_sync(rbd_dev, notify_id);
}
/*