All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinz Mauelshagen <heinzm@redhat.com>
To: dm-devel@redhat.com
Cc: snitzer@redhat.com
Subject: [PATCH V2 03/12] dm raid: correct resizing state in ctr
Date: Sat,  2 Dec 2017 01:03:50 +0100	[thread overview]
Message-ID: <1b14555791be3e01ead8b0baa21b5a862f04c382.1512171097.git.heinzm@redhat.com> (raw)
In-Reply-To: <cover.1512171097.git.heinzm@redhat.com>
In-Reply-To: <cover.1512171097.git.heinzm@redhat.com>

Pay attention to existing reshape space to define
if a raid set needs resizing or we can hit
"Can't resize a reshaping raid set"
when a reshape is being requested.
---
 drivers/md/dm-raid.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 5f099d1f7ccc..ec28a6cf1bf8 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -2969,10 +2969,10 @@ static void configure_discard_support(struct raid_set *rs)
 static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 {
 	int r;
-	bool resize;
+	bool resize = false;
 	struct raid_type *rt;
 	unsigned int num_raid_params, num_raid_devs;
-	sector_t calculated_dev_sectors, rdev_sectors;
+	sector_t calculated_dev_sectors, rdev_sectors, reshape_sectors;
 	struct raid_set *rs = NULL;
 	const char *arg;
 	struct rs_layout rs_layout;
@@ -3055,7 +3055,10 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		goto bad;
 	}
 
-	resize = calculated_dev_sectors != rdev_sectors;
+
+	reshape_sectors = _get_reshape_sectors(rs);
+	if (calculated_dev_sectors != rdev_sectors)
+		resize = calculated_dev_sectors != (reshape_sectors ? rdev_sectors - reshape_sectors : rdev_sectors);
 
 	INIT_WORK(&rs->md.event_work, do_table_event);
 	ti->private = rs;
@@ -3178,7 +3181,6 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	mddev_lock_nointr(&rs->md);
 	r = md_run(&rs->md);
 	rs->md.in_sync = 0; /* Assume already marked dirty */
-
 	if (r) {
 		ti->error = "Failed to run raid array";
 		mddev_unlock(&rs->md);
-- 
2.13.6

  parent reply	other threads:[~2017-12-02  0:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-02  0:03 [PATCH V2 00/12] dm raid: fix deadlocks and sync ratio races Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 01/12] dm raid: fix deadlock caused by stopped writes Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 02/12] dm raid: correct sizes and check of component devices Heinz Mauelshagen
2017-12-02  0:03 ` Heinz Mauelshagen [this message]
2017-12-02  0:03 ` [PATCH V2 04/12] dm raid: correct raid set size revalidation Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 05/12] dm raid: enhance resume() frozen checks Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 06/12] dm raid: close MD recovery flags race window Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 07/12] dm raid: avoid array_in_sync variable Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 08/12] dm raid: fix rs_get_progress() synchronization state/ratio Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 09/12] dm raid: group rw and in_sync definitions with mddev_resume() Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 10/12] dm raid: remove unused "struct raid_set" member Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 11/12] dm raid: comments Heinz Mauelshagen
2017-12-02  0:03 ` [PATCH V2 12/12] dm raid: add component device size check Heinz Mauelshagen

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=1b14555791be3e01ead8b0baa21b5a862f04c382.1512171097.git.heinzm@redhat.com \
    --to=heinzm@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=snitzer@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 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.