From owner-freebsd-fs@FreeBSD.ORG Fri Jan 16 03:52:32 2015 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C39FDD72 for ; Fri, 16 Jan 2015 03:52:32 +0000 (UTC) Received: from mail-lb0-x233.google.com (mail-lb0-x233.google.com [IPv6:2a00:1450:4010:c04::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4694FE6C for ; Fri, 16 Jan 2015 03:52:32 +0000 (UTC) Received: by mail-lb0-f179.google.com with SMTP id z11so16596197lbi.10 for ; Thu, 15 Jan 2015 19:52:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=p4XTnH4kNSp3WpaTulOSmL8UN9qnCnlHlQ6XwEvSV8k=; b=X47U4j/SA478C1o21GZcfX4d8/cbBM5BfPMKHDd+HhNZKVQ4/yp8Kt++eN9gzI6qS+ 2VkKumX9T3PE6a1S+9i6c+QUzo5yGSz3kaU5lq68JlopQQjEJ5CVs0j6uvcabW43y1op CQEc99fJPlEQLB/tw+JJFQQk2zDy41KSc5vMDU9k4gsD1UVGGhTV8w3ZnI0R0A8LMkH0 lQuLQoRhGR3u3BJUCutr7njhk+ta2uPU1Mnq8Ku3lBRyFz+Les9QuoI7+VuFbyuGJiW+ +BjLFnyiBV7hQMLUvZla/fJ/YOpq+cOWwjBorkonL6AsKbWlf+Blr02XUozrYSa0UXNv JvLw== MIME-Version: 1.0 X-Received: by 10.112.43.66 with SMTP id u2mr13466217lbl.35.1421380350394; Thu, 15 Jan 2015 19:52:30 -0800 (PST) Received: by 10.25.33.148 with HTTP; Thu, 15 Jan 2015 19:52:30 -0800 (PST) Date: Fri, 16 Jan 2015 11:52:30 +0800 Message-ID: Subject: bugfix: zpool online might fail when disk suffix start with "c[0-9]" From: Peter Xu To: freebsd-fs@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jan 2015 03:52:32 -0000 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