Commit 2213d7c2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'md/3.17' of git://neil.brown.name/md

Pull md updates from Neil Brown:
 "Most interesting is that md devices (major == 9) with minor numbers of
  512 or more will no longer be created simply by opening a block device
  file.  They can only be created by writing to

      /sys/module/md_mod/parameters/new_array

  The 'auto-create-on-open' semantic is cumbersome and we need to start
  moving away from it"

* tag 'md/3.17' of git://neil.brown.name/md:
  md: don't allow bitmap file to be added to raid0/linear.
  md/raid0: check for bitmap compatability when changing raid levels.
  md: Recovery speed is wrong
  md: disable probing for md devices 512 and over.
  md/raid1,raid10: always abort recover on write error.
parents c8d6637d d66b1b39
...@@ -5961,7 +5961,7 @@ static int set_bitmap_file(struct mddev *mddev, int fd) ...@@ -5961,7 +5961,7 @@ static int set_bitmap_file(struct mddev *mddev, int fd)
int err = 0; int err = 0;
if (mddev->pers) { if (mddev->pers) {
if (!mddev->pers->quiesce) if (!mddev->pers->quiesce || !mddev->thread)
return -EBUSY; return -EBUSY;
if (mddev->recovery || mddev->sync_thread) if (mddev->recovery || mddev->sync_thread)
return -EBUSY; return -EBUSY;
...@@ -6263,7 +6263,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info) ...@@ -6263,7 +6263,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
rv = update_raid_disks(mddev, info->raid_disks); rv = update_raid_disks(mddev, info->raid_disks);
if ((state ^ info->state) & (1<<MD_SB_BITMAP_PRESENT)) { if ((state ^ info->state) & (1<<MD_SB_BITMAP_PRESENT)) {
if (mddev->pers->quiesce == NULL) if (mddev->pers->quiesce == NULL || mddev->thread == NULL)
return -EINVAL; return -EINVAL;
if (mddev->recovery || mddev->sync_thread) if (mddev->recovery || mddev->sync_thread)
return -EBUSY; return -EBUSY;
...@@ -7376,7 +7376,7 @@ void md_do_sync(struct md_thread *thread) ...@@ -7376,7 +7376,7 @@ void md_do_sync(struct md_thread *thread)
struct mddev *mddev2; struct mddev *mddev2;
unsigned int currspeed = 0, unsigned int currspeed = 0,
window; window;
sector_t max_sectors,j, io_sectors; sector_t max_sectors,j, io_sectors, recovery_done;
unsigned long mark[SYNC_MARKS]; unsigned long mark[SYNC_MARKS];
unsigned long update_time; unsigned long update_time;
sector_t mark_cnt[SYNC_MARKS]; sector_t mark_cnt[SYNC_MARKS];
...@@ -7652,7 +7652,8 @@ void md_do_sync(struct md_thread *thread) ...@@ -7652,7 +7652,8 @@ void md_do_sync(struct md_thread *thread)
*/ */
cond_resched(); cond_resched();
currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2 recovery_done = io_sectors - atomic_read(&mddev->recovery_active);
currspeed = ((unsigned long)(recovery_done - mddev->resync_mark_cnt))/2
/((jiffies-mddev->resync_mark)/HZ +1) +1; /((jiffies-mddev->resync_mark)/HZ +1) +1;
if (currspeed > speed_min(mddev)) { if (currspeed > speed_min(mddev)) {
...@@ -8592,7 +8593,7 @@ static int __init md_init(void) ...@@ -8592,7 +8593,7 @@ static int __init md_init(void)
goto err_mdp; goto err_mdp;
mdp_major = ret; mdp_major = ret;
blk_register_region(MKDEV(MD_MAJOR, 0), 1UL<<MINORBITS, THIS_MODULE, blk_register_region(MKDEV(MD_MAJOR, 0), 512, THIS_MODULE,
md_probe, NULL, NULL); md_probe, NULL, NULL);
blk_register_region(MKDEV(mdp_major, 0), 1UL<<MINORBITS, THIS_MODULE, blk_register_region(MKDEV(mdp_major, 0), 1UL<<MINORBITS, THIS_MODULE,
md_probe, NULL, NULL); md_probe, NULL, NULL);
...@@ -8687,7 +8688,7 @@ static __exit void md_exit(void) ...@@ -8687,7 +8688,7 @@ static __exit void md_exit(void)
struct list_head *tmp; struct list_head *tmp;
int delay = 1; int delay = 1;
blk_unregister_region(MKDEV(MD_MAJOR,0), 1U << MINORBITS); blk_unregister_region(MKDEV(MD_MAJOR,0), 512);
blk_unregister_region(MKDEV(mdp_major,0), 1U << MINORBITS); blk_unregister_region(MKDEV(mdp_major,0), 1U << MINORBITS);
unregister_blkdev(MD_MAJOR,"md"); unregister_blkdev(MD_MAJOR,"md");
......
...@@ -685,6 +685,12 @@ static void *raid0_takeover(struct mddev *mddev) ...@@ -685,6 +685,12 @@ static void *raid0_takeover(struct mddev *mddev)
* raid10 - assuming we have all necessary active disks * raid10 - assuming we have all necessary active disks
* raid1 - with (N -1) mirror drives faulty * raid1 - with (N -1) mirror drives faulty
*/ */
if (mddev->bitmap) {
printk(KERN_ERR "md/raid0: %s: cannot takeover array with bitmap\n",
mdname(mddev));
return ERR_PTR(-EBUSY);
}
if (mddev->level == 4) if (mddev->level == 4)
return raid0_takeover_raid45(mddev); return raid0_takeover_raid45(mddev);
......
...@@ -1501,12 +1501,12 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) ...@@ -1501,12 +1501,12 @@ static void error(struct mddev *mddev, struct md_rdev *rdev)
mddev->degraded++; mddev->degraded++;
set_bit(Faulty, &rdev->flags); set_bit(Faulty, &rdev->flags);
spin_unlock_irqrestore(&conf->device_lock, flags); spin_unlock_irqrestore(&conf->device_lock, flags);
/*
* if recovery is running, make sure it aborts.
*/
set_bit(MD_RECOVERY_INTR, &mddev->recovery);
} else } else
set_bit(Faulty, &rdev->flags); set_bit(Faulty, &rdev->flags);
/*
* if recovery is running, make sure it aborts.
*/
set_bit(MD_RECOVERY_INTR, &mddev->recovery);
set_bit(MD_CHANGE_DEVS, &mddev->flags); set_bit(MD_CHANGE_DEVS, &mddev->flags);
printk(KERN_ALERT printk(KERN_ALERT
"md/raid1:%s: Disk failure on %s, disabling device.\n" "md/raid1:%s: Disk failure on %s, disabling device.\n"
......
...@@ -1684,13 +1684,12 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) ...@@ -1684,13 +1684,12 @@ static void error(struct mddev *mddev, struct md_rdev *rdev)
spin_unlock_irqrestore(&conf->device_lock, flags); spin_unlock_irqrestore(&conf->device_lock, flags);
return; return;
} }
if (test_and_clear_bit(In_sync, &rdev->flags)) { if (test_and_clear_bit(In_sync, &rdev->flags))
mddev->degraded++; mddev->degraded++;
/* /*
* if recovery is running, make sure it aborts. * If recovery is running, make sure it aborts.
*/ */
set_bit(MD_RECOVERY_INTR, &mddev->recovery); set_bit(MD_RECOVERY_INTR, &mddev->recovery);
}
set_bit(Blocked, &rdev->flags); set_bit(Blocked, &rdev->flags);
set_bit(Faulty, &rdev->flags); set_bit(Faulty, &rdev->flags);
set_bit(MD_CHANGE_DEVS, &mddev->flags); set_bit(MD_CHANGE_DEVS, &mddev->flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment