]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
libceph: a couple tweaks for wait loops
authorIlya Dryomov <idryomov@gmail.com>
Tue, 19 May 2015 09:03:33 +0000 (12:03 +0300)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 25 Jun 2015 08:49:29 +0000 (11:49 +0300)
- 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>
net/ceph/ceph_common.c
net/ceph/mon_client.c

index a80e91c2c9a30bc9003df17d141e43d106095c60..925d0c890b80cf5b2c9d6cb1e9d4160bf8eee716 100644 (file)
@@ -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;
index 0da3bdc116f7b36d1ff9ae06a86d54d561249435..9d6ff1215928cb69787a85421fdbab9e2a1c8bf5 100644 (file)
@@ -308,7 +308,7 @@ int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch,
                          unsigned long timeout)
 {
        unsigned long started = jiffies;
-       int ret;
+       long ret;
 
        mutex_lock(&monc->mutex);
        while (monc->have_osdmap < epoch) {