Skip to content

Commit 17c28c2

Browse files
committed
Revert "md/raid10: extend r10bio devs to raid disks"
This reverts commit 8650a88. Matthew Ruffell reported data corruption in raid10 due to the changes in discard handling [1]. Revert these changes before we find a proper fix. [1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1907262/ Cc: Matthew Ruffell <[email protected]> Cc: Xiao Ni <[email protected]> Signed-off-by: Song Liu <[email protected]>
1 parent 4e2c656 commit 17c28c2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/md/raid10.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static inline struct r10bio *get_resync_r10bio(struct bio *bio)
9191
static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
9292
{
9393
struct r10conf *conf = data;
94-
int size = offsetof(struct r10bio, devs[conf->geo.raid_disks]);
94+
int size = offsetof(struct r10bio, devs[conf->copies]);
9595

9696
/* allocate a r10bio with room for raid_disks entries in the
9797
* bios array */
@@ -238,7 +238,7 @@ static void put_all_bios(struct r10conf *conf, struct r10bio *r10_bio)
238238
{
239239
int i;
240240

241-
for (i = 0; i < conf->geo.raid_disks; i++) {
241+
for (i = 0; i < conf->copies; i++) {
242242
struct bio **bio = & r10_bio->devs[i].bio;
243243
if (!BIO_SPECIAL(*bio))
244244
bio_put(*bio);
@@ -327,7 +327,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
327327
int slot;
328328
int repl = 0;
329329

330-
for (slot = 0; slot < conf->geo.raid_disks; slot++) {
330+
for (slot = 0; slot < conf->copies; slot++) {
331331
if (r10_bio->devs[slot].bio == bio)
332332
break;
333333
if (r10_bio->devs[slot].repl_bio == bio) {
@@ -336,6 +336,7 @@ static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio,
336336
}
337337
}
338338

339+
BUG_ON(slot == conf->copies);
339340
update_head_pos(slot, r10_bio);
340341

341342
if (slotp)
@@ -1492,7 +1493,7 @@ static void __make_request(struct mddev *mddev, struct bio *bio, int sectors)
14921493
r10_bio->mddev = mddev;
14931494
r10_bio->sector = bio->bi_iter.bi_sector;
14941495
r10_bio->state = 0;
1495-
memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) * conf->geo.raid_disks);
1496+
memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) * conf->copies);
14961497

14971498
if (bio_data_dir(bio) == READ)
14981499
raid10_read_request(mddev, bio, r10_bio);

0 commit comments

Comments
 (0)