Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 May 2017 16:12:15 -0500
From:      "Eric A. Borisch" <eborisch@gmail.com>
To:        Paul Kraus <paul@kraus-haus.org>
Cc:        "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org>,  =?UTF-8?Q?Trond_Endrest=C3=B8l?= <Trond.Endrestol@fagskolen.gjovik.no>,  FreeBSD Stable <freebsd-stable@freebsd.org>
Subject:   Re: zpool imported twice with different names (was Re: Fwd: ZFS)
Message-ID:  <CAASnNnpXaXmRHi97Fo4wE_VLT39O50kOaa8WvMk00doxMfxFQQ@mail.gmail.com>
In-Reply-To: <2318D9EB-4271-42C8-AEDB-4BB86607BB3D@kraus-haus.org>
References:  <7c059678-4af4-f0c9-ff3b-c6266e02fb7a@gmx.com> <adf4ab9f-72f1-ed0f-fee2-82caba3af4a4@gmx.com> <ca7b47a7-7512-3cbb-d47b-6ef546dffd74@gmx.com> <alpine.BSF.2.21.1705160825130.40966@mail.fig.ol.no> <CAASnNnrwTuJkMG2p%2BcXoKVfRQKnA5NccRGodwNUdCyG5j-L_LA@mail.gmail.com> <2318D9EB-4271-42C8-AEDB-4BB86607BB3D@kraus-haus.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, May 16, 2017 at 8:53 PM, Paul Kraus <paul@kraus-haus.org> wrote:
>
>
> > On May 16, 2017, at 10:26 AM, Eric A. Borisch <eborisch@gmail.com>
wrote:
> >
> > On Tue, May 16, 2017 at 1:31 AM, Trond Endrest=C3=B8l <
> > Trond.Endrestol@fagskolen.gjovik.no> wrote:
> >
> >> I guess you had a /boot/zfs/zpool.cache file referring to the original
> >> zroot pool. Next, the kernel found the vega pool and didn't realise
> >> these two pools are the very same.
> >>
> >
> > Assuming this is the case, shouldn't it be fixed? A check while
importing
> > that the guid of the pool targeted for import is not in the set of
> > currently active guids would be worthwhile, but it -- apparently, if
this
> > is reproducible -- doesn't exist?
>
> When you use the -f (force) flag all bets are off. The assumption is that
you _know_ it is safe to import the zpool as commanded. In this case, it
was not.
>
> Many sysadmins I know have gotten into the sloppy (in my opinion) habit
of using the force option (for various things) all the time. The force
flag, whether it be on a zpool import or a kill -9 should be the last
resort when the non-forced command fails.


Short version:

It's not the -f causing the problem, it's the parsing and (double)
importing via /boot/zfs/zpool.cache that is.

Longer story:

I've been able to reproduce the issue, and if I delete the
/boot/zpool.cache file from the (alt rooted during live CD session) renamed
pool before rebooting into it, everything is fine.

So it is not the import with -f that is causing the problem here, it is the
following reboot when the zpool.cache file is parsed and ensuing
double-import. (As an aside, using the -f is required to import a pool last
used and not exported by another system, and is a common and documented use
case. If you look at the code, it turns on a the ZFS_IMPORT_ANY_HOST flag,
not an 'ignore all errors' state. There is a separate -F which is more
'force'-ish (turns on rewinding).)

This points to error checking while importing pools via the cache as one
immediate place to look, specifically to exclude processing of any GUIDs
already active on the system. A more general change to prevent importing
two pools with the same GUID is also worthwhile (IMHO) and would prevent it
the problem, too.

  - Eric



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAASnNnpXaXmRHi97Fo4wE_VLT39O50kOaa8WvMk00doxMfxFQQ>