[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54178D6E.9090705@oracle.com>
Date: Mon, 15 Sep 2014 21:07:58 -0400
From: Boris Ostrovsky <boris.ostrovsky@...cle.com>
To: Chen Gang <gang.chen.5i5j@...il.com>, konrad.wilk@...cle.com,
David Vrabel <david.vrabel@...rix.com>,
stefano.stabellini@...citrix.com, mukesh.rathor@...cle.com
CC: xen-devel@...ts.xenproject.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/4] drivers/xen/xenbus/xenbus_client.c: Improve the failure
processing for __xenbus_switch_state()
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@...il.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", ¤t_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;
> }
>
> /**
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists