Commit 5be73034 authored by Ilya Dryomov's avatar Ilya Dryomov

ceph: simplify two mount_timeout sites

No need to bifurcate wait now that we've got ceph_timeout_jiffies().
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Reviewed-by: default avatarYan, Zheng <zyan@redhat.com>
parent 216639dd
...@@ -1257,17 +1257,11 @@ static int ceph_dir_fsync(struct file *file, loff_t start, loff_t end, ...@@ -1257,17 +1257,11 @@ static int ceph_dir_fsync(struct file *file, loff_t start, loff_t end,
dout("dir_fsync %p wait on tid %llu (until %llu)\n", dout("dir_fsync %p wait on tid %llu (until %llu)\n",
inode, req->r_tid, last_tid); inode, req->r_tid, last_tid);
if (req->r_timeout) { ret = !wait_for_completion_timeout(&req->r_safe_completion,
unsigned long time_left = wait_for_completion_timeout(
&req->r_safe_completion,
ceph_timeout_jiffies(req->r_timeout)); ceph_timeout_jiffies(req->r_timeout));
if (time_left > 0) if (ret)
ret = 0;
else
ret = -EIO; /* timed out */ ret = -EIO; /* timed out */
} else {
wait_for_completion(&req->r_safe_completion);
}
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
spin_lock(&ci->i_unsafe_lock); spin_lock(&ci->i_unsafe_lock);
......
...@@ -2266,16 +2266,18 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc, ...@@ -2266,16 +2266,18 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
/* wait */ /* wait */
mutex_unlock(&mdsc->mutex); mutex_unlock(&mdsc->mutex);
dout("do_request waiting\n"); dout("do_request waiting\n");
if (req->r_timeout) { if (!req->r_timeout && req->r_wait_for_completion) {
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) {
err = req->r_wait_for_completion(mdsc, req); err = req->r_wait_for_completion(mdsc, req);
} else { } 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); dout("do_request waited, got %d\n", err);
mutex_lock(&mdsc->mutex); mutex_lock(&mdsc->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment