From owner-freebsd-current@FreeBSD.ORG Mon May 14 16:40:13 2012 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74BC51065672; Mon, 14 May 2012 16:40:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 4C8678FC0C; Mon, 14 May 2012 16:40:12 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA26852; Mon, 14 May 2012 19:40:07 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <4FB13567.3050705@FreeBSD.org> Date: Mon, 14 May 2012 19:40:07 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120503 Thunderbird/12.0.1 MIME-Version: 1.0 To: Fabian Keil References: <4FAF767C.8030500@cran.org.uk> <4FB0ED96.6010100@FreeBSD.org> <20120514171914.7a1e9d10@fabiankeil.de> <4FB12EBF.2030804@FreeBSD.org> In-Reply-To: <4FB12EBF.2030804@FreeBSD.org> X-Enigmail-Version: 1.5pre Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Bruce Cran , freebsd-current Subject: Re: Default directory used for 'zpool import' broken (/dev/dsk)? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 May 2012 16:40:13 -0000 on 14/05/2012 19:11 Andriy Gapon said the following: > on 14/05/2012 18:19 Fabian Keil said the following: >> The following patch seems to work for me: >> >> #### >> commit 7ec69700f2d6944a61f5c7a826e67f46fa160221 >> Author: Fabian Keil >> Date: Mon May 12 16:53:56 2012 +0200 >> >> Default to searching vdevs in /dev. /dev/dsk doesn't exist on FreeBSD. >> >> Fixes import issues if no cachefile exists and -d isn't used: >> >> fk@r500 ~ $sudo zpool import wde2 >> cannot open '/dev/dsk': must be an absolute path > > Hah, so this hasn't been fixed actually. > Thank you for the patch! > >> diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c >> index fe76250..5d1e454 100644 >> --- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c >> +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c >> @@ -1909,7 +1909,7 @@ zpool_do_import(int argc, char **argv) >> >> if (searchdirs == NULL) { >> searchdirs = safe_malloc(sizeof (char *)); >> - searchdirs[0] = "/dev/dsk"; >> + searchdirs[0] = "/dev"; >> nsearch = 1; >> } >> #### >> >> The cachefile part is speculation ... > > Not sure if the following is also necessary, but it looks like it makes sense: --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c @@ -1145,7 +1145,7 @@ zpool_find_import_impl char *end, **dir = iarg->path; size_t pathleft; nvlist_t *ret = NULL; - static char *default_dir = "/dev/dsk"; + static char *default_dir = "/dev"; pool_list_t pools = { 0 }; pool_entry_t *pe, *penext; vdev_entry_t *ve, *venext; I am not sure if zpool_find_import_impl is ever called with empty/zero paths/path in the importargs_t parameter. -- Andriy Gapon