linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Webb <chris@arachsys.com>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH] md: Fix rdev_size_store with size = 0
Date: Wed, 17 Sep 2008 19:11:48 +0100	[thread overview]
Message-ID: <20080917181148.GE11527@arachsys.com> (raw)
In-Reply-To: <20080624231947.GG9948@arachsys.com>

Hi Neil. You accepted a patch from me back at the end of June which allowed
/sys/block/mdX/md/rdY/size to change on running arrays. It supported a value
of zero to fill all the space on the underlying device. However, a later
patch tidying up rdev_size_store broke the size = 0 functionality by testing
for size < my_mddev->size slightly too early. The following patch fixes
this.

Best wishes,

Chris.


From: Chris Webb <chris@arachsys.com>

Fix rdev_size_store with size = 0

Signed-off-by: Chris Webb <chris@arachsys.com>

diff --git a/drivers/md/md.c b/drivers/md/md.c
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2109,8 +2109,6 @@
 
 	if (strict_strtoull(buf, 10, &size) < 0)
 		return -EINVAL;
-	if (size < my_mddev->size)
-		return -EINVAL;
 	if (my_mddev->pers && rdev->raid_disk >= 0) {
 		if (my_mddev->persistent) {
 			size = super_types[my_mddev->major_version].
@@ -2121,9 +2119,9 @@
 			size = (rdev->bdev->bd_inode->i_size >> 10);
 			size -= rdev->data_offset/2;
 		}
-		if (size < my_mddev->size)
-			return -EINVAL; /* component must fit device */
-	}
+	}
+	if (size < my_mddev->size)
+		return -EINVAL; /* component must fit device */
 
 	rdev->size = size;
 	if (size > oldsize && my_mddev->external) {

  reply	other threads:[~2008-09-17 18:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18 18:26 Trouble increasing md component size Chris Webb
2008-06-18 19:22 ` Peter Rabbitson
2008-06-18 20:00   ` Chris Webb
2008-06-19  3:42     ` Neil Brown
2008-06-19 15:45       ` Chris Webb
2008-06-19 23:10         ` Chris Webb
2008-06-19 23:49         ` Chris Webb
2008-06-20 11:13           ` Chris Webb
2008-06-20 14:24             ` Chris Webb
2008-06-23  1:26               ` Neil Brown
2008-06-23 11:18                 ` Chris Webb
2008-06-23 22:53                   ` Neil Brown
2008-06-24 11:47                     ` Chris Webb
2008-06-24 23:19                       ` Chris Webb
2008-09-17 18:11                         ` Chris Webb [this message]
2008-10-07 12:40                         ` [Resend] [PATCH] md: Fix rdev_size_store with size = 0 Chris Webb
2008-10-13  0:54                           ` Neil Brown
2008-06-24  2:40                   ` Trouble increasing md component size Neil Brown

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=20080917181148.GE11527@arachsys.com \
    --to=chris@arachsys.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).