mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 12:52:30 +00:00
3 bug fixes for md in 3.10
3.10 wasn't a good release for md. The bio changes left a couple of bugs, and an md "fix" created another one. These three patches appear to fix the issues and have been tagged for -stable. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIVAwUAUedstTnsnt1WYoG5AQJmlBAAvQq9PryhyhPl1xC7K6ufoFfoRFO9yQPd lbe1bpAgyDuStF2t0H+pOBJeI45P9p8oGDsGlvzNI0/1YPxJpv20d/EkQI3eJ4vm B2iLt2NyZLs3zTc1V0oWBCCp2BT5vgdjHfCfyt7H2MQg0Lxtz9DjVnV0uF58EIWe mEo5fipXtRlgHAsTay4hiDqoUNy1Lc4I9nPRGtxH8/qj4oB5YudMyNvAq9FFGwr0 31L/ok+mjZdsZJZ+T4jS6hcjy0Wv/TU9lO2Ou1Jua2hLwVk6jvJ5DWzwuqakauaP MJqiiT4Wuv9V5LKvNknhT2fHfevfBJfhA1hTdVNQuVEHFVW5eb3nW8n8bYZUOhxD arqWHTIPqK6x8VBfocmjgePnc7CqCS4psPN5DAmp+Kiu6aF0e+eNF4SH8PIV+PQB xFW2CR3I6Y3evnUab7K+t2gw41vB5iJmlejvlCY3wd4OhRSt0rDQJc7b51tu7lbB FR8yYSoZ2fvjAqcG4ScSGKol5lkWJALgaLBPMSUdc984pNpEORv+Euqgy2nhYtgo fvF+loq0l9MVs9qxiuGzIMltt50nqdRrJMzWCAVbH3n9eYfzBj10A/eUUYqoH/zL +A9spAj8Brk9stdaOT/ZXlDSnwT4S3Q5WEuDl/rYM7VjPj6yUrGiXozHGjdxkL/T Q7+kYSLrXrA= =mQEH -----END PGP SIGNATURE----- Merge tag 'md-3.11-fixes' of git://neil.brown.name/md Pull md bug fixes from NeilBrown: "Sorry boss, back at work now boss. Here's them nice shiny patches ya wanted. All nicely tagged and justified for -stable and everyfing: Three bug fixes for md in 3.10 3.10 wasn't a good release for md. The bio changes left a couple of bugs, and an md "fix" created another one. These three patches appear to fix the issues and have been tagged for -stable" * tag 'md-3.11-fixes' of git://neil.brown.name/md: md/raid1: fix bio handling problems in process_checks() md: Remove recent change which allows devices to skip recovery. md/raid10: fix two problems with RAID10 resync.
This commit is contained in:
commit
4b8b8a4afa
@ -7716,20 +7716,6 @@ static int remove_and_add_spares(struct mddev *mddev,
|
||||
continue;
|
||||
|
||||
rdev->recovery_offset = 0;
|
||||
if (rdev->saved_raid_disk >= 0 && mddev->in_sync) {
|
||||
spin_lock_irq(&mddev->write_lock);
|
||||
if (mddev->in_sync)
|
||||
/* OK, this device, which is in_sync,
|
||||
* will definitely be noticed before
|
||||
* the next write, so recovery isn't
|
||||
* needed.
|
||||
*/
|
||||
rdev->recovery_offset = mddev->recovery_cp;
|
||||
spin_unlock_irq(&mddev->write_lock);
|
||||
}
|
||||
if (mddev->ro && rdev->recovery_offset != MaxSector)
|
||||
/* not safe to add this disk now */
|
||||
continue;
|
||||
if (mddev->pers->
|
||||
hot_add_disk(mddev, rdev) == 0) {
|
||||
if (sysfs_link_rdev(mddev, rdev))
|
||||
|
@ -1849,6 +1849,36 @@ static int process_checks(struct r1bio *r1_bio)
|
||||
int i;
|
||||
int vcnt;
|
||||
|
||||
/* Fix variable parts of all bios */
|
||||
vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9);
|
||||
for (i = 0; i < conf->raid_disks * 2; i++) {
|
||||
int j;
|
||||
int size;
|
||||
struct bio *b = r1_bio->bios[i];
|
||||
if (b->bi_end_io != end_sync_read)
|
||||
continue;
|
||||
/* fixup the bio for reuse */
|
||||
bio_reset(b);
|
||||
b->bi_vcnt = vcnt;
|
||||
b->bi_size = r1_bio->sectors << 9;
|
||||
b->bi_sector = r1_bio->sector +
|
||||
conf->mirrors[i].rdev->data_offset;
|
||||
b->bi_bdev = conf->mirrors[i].rdev->bdev;
|
||||
b->bi_end_io = end_sync_read;
|
||||
b->bi_private = r1_bio;
|
||||
|
||||
size = b->bi_size;
|
||||
for (j = 0; j < vcnt ; j++) {
|
||||
struct bio_vec *bi;
|
||||
bi = &b->bi_io_vec[j];
|
||||
bi->bv_offset = 0;
|
||||
if (size > PAGE_SIZE)
|
||||
bi->bv_len = PAGE_SIZE;
|
||||
else
|
||||
bi->bv_len = size;
|
||||
size -= PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
for (primary = 0; primary < conf->raid_disks * 2; primary++)
|
||||
if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
|
||||
test_bit(BIO_UPTODATE, &r1_bio->bios[primary]->bi_flags)) {
|
||||
@ -1857,12 +1887,10 @@ static int process_checks(struct r1bio *r1_bio)
|
||||
break;
|
||||
}
|
||||
r1_bio->read_disk = primary;
|
||||
vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9);
|
||||
for (i = 0; i < conf->raid_disks * 2; i++) {
|
||||
int j;
|
||||
struct bio *pbio = r1_bio->bios[primary];
|
||||
struct bio *sbio = r1_bio->bios[i];
|
||||
int size;
|
||||
|
||||
if (sbio->bi_end_io != end_sync_read)
|
||||
continue;
|
||||
@ -1888,27 +1916,6 @@ static int process_checks(struct r1bio *r1_bio)
|
||||
rdev_dec_pending(conf->mirrors[i].rdev, mddev);
|
||||
continue;
|
||||
}
|
||||
/* fixup the bio for reuse */
|
||||
bio_reset(sbio);
|
||||
sbio->bi_vcnt = vcnt;
|
||||
sbio->bi_size = r1_bio->sectors << 9;
|
||||
sbio->bi_sector = r1_bio->sector +
|
||||
conf->mirrors[i].rdev->data_offset;
|
||||
sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
|
||||
sbio->bi_end_io = end_sync_read;
|
||||
sbio->bi_private = r1_bio;
|
||||
|
||||
size = sbio->bi_size;
|
||||
for (j = 0; j < vcnt ; j++) {
|
||||
struct bio_vec *bi;
|
||||
bi = &sbio->bi_io_vec[j];
|
||||
bi->bv_offset = 0;
|
||||
if (size > PAGE_SIZE)
|
||||
bi->bv_len = PAGE_SIZE;
|
||||
else
|
||||
bi->bv_len = size;
|
||||
size -= PAGE_SIZE;
|
||||
}
|
||||
|
||||
bio_copy_data(sbio, pbio);
|
||||
}
|
||||
|
@ -2097,11 +2097,17 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio)
|
||||
* both 'first' and 'i', so we just compare them.
|
||||
* All vec entries are PAGE_SIZE;
|
||||
*/
|
||||
for (j = 0; j < vcnt; j++)
|
||||
int sectors = r10_bio->sectors;
|
||||
for (j = 0; j < vcnt; j++) {
|
||||
int len = PAGE_SIZE;
|
||||
if (sectors < (len / 512))
|
||||
len = sectors * 512;
|
||||
if (memcmp(page_address(fbio->bi_io_vec[j].bv_page),
|
||||
page_address(tbio->bi_io_vec[j].bv_page),
|
||||
fbio->bi_io_vec[j].bv_len))
|
||||
len))
|
||||
break;
|
||||
sectors -= len/512;
|
||||
}
|
||||
if (j == vcnt)
|
||||
continue;
|
||||
atomic64_add(r10_bio->sectors, &mddev->resync_mismatches);
|
||||
@ -3407,6 +3413,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
|
||||
|
||||
if (bio->bi_end_io == end_sync_read) {
|
||||
md_sync_acct(bio->bi_bdev, nr_sectors);
|
||||
set_bit(BIO_UPTODATE, &bio->bi_flags);
|
||||
generic_make_request(bio);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user