aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2013-08-29 00:43:09 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-09 15:24:26 -0500
commita2e5951b11b406a83f84c1eb3b5d722491f4d883 (patch)
treedf9395701dfa87884117589db8162a06d01d8653
parentdd932ee7a2453d86c920d3bbd2938602c5c9aaca (diff)
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 <josh.durgin@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--include/linux/ceph/osd_client.h2
-rw-r--r--net/ceph/osd_client.c11
2 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index ce6df39f60ff..8f47625a0661 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -335,6 +335,8 @@ extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
335 struct ceph_osd_request *req); 335 struct ceph_osd_request *req);
336extern void ceph_osdc_sync(struct ceph_osd_client *osdc); 336extern void ceph_osdc_sync(struct ceph_osd_client *osdc);
337 337
338extern void ceph_osdc_flush_notifies(struct ceph_osd_client *osdc);
339
338extern int ceph_osdc_readpages(struct ceph_osd_client *osdc, 340extern int ceph_osdc_readpages(struct ceph_osd_client *osdc,
339 struct ceph_vino vino, 341 struct ceph_vino vino,
340 struct ceph_file_layout *layout, 342 struct ceph_file_layout *layout,
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
@@ -2209,6 +2209,17 @@ void ceph_osdc_sync(struct ceph_osd_client *osdc)
2209EXPORT_SYMBOL(ceph_osdc_sync); 2209EXPORT_SYMBOL(ceph_osdc_sync);
2210 2210
2211/* 2211/*
2212 * Call all pending notify callbacks - for use after a watch is
2213 * unregistered, to make sure no more callbacks for it will be invoked
2214 */
2215extern void ceph_osdc_flush_notifies(struct ceph_osd_client *osdc)
2216{
2217 flush_workqueue(osdc->notify_wq);
2218}
2219EXPORT_SYMBOL(ceph_osdc_flush_notifies);
2220
2221
2222/*
2212 * init, shutdown 2223 * init, shutdown
2213 */ 2224 */
2214int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client) 2225int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client)