All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] md/raid5: fix miscalculation of 'end_sector' in raid5_read_one_chunk()
@ 2023-05-24  1:41 Yu Kuai
  2023-05-24  6:04 ` Christoph Hellwig
  2023-05-24 15:03 ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Yu Kuai @ 2023-05-24  1:41 UTC (permalink / raw)
  To: hch, song, axboe, chaitanya.kulkarni, johannes.thumshirn, damien.lemoal
  Cc: linux-raid, linux-kernel, yukuai3, yukuai1, yi.zhang, yangerkun

From: Yu Kuai <yukuai3@huawei.com>

'end_sector' is compared to 'rdev->recovery_offset', which is offset to
rdev, however, commit e82ed3a4fbb5 ("md/raid6: refactor
raid5_read_one_chunk") changes the calculation of 'end_sector' to offset
to the array. Fix this miscalculation.

Fixes: e82ed3a4fbb5 ("md/raid6: refactor raid5_read_one_chunk")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 drivers/md/raid5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 7e2bbcfef325..8686d629e3f2 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5516,7 +5516,7 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio)
 
 	sector = raid5_compute_sector(conf, raid_bio->bi_iter.bi_sector, 0,
 				      &dd_idx, NULL);
-	end_sector = bio_end_sector(raid_bio);
+	end_sector = sector + bio_sectors(raid_bio);
 
 	rcu_read_lock();
 	if (r5c_big_stripe_cached(conf, sector))
-- 
2.39.2


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

* Re: [PATCH] md/raid5: fix miscalculation of 'end_sector' in raid5_read_one_chunk()
  2023-05-24  1:41 [PATCH] md/raid5: fix miscalculation of 'end_sector' in raid5_read_one_chunk() Yu Kuai
@ 2023-05-24  6:04 ` Christoph Hellwig
  2023-05-24 15:03 ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-05-24  6:04 UTC (permalink / raw)
  To: Yu Kuai
  Cc: hch, song, axboe, chaitanya.kulkarni, johannes.thumshirn,
	damien.lemoal, linux-raid, linux-kernel, yukuai3, yi.zhang,
	yangerkun

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH] md/raid5: fix miscalculation of 'end_sector' in raid5_read_one_chunk()
  2023-05-24  1:41 [PATCH] md/raid5: fix miscalculation of 'end_sector' in raid5_read_one_chunk() Yu Kuai
  2023-05-24  6:04 ` Christoph Hellwig
@ 2023-05-24 15:03 ` Jens Axboe
  2023-05-24 17:21   ` Song Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2023-05-24 15:03 UTC (permalink / raw)
  To: Yu Kuai, hch, song, chaitanya.kulkarni, johannes.thumshirn,
	damien.lemoal
  Cc: linux-raid, linux-kernel, yukuai3, yi.zhang, yangerkun

On 5/23/23 7:41 PM, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> 'end_sector' is compared to 'rdev->recovery_offset', which is offset to
> rdev, however, commit e82ed3a4fbb5 ("md/raid6: refactor
> raid5_read_one_chunk") changes the calculation of 'end_sector' to offset
> to the array. Fix this miscalculation.
> 
> Fixes: e82ed3a4fbb5 ("md/raid6: refactor raid5_read_one_chunk")

This needs a stable tag as well, Fixes alone is not enough to guarantee
it ends up in stable.

Song, are you picking this up?

-- 
Jens Axboe



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

* Re: [PATCH] md/raid5: fix miscalculation of 'end_sector' in raid5_read_one_chunk()
  2023-05-24 15:03 ` Jens Axboe
@ 2023-05-24 17:21   ` Song Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Song Liu @ 2023-05-24 17:21 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Yu Kuai, hch, chaitanya.kulkarni, johannes.thumshirn,
	damien.lemoal, linux-raid, linux-kernel, yukuai3, yi.zhang,
	yangerkun

On Wed, May 24, 2023 at 8:03 AM Jens Axboe <axboe@kernel.dk> wrote:
>
> On 5/23/23 7:41 PM, Yu Kuai wrote:
> > From: Yu Kuai <yukuai3@huawei.com>
> >
> > 'end_sector' is compared to 'rdev->recovery_offset', which is offset to
> > rdev, however, commit e82ed3a4fbb5 ("md/raid6: refactor
> > raid5_read_one_chunk") changes the calculation of 'end_sector' to offset
> > to the array. Fix this miscalculation.
> >
> > Fixes: e82ed3a4fbb5 ("md/raid6: refactor raid5_read_one_chunk")
>
> This needs a stable tag as well, Fixes alone is not enough to guarantee
> it ends up in stable.
>
> Song, are you picking this up?

Yes, I will test it and send it via md-fixes.

Thanks,
Song

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

end of thread, other threads:[~2023-05-24 17:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24  1:41 [PATCH] md/raid5: fix miscalculation of 'end_sector' in raid5_read_one_chunk() Yu Kuai
2023-05-24  6:04 ` Christoph Hellwig
2023-05-24 15:03 ` Jens Axboe
2023-05-24 17:21   ` Song Liu

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.