mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 14:05:39 +00:00
Merge tag 'md-fixes-20230914' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into block-6.6
Pull MD fixes from Song: "These commits fix a bugzilla report [1] and some recent issues in 6.5 and 6.6. [1] https://bugzilla.kernel.org/show_bug.cgi?id=217798" * tag 'md-fixes-20230914' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md: md: Put the right device in md_seq_next md/raid1: fix error: ISO C90 forbids mixed declarations md: fix warning for holder mismatch from export_rdev() md: don't dereference mddev after export_rdev()
This commit is contained in:
commit
29ee7a4a57
@ -798,14 +798,14 @@ void mddev_unlock(struct mddev *mddev)
|
||||
} else
|
||||
mutex_unlock(&mddev->reconfig_mutex);
|
||||
|
||||
md_wakeup_thread(mddev->thread);
|
||||
wake_up(&mddev->sb_wait);
|
||||
|
||||
list_for_each_entry_safe(rdev, tmp, &delete, same_set) {
|
||||
list_del_init(&rdev->same_set);
|
||||
kobject_del(&rdev->kobj);
|
||||
export_rdev(rdev, mddev);
|
||||
}
|
||||
|
||||
md_wakeup_thread(mddev->thread);
|
||||
wake_up(&mddev->sb_wait);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mddev_unlock);
|
||||
|
||||
@ -2452,7 +2452,8 @@ static void export_rdev(struct md_rdev *rdev, struct mddev *mddev)
|
||||
if (test_bit(AutoDetected, &rdev->flags))
|
||||
md_autodetect_dev(rdev->bdev->bd_dev);
|
||||
#endif
|
||||
blkdev_put(rdev->bdev, mddev->external ? &claim_rdev : rdev);
|
||||
blkdev_put(rdev->bdev,
|
||||
test_bit(Holder, &rdev->flags) ? rdev : &claim_rdev);
|
||||
rdev->bdev = NULL;
|
||||
kobject_put(&rdev->kobj);
|
||||
}
|
||||
@ -3632,6 +3633,7 @@ EXPORT_SYMBOL_GPL(md_rdev_init);
|
||||
static struct md_rdev *md_import_device(dev_t newdev, int super_format, int super_minor)
|
||||
{
|
||||
struct md_rdev *rdev;
|
||||
struct md_rdev *holder;
|
||||
sector_t size;
|
||||
int err;
|
||||
|
||||
@ -3646,8 +3648,15 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
|
||||
if (err)
|
||||
goto out_clear_rdev;
|
||||
|
||||
if (super_format == -2) {
|
||||
holder = &claim_rdev;
|
||||
} else {
|
||||
holder = rdev;
|
||||
set_bit(Holder, &rdev->flags);
|
||||
}
|
||||
|
||||
rdev->bdev = blkdev_get_by_dev(newdev, BLK_OPEN_READ | BLK_OPEN_WRITE,
|
||||
super_format == -2 ? &claim_rdev : rdev, NULL);
|
||||
holder, NULL);
|
||||
if (IS_ERR(rdev->bdev)) {
|
||||
pr_warn("md: could not open device unknown-block(%u,%u).\n",
|
||||
MAJOR(newdev), MINOR(newdev));
|
||||
@ -3684,7 +3693,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
|
||||
return rdev;
|
||||
|
||||
out_blkdev_put:
|
||||
blkdev_put(rdev->bdev, super_format == -2 ? &claim_rdev : rdev);
|
||||
blkdev_put(rdev->bdev, holder);
|
||||
out_clear_rdev:
|
||||
md_rdev_clear(rdev);
|
||||
out_free_rdev:
|
||||
@ -8256,7 +8265,7 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
spin_unlock(&all_mddevs_lock);
|
||||
|
||||
if (to_put)
|
||||
mddev_put(mddev);
|
||||
mddev_put(to_put);
|
||||
return next_mddev;
|
||||
|
||||
}
|
||||
|
@ -211,6 +211,9 @@ enum flag_bits {
|
||||
* check if there is collision between raid1
|
||||
* serial bios.
|
||||
*/
|
||||
Holder, /* rdev is used as holder while opening
|
||||
* underlying disk exclusively.
|
||||
*/
|
||||
};
|
||||
|
||||
static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
|
||||
|
@ -1837,12 +1837,11 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
|
||||
struct r1conf *conf = mddev->private;
|
||||
int err = 0;
|
||||
int number = rdev->raid_disk;
|
||||
struct raid1_info *p = conf->mirrors + number;
|
||||
|
||||
if (unlikely(number >= conf->raid_disks))
|
||||
goto abort;
|
||||
|
||||
struct raid1_info *p = conf->mirrors + number;
|
||||
|
||||
if (rdev != p->rdev)
|
||||
p = conf->mirrors + conf->raid_disks + number;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user