public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Chen Gang <gang.chen.5i5j@gmail.com>,
	konrad.wilk@oracle.com, David Vrabel <david.vrabel@citrix.com>,
	stefano.stabellini@eu.citrix.com, mukesh.rathor@oracle.com
Cc: xen-devel@lists.xenproject.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] drivers/xen/xenbus/xenbus_client.c: Improve the failure processing for __xenbus_switch_state()
Date: Mon, 15 Sep 2014 21:07:58 -0400	[thread overview]
Message-ID: <54178D6E.9090705@oracle.com> (raw)
In-Reply-To: <5415737D.2030209@gmail.com>


On 09/14/2014 06:52 AM, Chen Gang wrote:
> When failure occurs, need return failure code instead of 0, or the upper
> caller will misunderstand.
>
> Also when retry for EAGAIN reason, better to schedule out for a while,
> so can let others have chance to continue their tasks (especially,
> their tasks are related EAGAIN under UP kernel).
>
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
>   drivers/xen/xenbus/xenbus_client.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
> index 620ffd2..fc8699b 100644
> --- a/drivers/xen/xenbus/xenbus_client.c
> +++ b/drivers/xen/xenbus/xenbus_client.c
> @@ -36,6 +36,7 @@
>   #include <linux/spinlock.h>
>   #include <linux/vmalloc.h>
>   #include <linux/export.h>
> +#include <linux/delay.h>
>   #include <asm/xen/hypervisor.h>
>   #include <asm/xen/page.h>
>   #include <xen/interface/xen.h>
> @@ -196,7 +197,7 @@ again:
>   	err = xenbus_transaction_start(&xbt);
>   	if (err) {
>   		xenbus_switch_fatal(dev, depth, err, "starting transaction");
> -		return 0;
> +		return err;
>   	}
>   
>   	err = xenbus_scanf(xbt, dev->nodename, "state", "%d", &current_state);
> @@ -213,13 +214,15 @@ again:
>   abort:
>   	err = xenbus_transaction_end(xbt, abort);
>   	if (err) {
> -		if (err == -EAGAIN && !abort)
> +		if (err == -EAGAIN && !abort) {
> +			msleep(20);

I'd suggest you use schedule() here.

-boris

>   			goto again;
> +		}
>   		xenbus_switch_fatal(dev, depth, err, "ending transaction");
>   	} else
>   		dev->state = state;
>   
> -	return 0;
> +	return err;
>   }
>   
>   /**


  parent reply	other threads:[~2014-09-16  1:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-14 10:48 [PATCH 0/4] drivers/xen/xenbus/xenbus_client.c: Several improvements for it Chen Gang
2014-09-14 10:49 ` [PATCH 1/4] drivers/xen/xenbus/xenbus_client.c: Remove redundancy asignment to 'addr' Chen Gang
2014-09-14 10:54   ` Chen Gang
2014-09-15 15:41   ` [Xen-devel] " David Vrabel
2014-09-15 22:49     ` Chen Gang
2014-09-14 10:50 ` [PATCH 2/4] drivers/xen/xenbus/xenbus_client.c: Correct the comments for xenbus_grant_ring() Chen Gang
2014-09-15 15:27   ` [Xen-devel] " David Vrabel
2014-09-15 22:53     ` Chen Gang
2014-09-14 10:51 ` [PATCH 3/4] drivers/xen/xenbus/xenbus_client.c: Remove BUG_ON() when error string truncated Chen Gang
2014-09-14 10:52 ` [PATCH 4/4] drivers/xen/xenbus/xenbus_client.c: Improve the failure processing for __xenbus_switch_state() Chen Gang
2014-09-15 14:39   ` David Vrabel
2014-09-15 22:57     ` Chen Gang
2014-09-16  1:07   ` Boris Ostrovsky [this message]
2014-09-16  1:39     ` Chen Gang
2014-09-15 15:31 ` [Xen-devel] [PATCH 0/4] drivers/xen/xenbus/xenbus_client.c: Several improvements for it David Vrabel
2014-09-15 22:50   ` Chen Gang

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=54178D6E.9090705@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=gang.chen.5i5j@gmail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mukesh.rathor@oracle.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox