All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Song Liu <songliubraving@fb.com>
Cc: linux-raid <linux-raid@vger.kernel.org>, Shaohua Li <shli@fb.com>,
	Kernel Team <Kernel-team@fb.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Christoph Hellwig <hch@infradead.org>,
	"jes.sorensen@gmail.com" <jes.sorensen@gmail.com>
Subject: Re: [PATCH] mdadm: handle super == NULL case in avail_size1
Date: Fri, 01 Sep 2017 10:21:59 +1000	[thread overview]
Message-ID: <87r2vre09k.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <C170566B-A2B7-4220-9C61-D08DDE5E7E4A@fb.com>

[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]

On Thu, Aug 31 2017, Song Liu wrote:

>> On Aug 31, 2017, at 4:36 PM, NeilBrown <neilb@suse.com> wrote:
>> 
>> On Thu, Aug 31 2017, Song Liu wrote:
>> 
>>> Summary:
>>> 
>>> Handling super == NULL case in avail_size1() was removed a while
>>> back. However, it is still useful in the following stack:
>>> 
>>> avail_size1() with st->sb == NULL
>>> array_try_spare() with st == NULL
>>> try_spare() with st == NULL
>>> Incremental() with st == NULL
>> 
>> I assume you mean "st->sb == NULL" in each case here?  What you have
>> written doesn't make sense.
>> 
>
> I did mean st == NULL. In array_try_spare(), if st is NULL, st2 is 
> allocated with match_metadata_desc(), and avail_size() is called with
> st2. 

Ahhh, OK.  But if st isn't NULL I think the problem still exists as when
an st is passed to try_spare() it doesn't have an st->sb.

>
>>> 
>>> This patch adds the handling of super == NULL back to avail_size1().
>> 
>> I doubt this is the best thing to do.
>> If we don't have st->sb, calling avail_size doesn't make any sense.
>> Maybe we should be calling validate_geometry.
>> 
>
> This was the same logic that got removed a few years ago. So far it 
> works for my use cases. And I think it makes (some) sense. 
> Is validate_geometry() really better than this approach?

validate_geometry is better because it doesn't expect 'sb' to be set.
The documentation for avail_size says:

	 * 'mdadm' only calls this for existing arrays where a possible
	 * spare is being added.

In the try_spare() case there is no existing array.  Rather, try_spare()
is checking if a particular geometry is valid.

It is rather sad that this auto-sparing functionality has been broken
for 4 years and no-one noticed until now.  I really should have created
some self-tests....

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

      reply	other threads:[~2017-09-01  0:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31 17:37 [PATCH] mdadm: handle super == NULL case in avail_size1 Song Liu
2017-08-31 23:36 ` NeilBrown
2017-08-31 23:46   ` Song Liu
2017-09-01  0:21     ` NeilBrown [this message]

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=87r2vre09k.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=Kernel-team@fb.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@infradead.org \
    --cc=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=shli@fb.com \
    --cc=songliubraving@fb.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.