linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* raid5: When add stripe_head to inactive_list, it should remove hash.
@ 2012-08-18  2:53 Jianpeng Ma
  2012-08-20  8:17 ` Jianpeng Ma
  0 siblings, 1 reply; 7+ messages in thread
From: Jianpeng Ma @ 2012-08-18  2:53 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid

If it released stripe_head to inactive_list and soon get it from hash
list. So the stripe_head didn't call init_stripe, the dev.flags isn't
clear. So the debug info is error which printed the before info.
Although, i can't find logic error because this.I think it should be
correct.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 drivers/md/raid5.c |   35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index adda94d..03d2f64 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -196,6 +196,24 @@ static int stripe_operations_active(struct stripe_head *sh)
 	       test_bit(STRIPE_COMPUTE_RUN, &sh->state);
 }
 
+static inline void remove_hash(struct stripe_head *sh)
+{
+	pr_debug("remove_hash(), stripe %llu\n",
+		(unsigned long long)sh->sector);
+
+	hlist_del_init(&sh->hash);
+}
+
+static inline void insert_hash(struct r5conf *conf, struct stripe_head *sh)
+{
+	struct hlist_head *hp = stripe_hash(conf, sh->sector);
+
+	pr_debug("insert_hash(), stripe %llu\n",
+		(unsigned long long)sh->sector);
+
+	hlist_add_head(&sh->hash, hp);
+}
+
 static void do_release_stripe(struct r5conf *conf, struct stripe_head *sh)
 {
 	BUG_ON(!list_empty(&sh->lru));
@@ -222,6 +240,7 @@ static void do_release_stripe(struct r5conf *conf, struct stripe_head *sh)
 		atomic_dec(&conf->active_stripes);
 		if (!test_bit(STRIPE_EXPANDING, &sh->state)) {
 			list_add_tail(&sh->lru, &conf->inactive_list);
+			remove_hash(sh);
 			wake_up(&conf->wait_for_stripe);
 			if (conf->retry_read_aligned)
 				md_wakeup_thread(conf->mddev->thread);
@@ -248,23 +267,7 @@ static void release_stripe(struct stripe_head *sh)
 	local_irq_restore(flags);
 }
 
-static inline void remove_hash(struct stripe_head *sh)
-{
-	pr_debug("remove_hash(), stripe %llu\n",
-		(unsigned long long)sh->sector);
 
-	hlist_del_init(&sh->hash);
-}
-
-static inline void insert_hash(struct r5conf *conf, struct stripe_head *sh)
-{
-	struct hlist_head *hp = stripe_hash(conf, sh->sector);
-
-	pr_debug("insert_hash(), stripe %llu\n",
-		(unsigned long long)sh->sector);
-
-	hlist_add_head(&sh->hash, hp);
-}
 
 
 /* find an idle stripe, make sure it is unhashed, and return it. */
-- 
1.7.9.5
\x02

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-08-22  5:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-18  2:53 raid5: When add stripe_head to inactive_list, it should remove hash Jianpeng Ma
2012-08-20  8:17 ` Jianpeng Ma
2012-08-20 17:51   ` Dan Williams
2012-08-21  3:14     ` Jianpeng Ma
2012-08-21 16:43       ` Dan Williams
2012-08-22  1:25         ` kedacomkernel
2012-08-22  5:30           ` Jiang, Dave

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).