All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jianpeng Ma" <majianpeng@gmail.com>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: raid5: When add stripe_head to inactive_list, it should remove hash.
Date: Mon, 20 Aug 2012 16:17:07 +0800	[thread overview]
Message-ID: <201208201617046561993@gmail.com> (raw)
In-Reply-To: 201208181053324376710@gmail.com

On 2012-08-18 10:53 Jianpeng Ma <majianpeng@gmail.com> Wrote:
>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
>
Hi neil:
	Today, i found a problem about this.
1:mdadm -CR /dev/md0 -l5 -c4 -n4 /dev/sd[bcd] missing
2:dd if=/dev/zero of=/dev/md0 bs=4K count=1 oflag=direct
3:hdparm --make-bad-sector 2048 --yes-i-know-what-i-am-doing /dev/sdb
  (2048 is the data-offset of sdb)
4:dd if=/dev/md0 of=/dev/zero bs=4K count=1 iflag=direct

I think step4 maybe return ioerror.But it's success.
The kernel message like :
[19277.581245] ata3.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0
[19277.581250] ata3.00: irq_stat 0x40000008
[19277.581253] ata3.00: failed command: READ FPDMA QUEUED
[19277.581260] ata3.00: cmd 60/08:00:00:08:00/00:00:00:00:00/40 tag 0 ncq 4096 in
[19277.581260]          res 41/40:08:00:08:00/00:00:00:00:00/00 Emask 0x409 (media error) <F>
[19277.581263] ata3.00: status: { DRDY ERR }
[19277.581265] ata3.00: error: { UNC }
[19277.585809] ata3.00: configured for UDMA/133
[19277.585828] sd 2:0:0:0: \x010[sdb] Unhandled sense code
[19277.585831] sd 2:0:0:0: \x010[sdb]  
[19277.585833] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[19277.585835] sd 2:0:0:0: \x010[sdb]  
[19277.585837] Sense Key : Medium Error [current] [descriptor]
[19277.585842] Descriptor sense data with sense descriptors (in hex):
[19277.585844]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00 
[19277.585856]         00 00 08 00 
[19277.585862] sd 2:0:0:0: \x010[sdb]  
[19277.585864] Add. Sense: Unrecovered read error - auto reallocate failed
[19277.585867] sd 2:0:0:0: \x010[sdb] CDB: 
[19277.585869] Read(10): 28 00 00 00 08 00 00 00 08 00
[19277.585879] end_request: I/O error, dev sdb, sector 2048
[19277.585889] raid5_align_endio : io error...handing IO for a retry
[19277.585901] +++ raid5d active
[19277.585906] get_stripe, sector 0
[19277.585908] __find_stripe, sector 0
[19277.585911] adding bi b#0 to stripe s#0
[19277.585914] added bi b#0 to stripe s#0, disk 0.
[19277.585918] handling stripe 0, state=0x1091 cnt=1, pd_idx=3, qd_idx=-1
[19277.585918] , check:0, reconstruct:0
[19277.585922] check 3: state 0x1 read           (null) write           (null) written           (null)
[19277.585925] check 2: state 0x11 read           (null) write           (null) written           (null)
[19277.585927] ata3: EH complete
[19277.585930] check 1: state 0x11 read           (null) write           (null) written           (null)
[19277.585933] check 0: state 0x119 read ffff8800b69cd900 write           (null) written           (null)
[19277.585936] locked=0 uptodate=4 to_read=0 to_write=0 failed=1 failed_num=3,-1
[19277.585939] ops_run_biofill: stripe 0
[19277.585944] ops_complete_biofill: stripe 0
[19277.585955] __get_priority_stripe: handle: busy hold: empty full_writes: 0 bypass_count: 0
[19277.585958] __get_priority_stripe: handle: empty hold: empty full_writes: 0 bypass_count: 0
[19277.585961] handling stripe 0, state=0x1091 cnt=1, pd_idx=3, qd_idx=-1
[19277.585961] , check:0, reconstruct:0
[19277.585964] check 3: state 0x1 read           (null) write           (null) written           (null)
[19277.585967] check 2: state 0x11 read           (null) write           (null) written           (null)
[19277.585969] check 1: state 0x11 read           (null) write           (null) written           (null)
[19277.585972] check 0: state 0x119 read           (null) write           (null) written           (null)
[19277.585975] locked=0 uptodate=4 to_read=0 to_write=0 failed=1 failed_num=3,-1
[19277.585979] __get_priority_stripe: handle: empty hold: empty full_writes: 0 bypass_count: 0
[19277.585981] 2 stripes handled
[19277.585983] --- raid5d inactive
[19277.585984] +++ raid5d active
[19277.585987] __get_priority_stripe: handle: empty hold: empty full_writes: 0 bypass_count: 0
[19277.585989] 0 stripes handled
[19277.585991] --- raid5d inactive

  reply	other threads:[~2012-08-20  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=201208201617046561993@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.