From a2e5951b11b406a83f84c1eb3b5d722491f4d883 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Wed, 28 Aug 2013 21:43:09 -0700 Subject: libceph: add function to ensure notifies are complete commit dd935f44a40f8fb02aff2cc0df2269c92422df1c upstream. Without a way to flush the osd client's notify workqueue, a watch event that is unregistered could continue receiving callbacks indefinitely. Unregistering the event simply means no new notifies are added to the queue, but there may still be events in the queue that will call the watch callback for the event. If the queue is flushed after the event is unregistered, the caller can be sure no more watch callbacks will occur for the canceled watch. Signed-off-by: Josh Durgin Reviewed-by: Sage Weil Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- net/ceph/osd_client.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'net/ceph/osd_client.c') diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index ac34cb5120ed..bc0016e3e5ac 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -2208,6 +2208,17 @@ void ceph_osdc_sync(struct ceph_osd_client *osdc) } EXPORT_SYMBOL(ceph_osdc_sync); +/* + * Call all pending notify callbacks - for use after a watch is + * unregistered, to make sure no more callbacks for it will be invoked + */ +extern void ceph_osdc_flush_notifies(struct ceph_osd_client *osdc) +{ + flush_workqueue(osdc->notify_wq); +} +EXPORT_SYMBOL(ceph_osdc_flush_notifies); + + /* * init, shutdown */ -- cgit v1.2.3