Updates to linux-user-disk
The major change is removing the thread pool when importing devices. This may be reintroduced at some point if needed, but it is added complexity which has already been handled by blkid on modern Linux systems. We only need to fallback to probing everything is /dev/ if you config file is toast and even then it only takes a few seconds.
This commit is contained in:
parent
0c0ea412b3
commit
1b55fad32f
|
@ -1590,7 +1590,7 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
|
||||||
* -c Read pool information from a cachefile instead of searching
|
* -c Read pool information from a cachefile instead of searching
|
||||||
* devices.
|
* devices.
|
||||||
*
|
*
|
||||||
* -d Scan in a specific directory, other than /dev/dsk. More than
|
* -d Scan in a specific directory, other than /dev/. More than
|
||||||
* one directory can be specified using multiple '-d' options.
|
* one directory can be specified using multiple '-d' options.
|
||||||
*
|
*
|
||||||
* -D Scan for previously destroyed pools or import all or only
|
* -D Scan for previously destroyed pools or import all or only
|
||||||
|
@ -1749,12 +1749,6 @@ zpool_do_import(int argc, char **argv)
|
||||||
nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0)
|
nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (searchdirs == NULL) {
|
|
||||||
searchdirs = safe_malloc(sizeof (char *));
|
|
||||||
searchdirs[0] = "/dev/dsk";
|
|
||||||
nsearch = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check argument count */
|
/* check argument count */
|
||||||
if (do_all) {
|
if (do_all) {
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
#include <sys/vtoc.h>
|
#include <sys/vtoc.h>
|
||||||
#include <sys/dktp/fdisk.h>
|
#include <sys/dktp/fdisk.h>
|
||||||
#include <sys/efi_partition.h>
|
#include <sys/efi_partition.h>
|
||||||
#include <thread_pool.h>
|
|
||||||
|
|
||||||
#include <sys/vdev_impl.h>
|
#include <sys/vdev_impl.h>
|
||||||
#ifdef HAVE_LIBBLKID
|
#ifdef HAVE_LIBBLKID
|
||||||
|
@ -1004,13 +1003,10 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
|
||||||
vdev_entry_t *ve, *venext;
|
vdev_entry_t *ve, *venext;
|
||||||
config_entry_t *ce, *cenext;
|
config_entry_t *ce, *cenext;
|
||||||
name_entry_t *ne, *nenext;
|
name_entry_t *ne, *nenext;
|
||||||
avl_tree_t slice_cache;
|
|
||||||
rdsk_node_t *slice;
|
|
||||||
void *cookie;
|
|
||||||
|
|
||||||
verify(poolname == NULL || guid == 0);
|
verify(iarg->poolname == NULL || iarg->guid == 0);
|
||||||
|
|
||||||
if (argc == 0) {
|
if (dirs == 0) {
|
||||||
#ifdef HAVE_LIBBLKID
|
#ifdef HAVE_LIBBLKID
|
||||||
/* Use libblkid to scan all device for their type */
|
/* Use libblkid to scan all device for their type */
|
||||||
if (zpool_find_import_blkid(hdl, &pools) == 0)
|
if (zpool_find_import_blkid(hdl, &pools) == 0)
|
||||||
|
@ -1020,8 +1016,8 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
|
||||||
dgettext(TEXT_DOMAIN, "blkid failure falling back "
|
dgettext(TEXT_DOMAIN, "blkid failure falling back "
|
||||||
"to manual probing"));
|
"to manual probing"));
|
||||||
#endif /* HAVE_LIBBLKID */
|
#endif /* HAVE_LIBBLKID */
|
||||||
argc = 1;
|
dirs = 1;
|
||||||
argv = &default_dir;
|
dir = &default_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1030,7 +1026,6 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
|
||||||
* and toplevel GUID.
|
* and toplevel GUID.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < dirs; i++) {
|
for (i = 0; i < dirs; i++) {
|
||||||
tpool_t *t;
|
|
||||||
char *rdsk;
|
char *rdsk;
|
||||||
int dfd;
|
int dfd;
|
||||||
|
|
||||||
|
@ -1064,8 +1059,6 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
avl_create(&slice_cache, slice_cache_compare,
|
|
||||||
sizeof (rdsk_node_t), offsetof(rdsk_node_t, rn_node));
|
|
||||||
/*
|
/*
|
||||||
* This is not MT-safe, but we have no MT consumers of libzfs
|
* This is not MT-safe, but we have no MT consumers of libzfs
|
||||||
*/
|
*/
|
||||||
|
@ -1076,11 +1069,23 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do not open /dev/watchdog to stat it because
|
* Skip checking devices with well known prefixes:
|
||||||
* it requires a special close or the watchdog
|
* watchdog - A special close is required to avoid
|
||||||
* with be triggered and the system reset.
|
* triggering it and resetting the system.
|
||||||
|
* fuse - Fuse control device.
|
||||||
|
* ppp - Generic PPP driver.
|
||||||
|
* tty* - Generic serial interface.
|
||||||
|
* vcs* - Virtual console memory.
|
||||||
|
* parport* - Parallel port interface.
|
||||||
|
* lp* - Printer interface.
|
||||||
*/
|
*/
|
||||||
if (strcmp(name, "watchdog") == 0)
|
if ((strncmp(name, "watchdog", 8) == 0) ||
|
||||||
|
(strncmp(name, "fuse", 4) == 0) ||
|
||||||
|
(strncmp(name, "ppp", 3) == 0) ||
|
||||||
|
(strncmp(name, "tty", 3) == 0) ||
|
||||||
|
(strncmp(name, "vcs", 3) == 0) ||
|
||||||
|
(strncmp(name, "parport", 7) == 0) ||
|
||||||
|
(strncmp(name, "lp", 2) == 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((fd = openat64(dfd, name, O_RDONLY)) < 0)
|
if ((fd = openat64(dfd, name, O_RDONLY)) < 0)
|
||||||
|
@ -1129,14 +1134,11 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* use the non-raw path for the config */
|
/* use the non-raw path for the config */
|
||||||
(void) strlcpy(end, slice->rn_name, pathleft);
|
(void) strlcpy(end, name, pathleft);
|
||||||
if (add_config(hdl, &pools, path, config) != 0)
|
if (add_config(hdl, &pools, path, config) != 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
free(slice->rn_name);
|
|
||||||
free(slice);
|
|
||||||
}
|
}
|
||||||
avl_destroy(&slice_cache);
|
|
||||||
|
|
||||||
(void) closedir(dirp);
|
(void) closedir(dirp);
|
||||||
dirp = NULL;
|
dirp = NULL;
|
||||||
|
@ -1145,7 +1147,7 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
|
||||||
#ifdef HAVE_LIBBLKID
|
#ifdef HAVE_LIBBLKID
|
||||||
skip_scanning:
|
skip_scanning:
|
||||||
#endif
|
#endif
|
||||||
ret = get_configs(hdl, &pools, active_ok);
|
ret = get_configs(hdl, &pools, iarg->can_be_active);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
for (pe = pools.pools; pe != NULL; pe = penext) {
|
for (pe = pools.pools; pe != NULL; pe = penext) {
|
||||||
|
|
Loading…
Reference in New Issue