public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH block#for-2.6.36-post] block: fix incorrect bio/request flag conversion in md
@ 2010-08-16 14:21 Tejun Heo
  2010-08-17 13:56 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2010-08-16 14:21 UTC (permalink / raw)
  To: Jens Axboe, lkml; +Cc: Christoph Hellwig, Neil Brown

Commit 74450be1 (block: unify flags for struct bio and struct request)
incorrectly converted @do_sync in md raid1 and raid10 make_requst()
functions.

@do_sync is now supposed to carry the actual flag bit and directly
OR'd into bio->bi_rw but is still a bool and thus carries either 0 or
1 instead of the actual flag bit.  This makes REQ_SYNC ignored on
writes and flips the direction of READ_SYNCs to WRITEs.

Fix it by making @do_sync unsigned integers.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Neil Brown <neilb@suse.de>
---
 drivers/md/raid1.c  |    2 +-
 drivers/md/raid10.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: block/drivers/md/raid1.c
===================================================================
--- block.orig/drivers/md/raid1.c
+++ block/drivers/md/raid1.c
@@ -787,7 +787,7 @@ static int make_request(mddev_t *mddev,
 	struct bio_list bl;
 	struct page **behind_pages = NULL;
 	const int rw = bio_data_dir(bio);
-	const bool do_sync = (bio->bi_rw & REQ_SYNC);
+	const unsigned int do_sync = (bio->bi_rw & REQ_SYNC);
 	bool do_barriers;
 	mdk_rdev_t *blocked_rdev;

Index: block/drivers/md/raid10.c
===================================================================
--- block.orig/drivers/md/raid10.c
+++ block/drivers/md/raid10.c
@@ -799,7 +799,7 @@ static int make_request(mddev_t *mddev,
 	int i;
 	int chunk_sects = conf->chunk_mask + 1;
 	const int rw = bio_data_dir(bio);
-	const bool do_sync = (bio->bi_rw & REQ_SYNC);
+	const unsigned int do_sync = (bio->bi_rw & REQ_SYNC);
 	struct bio_list bl;
 	unsigned long flags;
 	mdk_rdev_t *blocked_rdev;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH block#for-2.6.36-post] block: fix incorrect bio/request flag conversion in md
  2010-08-17 13:56 ` Christoph Hellwig
@ 2010-08-17 13:56   ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2010-08-17 13:56 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jens Axboe, lkml, Neil Brown

Hello,

On 08/17/2010 03:56 PM, Christoph Hellwig wrote:
> On Mon, Aug 16, 2010 at 04:21:25PM +0200, Tejun Heo wrote:
>> Commit 74450be1 (block: unify flags for struct bio and struct request)
>> incorrectly converted @do_sync in md raid1 and raid10 make_requst()
>> functions.
>>
>> @do_sync is now supposed to carry the actual flag bit and directly
>> OR'd into bio->bi_rw but is still a bool and thus carries either 0 or
>> 1 instead of the actual flag bit.  This makes REQ_SYNC ignored on
>> writes and flips the direction of READ_SYNCs to WRITEs.
>>
>> Fix it by making @do_sync unsigned integers.
> 
> Yeah, you're the fourth person coming up with this independently.  Now
> all we need is to get one of the patches actually into Linus tree.

Ah, that's good to know.  It's not in mainline yet, so I guess we
should just wait for Jens to come back.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH block#for-2.6.36-post] block: fix incorrect bio/request flag conversion in md
  2010-08-16 14:21 [PATCH block#for-2.6.36-post] block: fix incorrect bio/request flag conversion in md Tejun Heo
@ 2010-08-17 13:56 ` Christoph Hellwig
  2010-08-17 13:56   ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2010-08-17 13:56 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Jens Axboe, lkml, Christoph Hellwig, Neil Brown

On Mon, Aug 16, 2010 at 04:21:25PM +0200, Tejun Heo wrote:
> Commit 74450be1 (block: unify flags for struct bio and struct request)
> incorrectly converted @do_sync in md raid1 and raid10 make_requst()
> functions.
> 
> @do_sync is now supposed to carry the actual flag bit and directly
> OR'd into bio->bi_rw but is still a bool and thus carries either 0 or
> 1 instead of the actual flag bit.  This makes REQ_SYNC ignored on
> writes and flips the direction of READ_SYNCs to WRITEs.
> 
> Fix it by making @do_sync unsigned integers.

Yeah, you're the fourth person coming up with this independently.  Now
all we need is to get one of the patches actually into Linus tree.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-17 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-16 14:21 [PATCH block#for-2.6.36-post] block: fix incorrect bio/request flag conversion in md Tejun Heo
2010-08-17 13:56 ` Christoph Hellwig
2010-08-17 13:56   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox