From: NeilBrown <neilb@suse.de>
To: linux-raid@vger.kernel.org
Cc: Dan Williams <dan.j.williams@intel.com>, NeilBrown <neilb@suse.de>
Subject: [md PATCH 03/11] md/raid5: initialize conf->device_lock earlier
Date: Fri, 16 Oct 2009 16:49:18 +1100 [thread overview]
Message-ID: <20091016054918.24208.4222.stgit@notabene.brown> (raw)
In-Reply-To: <20091016054316.24208.33818.stgit@notabene.brown>
From: Dan Williams <dan.j.williams@intel.com>
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>
---
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 ec14ff5..c3e5967 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4715,6 +4715,18 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
conf = kzalloc(sizeof(raid5_conf_t), GFP_KERNEL);
if (conf == NULL)
goto abort;
+ spin_lock_init(&conf->device_lock);
+ init_waitqueue_head(&conf->wait_for_stripe);
+ init_waitqueue_head(&conf->wait_for_overlap);
+ INIT_LIST_HEAD(&conf->handle_list);
+ INIT_LIST_HEAD(&conf->hold_list);
+ INIT_LIST_HEAD(&conf->delayed_list);
+ INIT_LIST_HEAD(&conf->bitmap_list);
+ INIT_LIST_HEAD(&conf->inactive_list);
+ atomic_set(&conf->active_stripes, 0);
+ atomic_set(&conf->preread_active_stripes, 0);
+ atomic_set(&conf->active_aligned_reads, 0);
+ conf->bypass_threshold = BYPASS_THRESHOLD;
conf->raid_disks = mddev->raid_disks;
conf->scribble_len = scribble_len(conf->raid_disks);
@@ -4737,19 +4749,6 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
if (raid5_alloc_percpu(conf) != 0)
goto abort;
- spin_lock_init(&conf->device_lock);
- init_waitqueue_head(&conf->wait_for_stripe);
- init_waitqueue_head(&conf->wait_for_overlap);
- INIT_LIST_HEAD(&conf->handle_list);
- INIT_LIST_HEAD(&conf->hold_list);
- INIT_LIST_HEAD(&conf->delayed_list);
- INIT_LIST_HEAD(&conf->bitmap_list);
- INIT_LIST_HEAD(&conf->inactive_list);
- atomic_set(&conf->active_stripes, 0);
- atomic_set(&conf->preread_active_stripes, 0);
- atomic_set(&conf->active_aligned_reads, 0);
- conf->bypass_threshold = BYPASS_THRESHOLD;
-
pr_debug("raid5: run(%s) called.\n", mdname(mddev));
list_for_each_entry(rdev, &mddev->disks, same_set) {
next prev parent reply other threads:[~2009-10-16 5:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-16 5:49 [md PATCH 00/11] Series short description NeilBrown
2009-10-16 5:49 ` [md PATCH 01/11] Revert "md: do not progress the resync process if the stripe was blocked" NeilBrown
2009-10-16 5:49 ` [md PATCH 06/11] md: drivers/md/unroll.pl replaced with awk analog NeilBrown
2009-10-16 5:49 ` [md PATCH 05/11] md: remove clumsy usage of do_sync_mapping_range from bitmap code NeilBrown
2009-10-16 5:49 ` [md PATCH 02/11] md/raid1/raid10: add a cond_resched NeilBrown
2009-10-16 5:49 ` [md PATCH 04/11] md: raid1/raid10: handle allocation errors during array setup NeilBrown
2009-10-16 5:49 ` NeilBrown [this message]
2009-10-16 5:49 ` [md PATCH 10/11] md/async: don't pass a memory pointer as a page pointer NeilBrown
2009-10-16 5:49 ` [md PATCH 07/11] md/raid456: downlevel multicore operations to raid_run_ops NeilBrown
2009-10-16 5:49 ` [md PATCH 09/11] md: Fix handling of raid5 array which is being reshaped to fewer devices NeilBrown
2009-10-16 5:49 ` [md PATCH 11/11] raid6/async_tx: handle holes in block list in async_syndrome_val NeilBrown
2009-10-16 5:49 ` [md PATCH 08/11] md: fix problems with RAID6 calculations for DDF NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091016054918.24208.4222.stgit@notabene.brown \
--to=neilb@suse.de \
--cc=dan.j.williams@intel.com \
--cc=linux-raid@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).