All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@ieee.org>
To: Ilya Dryomov <idryomov@gmail.com>, ceph-devel@vger.kernel.org
Cc: Zheng Yan <zyan@redhat.com>
Subject: Re: [PATCH 4/5] ceph: simplify two mount_timeout sites
Date: Thu, 21 May 2015 08:39:30 -0500	[thread overview]
Message-ID: <555DE012.4090601@ieee.org> (raw)
In-Reply-To: <1432211706-10473-5-git-send-email-idryomov@gmail.com>

On 05/21/2015 07:35 AM, Ilya Dryomov wrote:
> No need to bifurcate wait now that we've got ceph_timeout_jiffies().

Looks good.

Reviewed-by: Alex Elder <elder@linaro.org>

> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> ---
>  fs/ceph/dir.c        | 14 ++++----------
>  fs/ceph/mds_client.c | 18 ++++++++++--------
>  2 files changed, 14 insertions(+), 18 deletions(-)
> 
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index 173dd4b58c71..3dec27e36417 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -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",
>  		     inode, req->r_tid, last_tid);
> -		if (req->r_timeout) {
> -			unsigned long time_left = wait_for_completion_timeout(
> -					&req->r_safe_completion,
> +		ret = !wait_for_completion_timeout(&req->r_safe_completion,
>  					ceph_timeout_jiffies(req->r_timeout));
> -			if (time_left > 0)
> -				ret = 0;
> -			else
> -				ret = -EIO;  /* timed out */
> -		} else {
> -			wait_for_completion(&req->r_safe_completion);
> -		}
> +		if (ret)
> +			ret = -EIO;  /* timed out */
> +
>  		ceph_mdsc_put_request(req);
>  
>  		spin_lock(&ci->i_unsafe_lock);
> 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);
> 


  reply	other threads:[~2015-05-21 13:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 12:35 [PATCH 0/5] libceph: timeout handling fixes Ilya Dryomov
2015-05-21 12:35 ` [PATCH 1/5] libceph: nuke time_sub() Ilya Dryomov
2015-05-21 12:40   ` Alex Elder
2015-05-21 12:35 ` [PATCH 2/5] libceph: store timeouts in jiffies, verify user input Ilya Dryomov
2015-05-21 12:58   ` Alex Elder
2015-05-21 12:35 ` [PATCH 3/5] libceph: a couple tweaks for wait loops Ilya Dryomov
2015-05-21 13:29   ` Alex Elder
2015-05-25 10:38     ` Ilya Dryomov
2015-05-25 15:40       ` Alex Elder
2015-05-21 12:35 ` [PATCH 4/5] ceph: simplify two mount_timeout sites Ilya Dryomov
2015-05-21 13:39   ` Alex Elder [this message]
2015-05-21 13:45   ` Yan, Zheng
2015-05-21 12:35 ` [PATCH v2 5/5] rbd: timeout watch teardown on unmap with mount_timeout Ilya Dryomov
2015-05-21 13:55   ` Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=555DE012.4090601@ieee.org \
    --to=elder@ieee.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=zyan@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.