From: "NeilBrown" <neilb@suse.de>
To: "Xiao Ni" <xni@redhat.com>
Cc: "Jes Sorensen" <jes@trained-monkey.org>,
"Mariusz Tkaczyk" <mariusz.tkaczyk@linux.intel.com>,
"Song Liu" <song@kernel.org>,
"Linux regressions mailing list" <regressions@lists.linux.dev>,
"linux-raid" <linux-raid@vger.kernel.org>,
"LKML" <linux-kernel@vger.kernel.org>,
"Nikolay Kichukov" <hijacker@oldum.net>
Subject: Re: [PATCH - mdadm] mdopen: always try create_named_array()
Date: Thu, 30 Mar 2023 14:15:30 +1100 [thread overview]
Message-ID: <168014613094.14629.7292916705339147692@noble.neil.brown.name> (raw)
In-Reply-To: <CALTww28X1NQecTY3Jbkz_wbHc_N7GOw3hJLEyb2YnxAmQ8PRFw@mail.gmail.com>
On Thu, 30 Mar 2023, Xiao Ni wrote:
> On Thu, Mar 30, 2023 at 5:52 AM NeilBrown <neilb@suse.de> wrote:
> >
> > On Wed, 22 Mar 2023, NeilBrown wrote:
> > > On Wed, 22 Mar 2023, Xiao Ni wrote:
> > >
> > > >
> > > > Second, are there possibilities that the arguments "dev" and "name" of
> > > > function create_mddev
> > > > are null at the same time?
> > >
> > > No. For Build or Create, dev is never NULL. For Assemble and
> > > Incremental, name is never NULL.
> > >
> >
> > I should clarify this a bit. For Assemble and Incremental, "name" is
> > never NULL *but* it might be an empty string.
> > So:
> > if (name && name[0] == 0)
> > name = NULL;
> >
> > might cause it to become NULL. So you cannot assume there is always
> > either a valid "dev" or a valid "name". "dev" might be NULL, and "name"
> > might be "".
> >
> > NeilBrown
> >
>
> Hi Neil
>
> The input argument name should be the metadata name. For incremental
> and assemble, why are there possibilities that the metadata name is
> invalid? A raid device should have a valid metadata name, right?
"should" do, yes. But you can never completely trust data on disk. It
is safest to be prepared for "name" being "".
NeilBrown
next prev parent reply other threads:[~2023-03-30 3:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 0:06 [PATCH - mdadm] mdopen: always try create_named_array() NeilBrown
2023-03-14 9:11 ` Mariusz Tkaczyk
2023-03-19 16:36 ` Jes Sorensen
2023-03-19 22:09 ` NeilBrown
2023-03-20 17:15 ` Jes Sorensen
2023-03-21 8:49 ` Mariusz Tkaczyk
2023-03-22 3:00 ` Xiao Ni
2023-03-22 3:24 ` NeilBrown
2023-03-22 6:51 ` Mariusz Tkaczyk
2023-03-23 2:09 ` Xiao Ni
2023-03-29 21:51 ` NeilBrown
2023-03-30 0:10 ` Xiao Ni
2023-03-30 3:15 ` NeilBrown [this message]
2023-03-30 4:55 ` Xiao Ni
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=168014613094.14629.7292916705339147692@noble.neil.brown.name \
--to=neilb@suse.de \
--cc=hijacker@oldum.net \
--cc=jes@trained-monkey.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=mariusz.tkaczyk@linux.intel.com \
--cc=regressions@lists.linux.dev \
--cc=song@kernel.org \
--cc=xni@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 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).