linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Brassow <jbrassow@redhat.com>
To: linux-raid@vger.kernel.org
Cc: neilb@suse.de, jbrassow@redhat.com
Subject: [PATCH] DM RAID: Fix for ineffective "sync" directive
Date: Thu, 23 Aug 2012 10:31:54 -0500	[thread overview]
Message-ID: <1345735914.25206.8.camel@f16> (raw)

Neil,

There are two ways I see to fix the problem of the "sync" table argument
not causing the array to re-sync.  We could set mddev->events to
UINT_MAX and force an mddev/bitmap event mismatch - causing the bitmap
code to set BITMAP_STALE itself.  Otherwise, we can do as I have below
and set BITMAP_STALE ourselves.  The real difference is whether this is
done before or after md_run().  The first solution can be done before
md_run(); the second cannot because the bitmap is allocated during
md_run().  Either solution works and correctly sets the bitmap to stale
before bitmap_load() is called.  So, rather than having to think about
issues that come with setting events to UINT_MAX, I chose to set the
bitmap stale after md_run().

 brassow

DM RAID: Fix for "sync" directive ineffectiveness

There are two table arguments that can be given to a DM RAID target that
control whether the array is forced to (re)synchronize or skip initialization:
"sync" and "nosync".  When "sync" is given, we set mddev->recovery_cp to 0
in order to cause the device to resynchronize.  This is insufficient if there
is a bitmap in use, because the array will simply look at the bitmap and see
that there is no recovery necessary.

Once md_run() is called and creates the bitmap, we set the bitmap as stale.
When the bitmap is loaded during the resume phase, a full resync will
result.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>

Index: linux-upstream/drivers/md/dm-raid.c
===================================================================
--- linux-upstream.orig/drivers/md/dm-raid.c
+++ linux-upstream/drivers/md/dm-raid.c
@@ -1123,6 +1123,10 @@ static int raid_ctr(struct dm_target *ti
 		ret = -EINVAL;
 		goto size_mismatch;
 	}
+
+	if (rs->print_flags & DMPF_SYNC)
+		set_bit(BITMAP_STALE, &(rs->md.bitmap->flags));
+
 	rs->callbacks.congested_fn = raid_is_congested;
 	dm_table_add_target_callbacks(ti->table, &rs->callbacks);
 



             reply	other threads:[~2012-08-23 15:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 15:31 Jonathan Brassow [this message]
2012-09-05  1:44 ` [PATCH] DM RAID: Fix for ineffective "sync" directive NeilBrown
2012-09-05 14:32   ` Brassow Jonathan
2012-09-10  7:11     ` NeilBrown
2012-09-14 18:48 ` [PATCH - v2] " Jonathan Brassow
2012-09-20  2:35   ` NeilBrown

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=1345735914.25206.8.camel@f16 \
    --to=jbrassow@redhat.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 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).