diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2015-05-19 11:03:33 +0200 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-06-25 10:49:29 +0200 |
commit | 216639dd5091de4f4d7ad19b0b8dde11fad18286 (patch) | |
tree | 1f62dde05052f03bbaf1021cfaaa30e99e2d7087 /net/ceph/ceph_common.c | |
parent | libceph: store timeouts in jiffies, verify user input (diff) | |
download | linux-216639dd5091de4f4d7ad19b0b8dde11fad18286.tar.xz linux-216639dd5091de4f4d7ad19b0b8dde11fad18286.zip |
libceph: a couple tweaks for wait loops
- return -ETIMEDOUT instead of -EIO in case of timeout
- wait_event_interruptible_timeout() returns time left until timeout
and since it can be almost LONG_MAX we had better assign it to long
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'net/ceph/ceph_common.c')
-rw-r--r-- | net/ceph/ceph_common.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index a80e91c2c9a3..925d0c890b80 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c @@ -647,8 +647,8 @@ static int have_mon_and_osd_map(struct ceph_client *client) */ int __ceph_open_session(struct ceph_client *client, unsigned long started) { - int err; unsigned long timeout = client->options->mount_timeout; + long err; /* open session, and wait for mon and osd maps */ err = ceph_monc_open_session(&client->monc); @@ -656,16 +656,15 @@ int __ceph_open_session(struct ceph_client *client, unsigned long started) return err; while (!have_mon_and_osd_map(client)) { - err = -EIO; if (timeout && time_after_eq(jiffies, started + timeout)) - return err; + return -ETIMEDOUT; /* wait */ dout("mount waiting for mon_map\n"); err = wait_event_interruptible_timeout(client->auth_wq, have_mon_and_osd_map(client) || (client->auth_err < 0), ceph_timeout_jiffies(timeout)); - if (err == -EINTR || err == -ERESTARTSYS) + if (err < 0) return err; if (client->auth_err < 0) return client->auth_err; |