All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	roger.pau@citrix.com
Cc: Paul.Durrant@citrix.com, david.vrabel@citrix.com,
	justing@spectralogic.com, julien.grall@citrix.com,
	marcus.granado@citrix.com, Rafal.Mielniczuk@citrix.com,
	Bob Liu <bob.liu@oracle.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH] drivers: xen-blkfront: only talk_to_blkback() when in XenbusStateInitialising
Date: Mon, 22 Jun 2015 09:56:00 -0400	[thread overview]
Message-ID: <1434981360-29794-1-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <558762C4.2000002@oracle.com>

From: Bob Liu <bob.liu@oracle.com>

Patch 69b91ede5cab843dcf345c28bd1f4b5a99dacd9b
"drivers: xen-blkback: delay pending_req allocation to connect_ring"
exposed an problem that Xen blkfront has. There is a race
with XenStored and the drivers such that we can see two:

vbd vbd-268440320: blkfront:blkback_changed to state 2.
vbd vbd-268440320: blkfront:blkback_changed to state 2.
vbd vbd-268440320: blkfront:blkback_changed to state 4.

state changes to XenbusStateInitWait ('2'). The end result is that
blkback_changed() receives two notify and calls twice setup_blkring().

While the backend driver may only get the first setup_blkring() which is
wrong and reads out-dated (or reads them as they are being updated
with new ring-ref values).

The end result is that the ring ends up being incorrectly set.

Reported-and-Tested-by: Robert Butera <robert.butera@oracle.com>
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/block/xen-blkfront.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index d3c1a95..fc770b7 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1951,6 +1951,8 @@ static void blkback_changed(struct xenbus_device *dev,
 
 	switch (backend_state) {
 	case XenbusStateInitWait:
+		if (dev->state != XenbusStateInitialising)
+			break;
 		if (talk_to_blkback(dev, info)) {
 			kfree(info);
 			dev_set_drvdata(&dev->dev, NULL);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

  parent reply	other threads:[~2015-06-22 13:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03  5:40 [PATCH 1/3] drivers: xen-blkback: delay pending_req allocation to connect_ring Bob Liu
2015-06-03  5:40 ` [PATCH 2/3] driver: xen-blkfront: move talk_to_blkback to a more suitable place Bob Liu
2015-06-03  5:40 ` Bob Liu
2015-06-03  5:40 ` [PATCH 3/3] xen/block: add multi-page ring support Bob Liu
2015-06-09  8:50   ` Bob Liu
2015-06-09  8:50   ` Bob Liu
2015-06-09  8:52     ` Paul Durrant
2015-06-09  8:52     ` Paul Durrant
2015-06-09 13:39       ` Konrad Rzeszutek Wilk
2015-06-09 13:39       ` Konrad Rzeszutek Wilk
2015-06-09 13:48         ` Bob Liu
2015-06-09 13:48         ` Bob Liu
2015-06-09 14:07         ` Roger Pau Monné
2015-06-09 14:21           ` Konrad Rzeszutek Wilk
2015-06-19 20:12             ` [Xen-devel] " Konrad Rzeszutek Wilk
2015-06-19 20:12               ` Konrad Rzeszutek Wilk
2015-06-09 14:21           ` Konrad Rzeszutek Wilk
2015-06-22  1:20           ` Bob Liu
2015-06-22  1:20           ` Bob Liu
2015-06-22 13:47             ` Konrad Rzeszutek Wilk
2015-06-22 13:47             ` Konrad Rzeszutek Wilk
2015-06-22 13:56             ` Konrad Rzeszutek Wilk [this message]
2015-06-22 14:06               ` [PATCH] drivers: xen-blkfront: only talk_to_blkback() when in XenbusStateInitialising Konrad Rzeszutek Wilk
2015-06-22 14:06               ` Konrad Rzeszutek Wilk
2015-06-23  6:23               ` [Xen-devel] " Jan Beulich
2015-06-23 11:57                 ` Konrad Rzeszutek Wilk
2015-06-23 11:57                 ` Konrad Rzeszutek Wilk
2015-06-23  6:23               ` Jan Beulich
2015-06-22 13:56             ` Konrad Rzeszutek Wilk
2015-06-23 12:51             ` [PATCH 3/3] xen/block: add multi-page ring support Marcus Granado
2015-06-23 12:51             ` Marcus Granado
2015-06-09 14:07         ` Roger Pau Monné
2015-06-03  5:40 ` Bob Liu

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=1434981360-29794-1-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=Rafal.Mielniczuk@citrix.com \
    --cc=bob.liu@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=justing@spectralogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcus.granado@citrix.com \
    --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 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.