Bug#592676: can't import pool after exporting it
- To: 592676@bugs.debian.org
- Subject: Bug#592676: can't import pool after exporting it
- From: Tuco <tuco.xyz@gmail.com>
- Date: Wed, 11 Aug 2010 18:32:35 -0400
- Message-id: <AANLkTinQPUYnO=iEXOyewcZmvQbDWUpEcFL3p6gjzPZH@mail.gmail.com>
- Reply-to: Tuco <tuco.xyz@gmail.com>, 592676@bugs.debian.org
- In-reply-to: <AANLkTi=ryoP75WyEqKU4opZ-pEjwgwZ=r4xtiLHdHgkn@mail.gmail.com>
- References: <AANLkTi=ryoP75WyEqKU4opZ-pEjwgwZ=r4xtiLHdHgkn@mail.gmail.com>
Here's the patch.
On 8/11/10, Tuco <tuco.xyz@gmail.com> wrote:
> Package: zfsutils
> Version: 8.1-3
> Severity: important
>
> tuco@debian:~$ sudo zpool create test /dev/ad6s1
> tuco@debian:~$ sudo zpool export test
> tuco@debian:~$ sudo zpool import test
> cannot open '/dev/dsk': must be an absolute path
> cannot import 'test': no such pool available
>
> Attached patch fixes the first problem: zpool searches for disks in
> /dev/dsk instead of /dev, but then importing still fails.
>
>
>
> --
> To UNSUBSCRIBE, email to debian-bsd-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org
> Archive:
> http://lists.debian.org/AANLkTi=ryoP75WyEqKU4opZ-pEjwgwZ=r4xtiLHdHgkn@mail.gmail.com
>
>
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
@@ -1468,7 +1468,11 @@
if (searchdirs == NULL) {
searchdirs = safe_malloc(sizeof (char *));
+#ifdef __sun
searchdirs[0] = "/dev/dsk";
+#else
+ searchdirs[0] = "/dev";
+#endif
nsearch = 1;
}
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
@@ -848,7 +848,11 @@
size_t pathleft;
struct stat64 statbuf;
nvlist_t *ret = NULL, *config;
+#ifdef __sun
static char *default_dir = "/dev/dsk";
+#else
+ static char *default_dir = "/dev";
+#endif
int fd;
pool_list_t pools = { 0 };
pool_entry_t *pe, *penext;
@@ -894,9 +898,11 @@
* reading the labels skips a bunch of slow operations during
* close(2) processing, so we replace /dev/dsk with /dev/rdsk.
*/
+#ifdef __sun
if (strcmp(path, "/dev/dsk/") == 0)
rdsk = "/dev/rdsk/";
else
+#endif
rdsk = path;
if ((dirp = opendir(rdsk)) == NULL) {
Reply to: