diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-10-16 00:55:38 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-10-16 00:55:38 -0400 |
commit | f5efd45ae597c96ed017afad5662b67d55b402a0 (patch) | |
tree | 32ef979c6882d594890e02466003f5255af00fe3 /drivers/md/raid5.c | |
parent | 1d9d52416c0445019ccc1f0fddb9a227456eb61b (diff) |
md/raid5: initialize conf->device_lock earlier
Deallocating a raid5_conf_t structure requires taking 'device_lock'.
Ensure it is initialized before it is used, i.e. initialize the lock
before attempting any further initializations that might fail.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index ec14ff5b508a..c3e596778618 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4715,6 +4715,18 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
4715 | conf = kzalloc(sizeof(raid5_conf_t), GFP_KERNEL); | 4715 | conf = kzalloc(sizeof(raid5_conf_t), GFP_KERNEL); |
4716 | if (conf == NULL) | 4716 | if (conf == NULL) |
4717 | goto abort; | 4717 | goto abort; |
4718 | spin_lock_init(&conf->device_lock); | ||
4719 | init_waitqueue_head(&conf->wait_for_stripe); | ||
4720 | init_waitqueue_head(&conf->wait_for_overlap); | ||
4721 | INIT_LIST_HEAD(&conf->handle_list); | ||
4722 | INIT_LIST_HEAD(&conf->hold_list); | ||
4723 | INIT_LIST_HEAD(&conf->delayed_list); | ||
4724 | INIT_LIST_HEAD(&conf->bitmap_list); | ||
4725 | INIT_LIST_HEAD(&conf->inactive_list); | ||
4726 | atomic_set(&conf->active_stripes, 0); | ||
4727 | atomic_set(&conf->preread_active_stripes, 0); | ||
4728 | atomic_set(&conf->active_aligned_reads, 0); | ||
4729 | conf->bypass_threshold = BYPASS_THRESHOLD; | ||
4718 | 4730 | ||
4719 | conf->raid_disks = mddev->raid_disks; | 4731 | conf->raid_disks = mddev->raid_disks; |
4720 | conf->scribble_len = scribble_len(conf->raid_disks); | 4732 | conf->scribble_len = scribble_len(conf->raid_disks); |
@@ -4737,19 +4749,6 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
4737 | if (raid5_alloc_percpu(conf) != 0) | 4749 | if (raid5_alloc_percpu(conf) != 0) |
4738 | goto abort; | 4750 | goto abort; |
4739 | 4751 | ||
4740 | spin_lock_init(&conf->device_lock); | ||
4741 | init_waitqueue_head(&conf->wait_for_stripe); | ||
4742 | init_waitqueue_head(&conf->wait_for_overlap); | ||
4743 | INIT_LIST_HEAD(&conf->handle_list); | ||
4744 | INIT_LIST_HEAD(&conf->hold_list); | ||
4745 | INIT_LIST_HEAD(&conf->delayed_list); | ||
4746 | INIT_LIST_HEAD(&conf->bitmap_list); | ||
4747 | INIT_LIST_HEAD(&conf->inactive_list); | ||
4748 | atomic_set(&conf->active_stripes, 0); | ||
4749 | atomic_set(&conf->preread_active_stripes, 0); | ||
4750 | atomic_set(&conf->active_aligned_reads, 0); | ||
4751 | conf->bypass_threshold = BYPASS_THRESHOLD; | ||
4752 | |||
4753 | pr_debug("raid5: run(%s) called.\n", mdname(mddev)); | 4752 | pr_debug("raid5: run(%s) called.\n", mdname(mddev)); |
4754 | 4753 | ||
4755 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 4754 | list_for_each_entry(rdev, &mddev->disks, same_set) { |