Commit 905e321e authored by Jens Axboe's avatar Jens Axboe

Merge branch 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into block-5.9

Pull MD fixes from Song.

* 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md:
  md-cluster: Fix potential error pointer dereference in resize_bitmaps()
  md: get sysfs entry after redundancy attr group create
parents d7aaeef2 e8abe1de
...@@ -1139,6 +1139,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz ...@@ -1139,6 +1139,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
bitmap = get_bitmap_from_slot(mddev, i); bitmap = get_bitmap_from_slot(mddev, i);
if (IS_ERR(bitmap)) { if (IS_ERR(bitmap)) {
pr_err("can't get bitmap from slot %d\n", i); pr_err("can't get bitmap from slot %d\n", i);
bitmap = NULL;
goto out; goto out;
} }
counts = &bitmap->counts; counts = &bitmap->counts;
......
...@@ -856,7 +856,13 @@ void mddev_unlock(struct mddev *mddev) ...@@ -856,7 +856,13 @@ void mddev_unlock(struct mddev *mddev)
sysfs_remove_group(&mddev->kobj, &md_redundancy_group); sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
if (mddev->sysfs_action) if (mddev->sysfs_action)
sysfs_put(mddev->sysfs_action); sysfs_put(mddev->sysfs_action);
if (mddev->sysfs_completed)
sysfs_put(mddev->sysfs_completed);
if (mddev->sysfs_degraded)
sysfs_put(mddev->sysfs_degraded);
mddev->sysfs_action = NULL; mddev->sysfs_action = NULL;
mddev->sysfs_completed = NULL;
mddev->sysfs_degraded = NULL;
} }
} }
mddev->sysfs_active = 0; mddev->sysfs_active = 0;
...@@ -4074,6 +4080,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -4074,6 +4080,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
pr_warn("md: cannot register extra attributes for %s\n", pr_warn("md: cannot register extra attributes for %s\n",
mdname(mddev)); mdname(mddev));
mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action"); mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action");
mddev->sysfs_completed = sysfs_get_dirent_safe(mddev->kobj.sd, "sync_completed");
mddev->sysfs_degraded = sysfs_get_dirent_safe(mddev->kobj.sd, "degraded");
} }
if (oldpers->sync_request != NULL && if (oldpers->sync_request != NULL &&
pers->sync_request == NULL) { pers->sync_request == NULL) {
...@@ -5589,14 +5597,9 @@ static void md_free(struct kobject *ko) ...@@ -5589,14 +5597,9 @@ static void md_free(struct kobject *ko)
if (mddev->sysfs_state) if (mddev->sysfs_state)
sysfs_put(mddev->sysfs_state); sysfs_put(mddev->sysfs_state);
if (mddev->sysfs_completed)
sysfs_put(mddev->sysfs_completed);
if (mddev->sysfs_degraded)
sysfs_put(mddev->sysfs_degraded);
if (mddev->sysfs_level) if (mddev->sysfs_level)
sysfs_put(mddev->sysfs_level); sysfs_put(mddev->sysfs_level);
if (mddev->gendisk) if (mddev->gendisk)
del_gendisk(mddev->gendisk); del_gendisk(mddev->gendisk);
if (mddev->queue) if (mddev->queue)
...@@ -5764,8 +5767,6 @@ static int md_alloc(dev_t dev, char *name) ...@@ -5764,8 +5767,6 @@ static int md_alloc(dev_t dev, char *name)
if (!error && mddev->kobj.sd) { if (!error && mddev->kobj.sd) {
kobject_uevent(&mddev->kobj, KOBJ_ADD); kobject_uevent(&mddev->kobj, KOBJ_ADD);
mddev->sysfs_state = sysfs_get_dirent_safe(mddev->kobj.sd, "array_state"); mddev->sysfs_state = sysfs_get_dirent_safe(mddev->kobj.sd, "array_state");
mddev->sysfs_completed = sysfs_get_dirent_safe(mddev->kobj.sd, "sync_completed");
mddev->sysfs_degraded = sysfs_get_dirent_safe(mddev->kobj.sd, "degraded");
mddev->sysfs_level = sysfs_get_dirent_safe(mddev->kobj.sd, "level"); mddev->sysfs_level = sysfs_get_dirent_safe(mddev->kobj.sd, "level");
} }
mddev_put(mddev); mddev_put(mddev);
...@@ -6043,6 +6044,8 @@ int md_run(struct mddev *mddev) ...@@ -6043,6 +6044,8 @@ int md_run(struct mddev *mddev)
pr_warn("md: cannot register extra attributes for %s\n", pr_warn("md: cannot register extra attributes for %s\n",
mdname(mddev)); mdname(mddev));
mddev->sysfs_action = sysfs_get_dirent_safe(mddev->kobj.sd, "sync_action"); mddev->sysfs_action = sysfs_get_dirent_safe(mddev->kobj.sd, "sync_action");
mddev->sysfs_completed = sysfs_get_dirent_safe(mddev->kobj.sd, "sync_completed");
mddev->sysfs_degraded = sysfs_get_dirent_safe(mddev->kobj.sd, "degraded");
} else if (mddev->ro == 2) /* auto-readonly not meaningful */ } else if (mddev->ro == 2) /* auto-readonly not meaningful */
mddev->ro = 0; mddev->ro = 0;
......
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