Re: Default directory used for 'zpool import' broken (/dev/dsk)?

2012-05-14 Thread Andriy Gapon
on 13/05/2012 11:53 Bruce Cran said the following:
 When running 'zpool import' without -d I get the error:
 cannot open '/dev/dsk': must be an absolute path
 
 zpool(8) suggests the default should have been updated for FreeBSD:
 If the -d option is not specified, this command searches for devices in 
 /dev
 
 Was this broken recently?
 

Not sure, but maybe /dev/dsk is recorded somewhere in the pool metadata or in
zpool.cache.  It could have happened with the older version of the code.
I think that you could check that with zdb.  I think that a fresh import should
fix it, though.

-- 
Andriy Gapon
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Default directory used for 'zpool import' broken (/dev/dsk)?

2012-05-14 Thread Fabian Keil
Andriy Gapon a...@freebsd.org wrote:

 on 13/05/2012 11:53 Bruce Cran said the following:
  When running 'zpool import' without -d I get the error:
  cannot open '/dev/dsk': must be an absolute path
  
  zpool(8) suggests the default should have been updated for FreeBSD:
  If the -d option is not specified, this command searches for devices
  in /dev
  
  Was this broken recently?

 Not sure, but maybe /dev/dsk is recorded somewhere in the pool metadata
 or in zpool.cache.  It could have happened with the older version of the
 code. I think that you could check that with zdb.  I think that a fresh
 import should fix it, though.

The following patch seems to work for me:


commit 7ec69700f2d6944a61f5c7a826e67f46fa160221
Author: Fabian Keil f...@fabiankeil.de
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

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 ...

Fabian


signature.asc
Description: PGP signature


Re: Default directory used for 'zpool import' broken (/dev/dsk)?

2012-05-14 Thread Andriy Gapon
on 14/05/2012 18:19 Fabian Keil said the following:
 Andriy Gapon a...@freebsd.org wrote:
 
 on 13/05/2012 11:53 Bruce Cran said the following:
 When running 'zpool import' without -d I get the error:
 cannot open '/dev/dsk': must be an absolute path

 zpool(8) suggests the default should have been updated for FreeBSD:
 If the -d option is not specified, this command searches for devices
 in /dev

 Was this broken recently?
 
 Not sure, but maybe /dev/dsk is recorded somewhere in the pool metadata
 or in zpool.cache.  It could have happened with the older version of the
 code. I think that you could check that with zdb.  I think that a fresh
 import should fix it, though.
 
 The following patch seems to work for me:
 
 
 commit 7ec69700f2d6944a61f5c7a826e67f46fa160221
 Author: Fabian Keil f...@fabiankeil.de
 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 ...


-- 
Andriy Gapon
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Default directory used for 'zpool import' broken (/dev/dsk)?

2012-05-14 Thread Andriy Gapon
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 f...@fabiankeil.de
 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
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Default directory used for 'zpool import' broken (/dev/dsk)?

2012-05-14 Thread Jan Beich
Andriy Gapon a...@freebsd.org writes:

 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 f...@fabiankeil.de
 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:

It looks like bin/155104 which affects zdb -e.


 --- 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.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org