diff options
-rw-r--r-- | include/linux/ceph/mon_client.h | 2 | ||||
-rw-r--r-- | net/ceph/mon_client.c | 27 |
2 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h index 585ef9450e9d..deb47e45ac7c 100644 --- a/include/linux/ceph/mon_client.h +++ b/include/linux/ceph/mon_client.h | |||
@@ -104,6 +104,8 @@ extern int ceph_monc_got_mdsmap(struct ceph_mon_client *monc, u32 have); | |||
104 | extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, u32 have); | 104 | extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, u32 have); |
105 | 105 | ||
106 | extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc); | 106 | extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc); |
107 | extern int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch, | ||
108 | unsigned long timeout); | ||
107 | 109 | ||
108 | extern int ceph_monc_do_statfs(struct ceph_mon_client *monc, | 110 | extern int ceph_monc_do_statfs(struct ceph_mon_client *monc, |
109 | struct ceph_statfs *buf); | 111 | struct ceph_statfs *buf); |
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 11d8d2f2708a..067d3af2eaf6 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
@@ -296,6 +296,33 @@ void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc) | |||
296 | __send_subscribe(monc); | 296 | __send_subscribe(monc); |
297 | mutex_unlock(&monc->mutex); | 297 | mutex_unlock(&monc->mutex); |
298 | } | 298 | } |
299 | EXPORT_SYMBOL(ceph_monc_request_next_osdmap); | ||
300 | |||
301 | int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch, | ||
302 | unsigned long timeout) | ||
303 | { | ||
304 | unsigned long started = jiffies; | ||
305 | int ret; | ||
306 | |||
307 | mutex_lock(&monc->mutex); | ||
308 | while (monc->have_osdmap < epoch) { | ||
309 | mutex_unlock(&monc->mutex); | ||
310 | |||
311 | if (timeout != 0 && time_after_eq(jiffies, started + timeout)) | ||
312 | return -ETIMEDOUT; | ||
313 | |||
314 | ret = wait_event_interruptible_timeout(monc->client->auth_wq, | ||
315 | monc->have_osdmap >= epoch, timeout); | ||
316 | if (ret < 0) | ||
317 | return ret; | ||
318 | |||
319 | mutex_lock(&monc->mutex); | ||
320 | } | ||
321 | |||
322 | mutex_unlock(&monc->mutex); | ||
323 | return 0; | ||
324 | } | ||
325 | EXPORT_SYMBOL(ceph_monc_wait_osdmap); | ||
299 | 326 | ||
300 | /* | 327 | /* |
301 | * | 328 | * |