linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <jes.sorensen@gmail.com>
To: John Stoffel <john@stoffel.org>
Cc: Eli Ben-Shoshan <eli@benshoshan.com>, linux-raid@vger.kernel.org
Subject: Re: mdadm: Patch to restrict --size when shrinking unless forced
Date: Wed, 4 Oct 2017 15:23:00 -0400	[thread overview]
Message-ID: <de82859a-a7dc-a8d6-6ce2-52e7b1163b99@gmail.com> (raw)
In-Reply-To: <22997.13125.28017.852313@quad.stoffel.home>

On 10/04/2017 03:15 PM, John Stoffel wrote:
>>>>>> "Jes" == Jes Sorensen <jes.sorensen@gmail.com> writes:
> 
> Jes> On 10/04/2017 02:00 PM, John Stoffel wrote:
>>>
>>> Since Eli had such a horrible experience where he shrunk the
>>> individual component raid device size, instead of growing the overall
>>> raid by adding a device, I came up with this hacky patch to warn you
>>> when you are about to shoot yourself in the foot.
>>>
>>> The idea is it will warn you and exit unless you pass in the --force
>>> (or -f) switch when using the command.  For example, on a set of loop
>>> devices:
>>>
>>> # cat /proc/mdstat
>>> Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5]
>>> [raid4] [multipath] [faulty]
>>> md99 : active raid6 loop4p1[4] loop3p1[3] loop2p1[2] loop1p1[1]
>>> loop0p1[0]
>>> 606720 blocks super 1.2 level 6, 512k chunk, algorithm 2 [5/5]
>>> [UUUUU]
>>>
>>> # ./mdadm --grow /dev/md99 --size 128
>>> mdadm: Cannot set device size smaller than current component_size of /dev/md99 array.  Use -f to force change.
>>>
>>> # ./mdadm --grow /dev/md99 --size 128 -f
>>> mdadm: component size of /dev/md99 has been set to 0K
>>>
>>>
>>> I suspect I could do a better job of showing the original component
>>> size, so that you have a chance of recovering even then.
>>>
>>> But the patch:
> 
> Jes> Before looking at the actual code, some cosmetics
> 
> Sure, I'll re-spin the patch,  I have my emacs setup to use 4 spaces
> for indentation, not 8 space tabs.

mdadm follows Linux kernel rules, so (setq c-basic-offset 8) in .emacs

>>> @@ -1617,7 +1617,7 @@ int main(int argc, char *argv[])
>>> else if (s.size > 0 || s.raiddisks || s.layout_str ||
>>> s.chunk != 0 || s.level != UnSet ||
>>> data_offset != INVALID_SECTORS) {
>>> -			rv = Grow_reshape(devlist->devname, mdfd,
>>> +		    rv = Grow_reshape(devlist->devname, mdfd, c.force,
> 
> Jes> Yikes!
> 
> Can you explain please?  I added in the c.force since that's the value
> set by the -f (--force) flag when you call mdadm from the command
> line.

The broken indentation

Jes

  reply	other threads:[~2017-10-04 19:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 18:00 mdadm: Patch to restrict --size when shrinking unless forced John Stoffel
2017-10-04 18:11 ` Jes Sorensen
2017-10-04 19:15   ` John Stoffel
2017-10-04 19:23     ` Jes Sorensen [this message]
2017-10-04 19:33       ` John Stoffel
2017-10-04 21:50 ` NeilBrown
2017-10-05  1:26   ` John Stoffel
2017-10-07 22:06     ` Wols Lists
2017-10-07 22:17       ` John Stoffel
2017-10-07 22:37         ` Wols Lists
2017-10-07 22:46           ` John Stoffel
2017-10-08 20:57   ` John Stoffel
2017-10-08 22:52     ` NeilBrown
2017-10-09  1:18       ` John Stoffel
2017-10-09  1:36         ` NeilBrown
2017-10-09  1:22       ` John Stoffel
2017-10-09  4:10         ` NeilBrown
2017-10-09 20:04           ` Phil Turmel
2017-10-10  0:07             ` Wakko Warner
2017-10-10 13:12               ` Phil Turmel
2017-10-10 20:52               ` NeilBrown
2017-10-10 20:55                 ` Wakko Warner
2017-10-10  2:01             ` John Stoffel
2017-10-10 20:09             ` Jes Sorensen
2017-10-10 20:54               ` Wols Lists
2017-10-10 21:07                 ` Jes Sorensen
2017-10-10 20:48             ` NeilBrown
2017-10-10 20:58               ` Phil Turmel

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=de82859a-a7dc-a8d6-6ce2-52e7b1163b99@gmail.com \
    --to=jes.sorensen@gmail.com \
    --cc=eli@benshoshan.com \
    --cc=john@stoffel.org \
    --cc=linux-raid@vger.kernel.org \
    /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).