mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-12 07:14:03 +08:00
md: half a dozen bug fixes for 3.13
All of these fix real bugs the people have hit, and are tagged for -stable. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIVAwUAUtYZqznsnt1WYoG5AQK50g//XuqVR/esIpGR+knf+1sD3Zk85Vp33kGL 2UfbQbi40q/uLjBhJhOSkx/sYGw1Eo255vNX+yMVjYT9F+xbhI8vlLfecqx5Fk5J M+JH1sM7E2T79boFLoOBGSl/qppsQsPHa3p87FmFHQrrAuEMIbFiP98MnQjdSiv4 Cu9cAR7x7njepHeMXBFiV7URaYtCHAXR9iMdkebkKIFlfND8w2QYD+LWo3SzBKs9 jTrSBJRpXLHE+bZLOQPhAryb7nWkcT1R7N0vsVMQKcq1o6ZiRNnk/B9xNtV34hkc 5zwTPe/d5AsV6Tsxg0dSs7xcBn/A+F5lg8fzdOhyE1F13COmB7sepjPTMPAy/oP1 zjyPwnnWkHMDUW2usf3aqPMt+LGMofRCJHXjkqpMgIWQ96SQUY8F9PPxchkUCsx/ A38I+vXl2jGDHh/DFSduef3sDOF6TYyKyLteJftyny96dc1RutrZSbHPdrkDz1YQ 6zcyvpv0FexiXITrLg70FG8fnRMK91ZfHrmuzVP7tpm2TyeIfDriLhTAIXAcXHOT l22a1bNj4shFfztnD0CbH6nY/iJM7ov0x5+IyG5/iYbipon02MenQeV9km6JVwQb OCGHYCTswiFSduX1E1ru52dHXifbANWgzcUH0sjGQ0YZNmxvPRBWDjB1H2J1auzW J8T10qimw1w= =uvyl -----END PGP SIGNATURE----- Merge tag 'md/3.13-fixes' of git://neil.brown.name/md Pull late md fixes from Neil Brown: "Half a dozen md bug fixes. All of these fix real bugs the people have hit, and are tagged for -stable. Sorry they are late .... Christmas holidays and all that. Hopefully they can still squeak into 3.13" * tag 'md/3.13-fixes' of git://neil.brown.name/md: md: fix problem when adding device to read-only array with bitmap. md/raid10: fix bug when raid10 recovery fails to recover a block. md/raid5: fix a recently broken BUG_ON(). md/raid1: fix request counting bug in new 'barrier' code. md/raid10: fix two bugs in handling of known-bad-blocks. md/raid5: Fix possible confusion when multiple write errors occur.
This commit is contained in:
commit
1a60864fc1
@ -1077,6 +1077,7 @@ static int super_90_validate(struct mddev *mddev, struct md_rdev *rdev)
|
||||
rdev->raid_disk = -1;
|
||||
clear_bit(Faulty, &rdev->flags);
|
||||
clear_bit(In_sync, &rdev->flags);
|
||||
clear_bit(Bitmap_sync, &rdev->flags);
|
||||
clear_bit(WriteMostly, &rdev->flags);
|
||||
|
||||
if (mddev->raid_disks == 0) {
|
||||
@ -1155,6 +1156,8 @@ static int super_90_validate(struct mddev *mddev, struct md_rdev *rdev)
|
||||
*/
|
||||
if (ev1 < mddev->bitmap->events_cleared)
|
||||
return 0;
|
||||
if (ev1 < mddev->events)
|
||||
set_bit(Bitmap_sync, &rdev->flags);
|
||||
} else {
|
||||
if (ev1 < mddev->events)
|
||||
/* just a hot-add of a new device, leave raid_disk at -1 */
|
||||
@ -1563,6 +1566,7 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
|
||||
rdev->raid_disk = -1;
|
||||
clear_bit(Faulty, &rdev->flags);
|
||||
clear_bit(In_sync, &rdev->flags);
|
||||
clear_bit(Bitmap_sync, &rdev->flags);
|
||||
clear_bit(WriteMostly, &rdev->flags);
|
||||
|
||||
if (mddev->raid_disks == 0) {
|
||||
@ -1645,6 +1649,8 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
|
||||
*/
|
||||
if (ev1 < mddev->bitmap->events_cleared)
|
||||
return 0;
|
||||
if (ev1 < mddev->events)
|
||||
set_bit(Bitmap_sync, &rdev->flags);
|
||||
} else {
|
||||
if (ev1 < mddev->events)
|
||||
/* just a hot-add of a new device, leave raid_disk at -1 */
|
||||
@ -2788,6 +2794,7 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len)
|
||||
else
|
||||
rdev->saved_raid_disk = -1;
|
||||
clear_bit(In_sync, &rdev->flags);
|
||||
clear_bit(Bitmap_sync, &rdev->flags);
|
||||
err = rdev->mddev->pers->
|
||||
hot_add_disk(rdev->mddev, rdev);
|
||||
if (err) {
|
||||
@ -5760,6 +5767,7 @@ static int add_new_disk(struct mddev * mddev, mdu_disk_info_t *info)
|
||||
info->raid_disk < mddev->raid_disks) {
|
||||
rdev->raid_disk = info->raid_disk;
|
||||
set_bit(In_sync, &rdev->flags);
|
||||
clear_bit(Bitmap_sync, &rdev->flags);
|
||||
} else
|
||||
rdev->raid_disk = -1;
|
||||
} else
|
||||
@ -7706,7 +7714,8 @@ static int remove_and_add_spares(struct mddev *mddev,
|
||||
if (test_bit(Faulty, &rdev->flags))
|
||||
continue;
|
||||
if (mddev->ro &&
|
||||
rdev->saved_raid_disk < 0)
|
||||
! (rdev->saved_raid_disk >= 0 &&
|
||||
!test_bit(Bitmap_sync, &rdev->flags)))
|
||||
continue;
|
||||
|
||||
rdev->recovery_offset = 0;
|
||||
@ -7787,9 +7796,12 @@ void md_check_recovery(struct mddev *mddev)
|
||||
* As we only add devices that are already in-sync,
|
||||
* we can activate the spares immediately.
|
||||
*/
|
||||
clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
|
||||
remove_and_add_spares(mddev, NULL);
|
||||
mddev->pers->spare_active(mddev);
|
||||
/* There is no thread, but we need to call
|
||||
* ->spare_active and clear saved_raid_disk
|
||||
*/
|
||||
md_reap_sync_thread(mddev);
|
||||
clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
|
@ -129,6 +129,9 @@ struct md_rdev {
|
||||
enum flag_bits {
|
||||
Faulty, /* device is known to have a fault */
|
||||
In_sync, /* device is in_sync with rest of array */
|
||||
Bitmap_sync, /* ..actually, not quite In_sync. Need a
|
||||
* bitmap-based recovery to get fully in sync
|
||||
*/
|
||||
Unmerged, /* device is being added to array and should
|
||||
* be considerred for bvec_merge_fn but not
|
||||
* yet for actual IO
|
||||
|
@ -924,9 +924,8 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio)
|
||||
conf->next_window_requests++;
|
||||
else
|
||||
conf->current_window_requests++;
|
||||
}
|
||||
if (bio->bi_sector >= conf->start_next_window)
|
||||
sector = conf->start_next_window;
|
||||
}
|
||||
}
|
||||
|
||||
conf->nr_pending++;
|
||||
|
@ -1319,7 +1319,7 @@ read_again:
|
||||
/* Could not read all from this device, so we will
|
||||
* need another r10_bio.
|
||||
*/
|
||||
sectors_handled = (r10_bio->sectors + max_sectors
|
||||
sectors_handled = (r10_bio->sector + max_sectors
|
||||
- bio->bi_sector);
|
||||
r10_bio->sectors = max_sectors;
|
||||
spin_lock_irq(&conf->device_lock);
|
||||
@ -1327,7 +1327,7 @@ read_again:
|
||||
bio->bi_phys_segments = 2;
|
||||
else
|
||||
bio->bi_phys_segments++;
|
||||
spin_unlock(&conf->device_lock);
|
||||
spin_unlock_irq(&conf->device_lock);
|
||||
/* Cannot call generic_make_request directly
|
||||
* as that will be queued in __generic_make_request
|
||||
* and subsequent mempool_alloc might block
|
||||
@ -3218,10 +3218,6 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
|
||||
if (j == conf->copies) {
|
||||
/* Cannot recover, so abort the recovery or
|
||||
* record a bad block */
|
||||
put_buf(r10_bio);
|
||||
if (rb2)
|
||||
atomic_dec(&rb2->remaining);
|
||||
r10_bio = rb2;
|
||||
if (any_working) {
|
||||
/* problem is that there are bad blocks
|
||||
* on other device(s)
|
||||
@ -3253,6 +3249,10 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
|
||||
mirror->recovery_disabled
|
||||
= mddev->recovery_disabled;
|
||||
}
|
||||
put_buf(r10_bio);
|
||||
if (rb2)
|
||||
atomic_dec(&rb2->remaining);
|
||||
r10_bio = rb2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -687,7 +687,8 @@ get_active_stripe(struct r5conf *conf, sector_t sector,
|
||||
} else {
|
||||
if (!test_bit(STRIPE_HANDLE, &sh->state))
|
||||
atomic_inc(&conf->active_stripes);
|
||||
BUG_ON(list_empty(&sh->lru));
|
||||
BUG_ON(list_empty(&sh->lru) &&
|
||||
!test_bit(STRIPE_EXPANDING, &sh->state));
|
||||
list_del_init(&sh->lru);
|
||||
if (sh->group) {
|
||||
sh->group->stripes_cnt--;
|
||||
@ -3608,7 +3609,7 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
|
||||
*/
|
||||
set_bit(R5_Insync, &dev->flags);
|
||||
|
||||
if (rdev && test_bit(R5_WriteError, &dev->flags)) {
|
||||
if (test_bit(R5_WriteError, &dev->flags)) {
|
||||
/* This flag does not apply to '.replacement'
|
||||
* only to .rdev, so make sure to check that*/
|
||||
struct md_rdev *rdev2 = rcu_dereference(
|
||||
@ -3621,7 +3622,7 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
|
||||
} else
|
||||
clear_bit(R5_WriteError, &dev->flags);
|
||||
}
|
||||
if (rdev && test_bit(R5_MadeGood, &dev->flags)) {
|
||||
if (test_bit(R5_MadeGood, &dev->flags)) {
|
||||
/* This flag does not apply to '.replacement'
|
||||
* only to .rdev, so make sure to check that*/
|
||||
struct md_rdev *rdev2 = rcu_dereference(
|
||||
|
Loading…
Reference in New Issue
Block a user