From: Hannes Reinecke <hare@suse.de>
To: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Cc: device-mapper development <dm-devel@redhat.com>
Subject: Re: [PATCH 0/8] dm: request-based dm-multipath
Date: Tue, 10 Mar 2009 08:17:18 +0100 [thread overview]
Message-ID: <49B613FE.3060501@suse.de> (raw)
In-Reply-To: <49B60444.2090008@ct.jp.nec.com>
[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]
Hi Kiyoshi,
Kiyoshi Ueda wrote:
> Hi Hannes,
>
> On 2009/01/30 17:05 +0900, Kiyoshi Ueda wrote:
>>>> o kernel panic occurs by frequent table swapping during heavy I/Os.
>>>>
>>> That's probably fixed by this patch:
>>>
>>> --- linux-2.6.27/drivers/md/dm.c.orig 2009-01-23 15:59:22.741461315 +0100
>>> +++ linux-2.6.27/drivers/md/dm.c 2009-01-26 09:03:02.787605723 +0100
>>> @@ -714,13 +714,14 @@ static void free_bio_clone(struct reques
>>> struct dm_rq_target_io *tio = clone->end_io_data;
>>> struct mapped_device *md = tio->md;
>>> struct bio *bio;
>>> - struct dm_clone_bio_info *info;
>>>
>>> while ((bio = clone->bio) != NULL) {
>>> clone->bio = bio->bi_next;
>>>
>>> - info = bio->bi_private;
>>> - free_bio_info(md, info);
>>> + if (bio->bi_private) {
>>> + struct dm_clone_bio_info *info = bio->bi_private;
>>> + free_bio_info(md, info);
>>> + }
>>>
>>> bio->bi_private = md->bs;
>>> bio_put(bio);
>>>
>>> The info field is not necessarily filled here, so we have to check for it
>>> explicitly.
>>>
>>> With these two patches request-based multipathing have survived all stress-tests
>>> so far. Except on mainframe (zfcp), but that's more a driver-related thing.
>
> My problem was different from that one, and I have fixed my problem.
>
What was this? Was is something specific to your setup or some within the
request-based multipathing code?
If the latter, I'd be _very_ much interested in seeing the patch. Naturally.
> Do you hit some problem without the patch above?
> If so, that should be a programming bug and we need to fix it. Otherwise,
> we should be leaking a memory (since all cloned bio should always have
> the dm_clone_bio_info structure in ->bi_private).
>
Yes, I've found that one later on.
The real problem was in clone_setup_bios(), which might end up calling an
invalid end_io_data pointer. Patch is attached.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
[-- Attachment #2: dm-use-md-for-free_bio_clone --]
[-- Type: text/plain, Size: 2149 bytes --]
From: Hannes Reinecke <hare@suse.de>
Subject: Kernel oops in free_bio_clone()
References: bnc#472360
Bug is here:
static int setup_clone(struct request *clone, struct request *rq,
struct dm_rq_target_io *tio)
{
int r;
blk_rq_init(NULL, clone);
r = clone_request_bios(clone, rq, tio->md);
if (r)
return r;
copy_request_info(clone, rq);
clone->start_time = jiffies;
clone->end_io = end_clone_request;
clone->end_io_data = tio;
return 0;
}
clone_request_bios() might end up calling free_bio_clone(), which references:
static void free_bio_clone(struct request *clone)
{
struct dm_rq_target_io *tio = clone->end_io_data;
struct mapped_device *md = tio->md;
...
but end_io_data will be set only _after_ the call to clone_request_bios().
So we should be passing the 'md' argument directly here to avoid this
bug and several pointless derefencings.
Signed-off-by: Hannes Reinecke <hare@suse.de>
--- linux-2.6.27-SLE11_BRANCH/drivers/md/dm.c.orig 2009-02-04 10:33:22.656627650 +0100
+++ linux-2.6.27-SLE11_BRANCH/drivers/md/dm.c 2009-02-05 11:03:35.843251773 +0100
@@ -709,10 +709,8 @@ static void end_clone_bio(struct bio *cl
blk_update_request(tio->orig, 0, nr_bytes);
}
-static void free_bio_clone(struct request *clone)
+static void free_bio_clone(struct request *clone, struct mapped_device *md)
{
- struct dm_rq_target_io *tio = clone->end_io_data;
- struct mapped_device *md = tio->md;
struct bio *bio;
while ((bio = clone->bio) != NULL) {
@@ -743,7 +741,7 @@ static void dm_unprep_request(struct req
rq->special = NULL;
rq->cmd_flags &= ~REQ_DONTPREP;
- free_bio_clone(clone);
+ free_bio_clone(clone, tio->md);
dec_rq_pending(tio);
free_rq_tio(tio->md, tio);
}
@@ -820,7 +818,7 @@ static void dm_end_request(struct reques
rq->sense_len = clone->sense_len;
}
- free_bio_clone(clone);
+ free_bio_clone(clone, tio->md);
dec_rq_pending(tio);
free_rq_tio(tio->md, tio);
@@ -1406,7 +1404,7 @@ static int clone_request_bios(struct req
return 0;
free_and_out:
- free_bio_clone(clone);
+ free_bio_clone(clone, md);
return -ENOMEM;
}
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2009-03-10 7:17 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-03 15:08 [PATCH 0/8] dm: request-based dm-multipath Kiyoshi Ueda
2008-10-03 15:09 ` [PATCH 1/8] dm core: remove unused DM_WQ_FLUSH_ALL Kiyoshi Ueda
2008-10-03 15:09 ` Kiyoshi Ueda
2008-10-03 15:10 ` [PATCH 2/8] dm core: tidy local_init Kiyoshi Ueda
2008-10-03 15:17 ` [PATCH 3/8] dm core: add kmem_cache for request-based dm Kiyoshi Ueda
2008-10-03 15:18 ` [PATCH 4/8] dm core: add target interfaces " Kiyoshi Ueda
2008-10-03 15:18 ` Kiyoshi Ueda
2008-10-03 15:18 ` [PATCH 5/8] dm core: add core functions " Kiyoshi Ueda
2008-10-03 15:18 ` Kiyoshi Ueda
2008-10-03 15:19 ` [PATCH 6/8] dm core: enable " Kiyoshi Ueda
2008-10-03 15:19 ` Kiyoshi Ueda
2008-10-03 15:19 ` [PATCH 7/8] dm core: reject I/O violating new queue limits Kiyoshi Ueda
2008-10-03 15:19 ` Kiyoshi Ueda
2008-10-03 15:19 ` [PATCH 8/8] dm-mpath: convert to request-based Kiyoshi Ueda
2008-10-03 15:19 ` Kiyoshi Ueda
2009-01-28 15:40 ` [PATCH 0/8] dm: request-based dm-multipath Alasdair G Kergon
2009-01-29 7:18 ` Kiyoshi Ueda
2009-01-29 10:41 ` Hannes Reinecke
2009-01-29 14:32 ` Alasdair G Kergon
2009-01-30 8:05 ` Kiyoshi Ueda
2009-03-10 6:10 ` Kiyoshi Ueda
2009-03-10 7:17 ` Hannes Reinecke [this message]
2009-03-10 8:17 ` Kiyoshi Ueda
2009-03-11 12:28 ` Hannes Reinecke
2009-03-12 1:40 ` Kiyoshi Ueda
2009-03-12 8:58 ` Kiyoshi Ueda
2009-03-12 9:08 ` Hannes Reinecke
2009-03-13 1:03 ` Kiyoshi Ueda
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=49B613FE.3060501@suse.de \
--to=hare@suse.de \
--cc=dm-devel@redhat.com \
--cc=k-ueda@ct.jp.nec.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.