[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <168014613094.14629.7292916705339147692@noble.neil.brown.name>
Date: Thu, 30 Mar 2023 14:15:30 +1100
From: "NeilBrown" <neilb@...e.de>
To: "Xiao Ni" <xni@...hat.com>
Cc: "Jes Sorensen" <jes@...ined-monkey.org>,
"Mariusz Tkaczyk" <mariusz.tkaczyk@...ux.intel.com>,
"Song Liu" <song@...nel.org>,
"Linux regressions mailing list" <regressions@...ts.linux.dev>,
"linux-raid" <linux-raid@...r.kernel.org>,
"LKML" <linux-kernel@...r.kernel.org>,
"Nikolay Kichukov" <hijacker@...um.net>
Subject: Re: [PATCH - mdadm] mdopen: always try create_named_array()
On Thu, 30 Mar 2023, Xiao Ni wrote:
> On Thu, Mar 30, 2023 at 5:52 AM NeilBrown <neilb@...e.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
Powered by blists - more mailing lists