xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: xen-devel@lists.xensource.com, JBeulich@novell.com,
	jeremy.fitzhardinge@citrix.com, axboe@kernel.dk,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	stable@kernel.org
Subject: [PATCH 3/3] xen-blkfront: If no barrier or flush is supported, use invalid operation.
Date: Fri,  9 Sep 2011 14:31:00 -0400	[thread overview]
Message-ID: <1315593060-20031-3-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1315593060-20031-1-git-send-email-konrad.wilk@oracle.com>

By default we would set the info->flush_op=0, and zero maps
to BLKIF_OP_READ request code. So if the backend did not support
either barrier ('feature-barrier') or flush ('feature-flush-cache')
we would end up using that opcode for the flush/barrier request, meaning
we actually do a READ request. Fortunatly for us, __generic_make_request
checks q->flush_flags and realizes that we don't do FLUSH and removes
the REQ_FLUSH | REQ_FUA so we never end up issuing a READ request
for a flush request. However, other third party implementations of
__make_request might not be so smart, so lets fix this up.

CC: stable@kernel.org
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/block/xen-blkfront.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index e205d91..c4aa9da 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -97,7 +97,7 @@ struct blkfront_info
 	struct blk_shadow shadow[BLK_RING_SIZE];
 	unsigned long shadow_free;
 	unsigned int feature_flush;
-	unsigned int flush_op;
+	int flush_op;
 	unsigned int feature_discard;
 	unsigned int discard_granularity;
 	unsigned int discard_alignment;
@@ -774,7 +774,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
 				if (error == -EOPNOTSUPP)
 					error = 0;
 				info->feature_flush = 0;
-				info->flush_op = 0;
+				info->flush_op = -1; /* 0 is BLKIF_OP_READ */
 				xlvbd_flush(info);
 			}
 			/* fall through */
@@ -1207,7 +1207,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	}
 
 	info->feature_flush = 0;
-	info->flush_op = 0;
+	info->flush_op = -1; /* 0 is BLKIF_OP_READ */
 
 	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
 			    "feature-barrier", "%d", &barrier,
@@ -1234,7 +1234,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	if (!err && flush)
 		info->flush_op = BLKIF_OP_FLUSH_DISKCACHE;
 
-	if (info->flush_op)
+	if (info->flush_op > 0)
 		info->feature_flush = REQ_FLUSH | REQ_FUA;
 
 	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-- 
1.7.4.1

  parent reply	other threads:[~2011-09-09 18:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-09 18:30 [PATCH] xen-blk[front|back] FUA additions Konrad Rzeszutek Wilk
2011-09-09 18:30 ` [PATCH 1/3] xen/blk[front|back]: Use the full FLUSH | FUA instead of just FLUSH Konrad Rzeszutek Wilk
2011-09-10 18:08   ` Christoph Hellwig
2011-09-11  0:33     ` Konrad Rzeszutek Wilk
2011-09-09 18:31 ` Konrad Rzeszutek Wilk [this message]
2011-09-12  8:01   ` [PATCH 3/3] xen-blkfront: If no barrier or flush is supported, use invalid operation Jan Beulich
2011-09-16 19:15     ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-09-19  9:35       ` Jan Beulich

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=1315593060-20031-3-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@novell.com \
    --cc=axboe@kernel.dk \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=xen-devel@lists.xensource.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 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).