From: NeilBrown <neilb@suse.de>
To: Jianpeng Ma <majianpeng@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH] raid5: fix possible oops in add_stripe_bio when enable pr_debug
Date: Thu, 20 Sep 2012 16:47:44 +1000 [thread overview]
Message-ID: <20120920164744.1aab090c@notabene.brown> (raw)
In-Reply-To: <2012092014334148441317@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]
On Thu, 20 Sep 2012 14:34:00 +0800 "Jianpeng Ma" <majianpeng@gmail.com> wrote:
> In func add_stripe_bio:
> >> .....
> >> bip = &sh->dev[dd_idx].toread;
> >> ......
> >>spin_unlock_irq(&sh->stripe_lock);
>
> >> pr_debug("added bi b#%llu to stripe s#%llu, disk %d.\n",
> >> (unsigned long long)(*bip)->bi_sector,
> >> (unsigned long long)sh->sector, dd_idx);
> After spin_unlock_irq, this thread scheded and toread may become null.
> So it will be oops.
>
> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
> ---
> drivers/md/raid5.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index adda94d..f172b1e 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -2356,6 +2356,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in
> struct bio **bip;
> struct r5conf *conf = sh->raid_conf;
> int firstwrite=0;
> + sector_t sector = bi->bi_sector;
>
> pr_debug("adding bi b#%llu to stripe s#%llu\n",
> (unsigned long long)bi->bi_sector,
> @@ -2406,7 +2407,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in
> spin_unlock_irq(&sh->stripe_lock);
>
> pr_debug("added bi b#%llu to stripe s#%llu, disk %d.\n",
> - (unsigned long long)(*bip)->bi_sector,
> + (unsigned long long)sector,
> (unsigned long long)sh->sector, dd_idx);
>
> if (conf->mddev->bitmap && firstwrite) {
how about we just move the spin_unlock_irq after the pr_debug??
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2012-09-20 6:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-20 6:34 [PATCH] raid5: fix possible oops in add_stripe_bio when enable pr_debug Jianpeng Ma
2012-09-20 6:47 ` NeilBrown [this message]
2012-09-20 7:17 ` Jianpeng Ma
2012-09-25 6:45 ` NeilBrown
2012-09-25 6:50 ` Jianpeng Ma
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=20120920164744.1aab090c@notabene.brown \
--to=neilb@suse.de \
--cc=linux-raid@vger.kernel.org \
--cc=majianpeng@gmail.com \
/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.