block: fix incorrect bio/request flag conversion in md
PATCH 1/1 block: fix incorrect bio/request flag conversion in md
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.
--- drivers/md/raid1.c | 2 +- drivers/md/raid10.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/md/raid1.c +1 -1
@@ -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;
drivers/md/raid10.c +1 -1
@@ -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;
Quoted 10 lines · Tejun Heo
Commit
74450be1(block: unify flags for struct bio and struct request) incorrectly converted @do_sync in md raid1 and raid10make_requst()functions.@do_sync is now supposed to carry the actual flag bit and directly OR'd into
bio->bi_rwbut is still a bool and thus carries either 0 or 1 instead of the actual flag bit. This makesREQ_SYNCignored on writes and flips the direction ofREAD_SYNCsto 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.
Hello,
Quoted 10 lines · Christoph Hellwig
Quoted 9 lines · Tejun Heo
Commit
74450be1(block: unify flags for struct bio and struct request) incorrectly converted @do_sync in md raid1 and raid10make_requst()functions.@do_sync is now supposed to carry the actual flag bit and directly OR'd into
bio->bi_rwbut is still a bool and thus carries either 0 or 1 instead of the actual flag bit. This makesREQ_SYNCignored on writes and flips the direction ofREAD_SYNCsto WRITEs.
Quoted 4 lines
Quoted 1 line
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.
Signature · 1 line
tejun