mon_client.c (85a3685852d9ac7d92be9d824533c915a4597fa4) mon_client.c (a319bf56a617354e62cf5f774d2ca4e1a8a3bff3)
1#include <linux/ceph/ceph_debug.h>
2
3#include <linux/module.h>
4#include <linux/types.h>
5#include <linux/slab.h>
6#include <linux/random.h>
7#include <linux/sched.h>
8

--- 284 unchanged lines hidden (view full) ---

293 if (!monc->want_next_osdmap)
294 monc->want_next_osdmap = 1;
295 if (monc->want_next_osdmap < 2)
296 __send_subscribe(monc);
297 mutex_unlock(&monc->mutex);
298}
299EXPORT_SYMBOL(ceph_monc_request_next_osdmap);
300
1#include <linux/ceph/ceph_debug.h>
2
3#include <linux/module.h>
4#include <linux/types.h>
5#include <linux/slab.h>
6#include <linux/random.h>
7#include <linux/sched.h>
8

--- 284 unchanged lines hidden (view full) ---

293 if (!monc->want_next_osdmap)
294 monc->want_next_osdmap = 1;
295 if (monc->want_next_osdmap < 2)
296 __send_subscribe(monc);
297 mutex_unlock(&monc->mutex);
298}
299EXPORT_SYMBOL(ceph_monc_request_next_osdmap);
300
301/*
302 * Wait for an osdmap with a given epoch.
303 *
304 * @epoch: epoch to wait for
305 * @timeout: in jiffies, 0 means "wait forever"
306 */
301int 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
307int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch,
308 unsigned long timeout)
309{
310 unsigned long started = jiffies;
311 int ret;
312
313 mutex_lock(&monc->mutex);
314 while (monc->have_osdmap < epoch) {
315 mutex_unlock(&monc->mutex);
316
311 if (timeout != 0 && time_after_eq(jiffies, started + timeout))
317 if (timeout && time_after_eq(jiffies, started + timeout))
312 return -ETIMEDOUT;
313
314 ret = wait_event_interruptible_timeout(monc->client->auth_wq,
318 return -ETIMEDOUT;
319
320 ret = wait_event_interruptible_timeout(monc->client->auth_wq,
315 monc->have_osdmap >= epoch, timeout);
321 monc->have_osdmap >= epoch,
322 ceph_timeout_jiffies(timeout));
316 if (ret < 0)
317 return ret;
318
319 mutex_lock(&monc->mutex);
320 }
321
322 mutex_unlock(&monc->mutex);
323 return 0;

--- 798 unchanged lines hidden ---
323 if (ret < 0)
324 return ret;
325
326 mutex_lock(&monc->mutex);
327 }
328
329 mutex_unlock(&monc->mutex);
330 return 0;

--- 798 unchanged lines hidden ---