Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27028626 authored by Tomasz Majchrzak's avatar Tomasz Majchrzak Committed by Shaohua Li
Browse files

raid10: record correct address of bad block



For failed write request record block address on a device, not block
address in an array.

Signed-off-by: default avatarTomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 0f6187db
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -2465,20 +2465,21 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)


	while (sect_to_write) {
	while (sect_to_write) {
		struct bio *wbio;
		struct bio *wbio;
		sector_t wsector;
		if (sectors > sect_to_write)
		if (sectors > sect_to_write)
			sectors = sect_to_write;
			sectors = sect_to_write;
		/* Write at 'sector' for 'sectors' */
		/* Write at 'sector' for 'sectors' */
		wbio = bio_clone_mddev(bio, GFP_NOIO, mddev);
		wbio = bio_clone_mddev(bio, GFP_NOIO, mddev);
		bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors);
		bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors);
		wbio->bi_iter.bi_sector = (r10_bio->devs[i].addr+
		wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector);
				   choose_data_offset(r10_bio, rdev) +
		wbio->bi_iter.bi_sector = wsector +
				   (sector - r10_bio->sector));
				   choose_data_offset(r10_bio, rdev);
		wbio->bi_bdev = rdev->bdev;
		wbio->bi_bdev = rdev->bdev;
		bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
		bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);


		if (submit_bio_wait(wbio) < 0)
		if (submit_bio_wait(wbio) < 0)
			/* Failure! */
			/* Failure! */
			ok = rdev_set_badblocks(rdev, sector,
			ok = rdev_set_badblocks(rdev, wsector,
						sectors, 0)
						sectors, 0)
				&& ok;
				&& ok;