From: Takahiro Yasui <tyasui@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: Re: [RFC][PATCH] dm-mirror: fix data corruption
Date: Sun, 12 Jul 2009 21:07:58 -0400 [thread overview]
Message-ID: <4A5A88EE.8090707@redhat.com> (raw)
In-Reply-To: <20090710194516.GA10646@us.ibm.com>
malahal@us.ibm.com wrote:
> Takahiro Yasui [tyasui@redhat.com] wrote:
>> On 07/10/09 09:49, Mikulas Patocka wrote:
>>> patch to hold back bios --- untested (and not quite optimal because it
>>> scans the "failures" list in fixed intervals), but it shows the approach.
>>>
>>> ---
>>> drivers/md/dm-raid1.c | 10 +++++++---
>>> drivers/md/dm-region-hash.c | 6 +-----
>>> include/linux/dm-region-hash.h | 3 +--
>>> 3 files changed, 9 insertions(+), 10 deletions(-)
>>>
>>> Index: linux-2.6.31-rc2-devel/drivers/md/dm-raid1.c
>>> ===================================================================
>>> --- linux-2.6.31-rc2-devel.orig/drivers/md/dm-raid1.c 2009-07-10 14:48:19.000000000 +0200
>>> +++ linux-2.6.31-rc2-devel/drivers/md/dm-raid1.c 2009-07-10 15:46:11.000000000 +0200
>>> @@ -535,11 +535,11 @@ static void write_callback(unsigned long
>>> else
>>> uptodate = 1;
>>>
>>> - if (unlikely(!uptodate)) {
>>> + if (unlikely(!uptodate) || !errors_handled(ms)) {
>>> DMERR("All replicated volumes dead, failing I/O");
>>> /* None of the writes succeeded, fail the I/O. */
>>> ret = -EIO;
>>> - } else if (errors_handled(ms)) {
>>> + } else {
>>> /*
>>> * Need to raise event. Since raising
>>> * events can block, we need to do it in
>>> @@ -687,8 +687,12 @@ static void do_failures(struct mirror_se
>>> if (!ms->log_failure) {
>>> while ((bio = bio_list_pop(failures))) {
>>> ms->in_sync = 0;
>>> - dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0);
>>> + dm_rh_mark_nosync(ms->rh, bio);
>>> + spin_lock_irq(&ms->lock);
>>> + bio_list_add(&ms->failures, bio);
>>> + spin_unlock_irq(&ms->lock);
>>> }
>>> + delayed_wake(ms);
>>> return;
>>> }
>>>
>>> Index: linux-2.6.31-rc2-devel/drivers/md/dm-region-hash.c
>>> ===================================================================
>>> --- linux-2.6.31-rc2-devel.orig/drivers/md/dm-region-hash.c 2009-07-10 14:54:07.000000000 +0200
>>> +++ linux-2.6.31-rc2-devel/drivers/md/dm-region-hash.c 2009-07-10 15:45:07.000000000 +0200
>>> @@ -392,8 +392,6 @@ static void complete_resync_work(struct
>>> /* dm_rh_mark_nosync
>>> * @ms
>>> * @bio
>>> - * @done
>>> - * @error
>>> *
>>> * The bio was written on some mirror(s) but failed on other mirror(s).
>>> * We can successfully endio the bio but should avoid the region being
>>> @@ -401,8 +399,7 @@ static void complete_resync_work(struct
>>> *
>>> * This function is _not_ safe in interrupt context!
>>> */
>>> -void dm_rh_mark_nosync(struct dm_region_hash *rh,
>>> - struct bio *bio, unsigned done, int error)
>>> +void dm_rh_mark_nosync(struct dm_region_hash *rh, struct bio *bio)
>>> {
>>> unsigned long flags;
>>> struct dm_dirty_log *log = rh->log;
>>> @@ -439,7 +436,6 @@ void dm_rh_mark_nosync(struct dm_region_
>>> BUG_ON(!list_empty(®->list));
>>> spin_unlock_irqrestore(&rh->region_lock, flags);
>>>
>>> - bio_endio(bio, error);
>> How do bios queued in ms->failures are processed later? It seems that
>> the bios stay in ms->failures forever, and the upper layer can not
>> receive "success" for those bios. Don't we need a mechanism to block/unblock
>> write bios to fix this issue?
>
> A user level program, dmeventd, may reconfigure the mirror resulting in
> submitting the queued I/O's after the reconfiguration.
In that case, don't we need codes to release bios when the mirror is
destroyed?
In addition, not only bios for failed write I/Os but also bios sent to
out-of-sync regions need to be blocked. Bios sent to out-of-sync regions
are processed by generic_make_request() and would return the "success"
to upper layer without dm-raid1 notices it.
Thanks,
Taka
next prev parent reply other threads:[~2009-07-13 1:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-09 23:54 [RFC][PATCH] dm-mirror: fix data corruption Takahiro Yasui
2009-07-10 11:16 ` Jun'ichi Nomura
2009-07-10 19:14 ` Takahiro Yasui
2009-07-10 13:44 ` Mikulas Patocka
2009-07-10 13:49 ` Mikulas Patocka
2009-07-10 19:04 ` Takahiro Yasui
2009-07-10 19:45 ` malahal
2009-07-13 1:07 ` Takahiro Yasui [this message]
2009-07-13 9:50 ` Mikulas Patocka
2009-08-30 19:24 ` malahal
2009-08-31 21:39 ` Mikulas Patocka
2009-09-09 20:18 ` Takahiro Yasui
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=4A5A88EE.8090707@redhat.com \
--to=tyasui@redhat.com \
--cc=dm-devel@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox