]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
The way ZFS searches for its vdevs is the following: first it looks for
authorPawel Jakub Dawidek <pjd@FreeBSD.org>
Tue, 19 Feb 2019 23:35:55 +0000 (23:35 +0000)
committerPawel Jakub Dawidek <pjd@FreeBSD.org>
Tue, 19 Feb 2019 23:35:55 +0000 (23:35 +0000)
commit11c875933712fa6c00b2896ade2c3f02a4d4e063
tree5dc4df5677da4fb4f31d111e95370b815d9c6829
parent827e6ec07d1445b169aef0fce8fc77718c454fbd
The way ZFS searches for its vdevs is the following: first it looks for
a vdev that has the same name as the one stored in metadata and that has
all VDEV labels in place. If it cannot find a GEOM provider with the given
name and all VDEV labels it will scan all GEOM providers for the best match
(the most VDEV labels available), but here the name is ignored.

In case the ZFS pool is created, eg. using GPT partition label:

# zpool create tank /dev/gpt/tank

everything works, and on every import ZFS will pick /dev/gpt/tank and
not /dev/da0p4.

The problem occurs when da0p4 is extended and ZFS is unable to find all
VDEV labels in /dev/gpt/tank anymore (the VDEV labels stored at the end
of the partition are now somewhere else). In this case it will scan all
GEOM providers and will pick the first one with the best match, ie. da0p4.

Fix this problem by checking the VDEV/provider name even if we get the same
match. If the name is the same as the one we have in pool's metadata, prefer
this GEOM provider.

Reported by: oshogbo, Michal Mroz <m.mroz@fudosecurity.com>
Tested by: Michal Mroz <m.mroz@fudosecurity.com>
Obtained from: Fudo Security
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c