Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2015 11:52:30 +0800
From:      Peter Xu <xzpeter@gmail.com>
To:        freebsd-fs@freebsd.org
Subject:   bugfix: zpool online might fail when disk suffix start with "c[0-9]"
Message-ID:  <CAGRNztAedmw6_CHvWKfWu0B0DeSRS_j5te9ZCJ=z_cHEatC-cw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi, all,

Found one bug for libzfs that some disk could not be onlined using its
physical path. I met the problem once when I try to online disk:

gptid/c6cde092-504b-11e4-ba52-c45444453598

This is a partition of GPT disk, and zpool returned with the error that no
such device found.

I tried online it using VDEV ID, and it worked.

The problem is, libzfs hacked vdev_to_nvlist_iter() to take special care
for ZPOOL_CONFIG_PATH searches (also, it seems that vdev->wholedisk is used
for this matter). This should be for Solaris but not Freebsd. BSD should
not need these hacks at all. Fixing this bug by commenting out the hacking
code path.

diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
index df8317f..e16f5c6 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
@@ -1969,6 +1969,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search,
boolean_t *avail_spare,
                if (nvlist_lookup_string(nv, srchkey, &val) != 0)
                        break;

+#ifdef sun
                /*
                 * Search for the requested value. Special cases:
                 *
@@ -2018,6 +2019,9 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search,
boolean_t *avail_spare,
                                break;
                        }
                } else if (strcmp(srchkey, ZPOOL_CONFIG_TYPE) == 0 && val) {
+#else
+               if (strcmp(srchkey, ZPOOL_CONFIG_TYPE) == 0 && val) {
+#endif
                        char *type, *idx, *end, *p;
                        uint64_t id, vdev_id;

I am one of Freebsd user (also ZFS user). Just want to contribute something
back. Hope I am posting to the write place.

Peter



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