linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Bob Liu <bob.liu@oracle.com>
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	roger.pau@citrix.com
Subject: Re: [PATCH 1/2] xen-blkfront: don't call talk_to_blkback when already connected to blkback
Date: Tue, 31 May 2016 16:33:07 -0400	[thread overview]
Message-ID: <20160531203307.GC23808@char.us.oracle.com> (raw)
In-Reply-To: <1464685157-30738-1-git-send-email-bob.liu@oracle.com>

On Tue, May 31, 2016 at 04:59:16PM +0800, Bob Liu wrote:
> Sometimes blkfont may receive twice blkback_changed() notification after
> migration, then talk_to_blkback() will be called twice too and confused
> xen-blkback.

Could you enlighten the patch description by having some form of
state transition here? I am curious how you got the frontend
to get in XenbusStateConnected (via blkif_recover right) and then
the backend triggering the update once more?

Or is just a simple race - the backend moves from XenbusStateConnected->
XenbusStateConnected - which retriggers the frontend to hit in
blkback_changed the XenbusStateConnected state and go in there?
(That would be in conenct_ring changing the state). But I don't
see how the frontend_changed code get there as we have:

 770                 /*
 771                  * Ensure we connect even when two watches fire in
 772                  * close succession and we miss the intermediate value
 773                  * of frontend_state.
 774                  */
 775                 if (dev->state == XenbusStateConnected)
 776                         break;
 777 

?

Now what about 'blkfront_connect' being called on the second time?

Ah, info->connected is probably by then in BLKIF_STATE_CONNECTED
(as blkif_recover changed) and we just reread the size of the disk.

Is that how about the flow goes?
> 
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
> ---
>  drivers/block/xen-blkfront.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index ca13df8..01aa460 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -2485,7 +2485,8 @@ static void blkback_changed(struct xenbus_device *dev,
>  		break;
>  
>  	case XenbusStateConnected:
> -		if (dev->state != XenbusStateInitialised) {
> +		if ((dev->state != XenbusStateInitialised) &&
> +			(dev->state != XenbusStateConnected)) {
>  			if (talk_to_blkback(dev, info))
>  				break;
>  		}
> -- 
> 2.7.4
> 

  parent reply	other threads:[~2016-05-31 20:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31  8:59 [PATCH 1/2] xen-blkfront: don't call talk_to_blkback when already connected to blkback Bob Liu
2016-05-31  8:59 ` [PATCH 2/2] xen-blkfront: fix resume issues Bob Liu
2016-05-31 20:33 ` Konrad Rzeszutek Wilk [this message]
2016-06-01  5:49   ` [PATCH 1/2] xen-blkfront: don't call talk_to_blkback when already connected to blkback Bob Liu
2016-06-02 14:30     ` Konrad Rzeszutek Wilk
2016-06-07 15:25     ` Konrad Rzeszutek Wilk
2016-06-08  6:46       ` Bob Liu
2016-06-08 14:47         ` Konrad Rzeszutek Wilk
2016-06-15  8:39           ` [Xen-devel] " Ross Lagerwall
2016-06-15 14:08             ` Konrad Rzeszutek Wilk

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=20160531203307.GC23808@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=bob.liu@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roger.pau@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;
as well as URLs for NNTP newsgroup(s).