Skip to content

Commit 9abc599

Browse files
committed
rbd: complete notifies before cleaning up osd_client and rbd_dev
To ensure rbd_dev is not used after it's released, flush all pending notify callbacks before calling rbd_dev_image_release(). No new notifies can be added to the queue at this point because the watch has already be unregistered with the osd_client. Signed-off-by: Josh Durgin <[email protected]> Reviewed-by: Alex Elder <[email protected]>
1 parent dd935f4 commit 9abc599

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/block/rbd.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5163,6 +5163,13 @@ static ssize_t rbd_remove(struct bus_type *bus,
51635163
ret = rbd_dev_header_watch_sync(rbd_dev, false);
51645164
if (ret)
51655165
rbd_warn(rbd_dev, "failed to cancel watch event (%d)\n", ret);
5166+
5167+
/*
5168+
* flush remaining watch callbacks - these must be complete
5169+
* before the osd_client is shutdown
5170+
*/
5171+
dout("%s: flushing notifies", __func__);
5172+
ceph_osdc_flush_notifies(&rbd_dev->rbd_client->client->osdc);
51665173
rbd_dev_image_release(rbd_dev);
51675174
module_put(THIS_MODULE);
51685175

0 commit comments

Comments
 (0)