diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2015-05-19 12:05:38 +0300 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-06-25 11:49:29 +0300 |
commit | 5be73034771c8f18b241f1974803865a4de2cad1 (patch) | |
tree | 01097353601c036d7dfef4ac15bf3d353e185607 /fs/ceph/mds_client.c | |
parent | 216639dd5091de4f4d7ad19b0b8dde11fad18286 (diff) | |
download | linux-5be73034771c8f18b241f1974803865a4de2cad1.tar.gz linux-5be73034771c8f18b241f1974803865a4de2cad1.tar.bz2 linux-5be73034771c8f18b241f1974803865a4de2cad1.zip |
ceph: simplify two mount_timeout sites
No need to bifurcate wait now that we've got ceph_timeout_jiffies().
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Reviewed-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r-- | fs/ceph/mds_client.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 0b0e0a9a81c0..5be2d287a26c 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2266,16 +2266,18 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc, /* wait */ mutex_unlock(&mdsc->mutex); dout("do_request waiting\n"); - if (req->r_timeout) { - err = (long)wait_for_completion_killable_timeout( - &req->r_completion, - ceph_timeout_jiffies(req->r_timeout)); - if (err == 0) - err = -EIO; - } else if (req->r_wait_for_completion) { + if (!req->r_timeout && req->r_wait_for_completion) { err = req->r_wait_for_completion(mdsc, req); } else { - err = wait_for_completion_killable(&req->r_completion); + long timeleft = wait_for_completion_killable_timeout( + &req->r_completion, + ceph_timeout_jiffies(req->r_timeout)); + if (timeleft > 0) + err = 0; + else if (!timeleft) + err = -EIO; /* timed out */ + else + err = timeleft; /* killed */ } dout("do_request waited, got %d\n", err); mutex_lock(&mdsc->mutex); |