mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Rebase master to b121
This commit is contained in:
+25
-9
@@ -1469,7 +1469,7 @@ show_import(nvlist_t *config)
|
||||
*/
|
||||
static int
|
||||
do_import(nvlist_t *config, const char *newname, const char *mntopts,
|
||||
int force, nvlist_t *props, boolean_t allowfaulted)
|
||||
int force, nvlist_t *props, boolean_t do_verbatim)
|
||||
{
|
||||
zpool_handle_t *zhp;
|
||||
char *name;
|
||||
@@ -1522,14 +1522,14 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
|
||||
}
|
||||
}
|
||||
|
||||
if (zpool_import_props(g_zfs, config, newname, props,
|
||||
allowfaulted) != 0)
|
||||
if (zpool_import_props(g_zfs, config, newname, props, do_verbatim) != 0)
|
||||
return (1);
|
||||
|
||||
if (newname != NULL)
|
||||
name = (char *)newname;
|
||||
|
||||
verify((zhp = zpool_open_canfail(g_zfs, name)) != NULL);
|
||||
if ((zhp = zpool_open_canfail(g_zfs, name)) == NULL)
|
||||
return (1);
|
||||
|
||||
if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL &&
|
||||
zpool_enable_datasets(zhp, mntopts, 0) != 0) {
|
||||
@@ -1566,7 +1566,8 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
|
||||
* -F Import even in the presence of faulted vdevs. This is an
|
||||
* intentionally undocumented option for testing purposes, and
|
||||
* treats the pool configuration as complete, leaving any bad
|
||||
* vdevs in the FAULTED state.
|
||||
* vdevs in the FAULTED state. In other words, it does verbatim
|
||||
* import.
|
||||
*
|
||||
* -a Import all pools found.
|
||||
*
|
||||
@@ -1595,7 +1596,7 @@ zpool_do_import(int argc, char **argv)
|
||||
nvlist_t *found_config;
|
||||
nvlist_t *props = NULL;
|
||||
boolean_t first;
|
||||
boolean_t allow_faulted = B_FALSE;
|
||||
boolean_t do_verbatim = B_FALSE;
|
||||
uint64_t pool_state;
|
||||
char *cachefile = NULL;
|
||||
|
||||
@@ -1628,7 +1629,7 @@ zpool_do_import(int argc, char **argv)
|
||||
do_force = B_TRUE;
|
||||
break;
|
||||
case 'F':
|
||||
allow_faulted = B_TRUE;
|
||||
do_verbatim = B_TRUE;
|
||||
break;
|
||||
case 'o':
|
||||
if ((propval = strchr(optarg, '=')) != NULL) {
|
||||
@@ -1778,7 +1779,7 @@ zpool_do_import(int argc, char **argv)
|
||||
|
||||
if (do_all)
|
||||
err |= do_import(config, NULL, mntopts,
|
||||
do_force, props, allow_faulted);
|
||||
do_force, props, do_verbatim);
|
||||
else
|
||||
show_import(config);
|
||||
} else if (searchname != NULL) {
|
||||
@@ -1826,7 +1827,7 @@ zpool_do_import(int argc, char **argv)
|
||||
err = B_TRUE;
|
||||
} else {
|
||||
err |= do_import(found_config, argc == 1 ? NULL :
|
||||
argv[1], mntopts, do_force, props, allow_faulted);
|
||||
argv[1], mntopts, do_force, props, do_verbatim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3117,6 +3118,17 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
"replace'.\n"));
|
||||
break;
|
||||
|
||||
case ZPOOL_STATUS_REMOVED_DEV:
|
||||
(void) printf(gettext("status: One or more devices has "
|
||||
"been removed by the administrator.\n\tSufficient "
|
||||
"replicas exist for the pool to continue functioning in "
|
||||
"a\n\tdegraded state.\n"));
|
||||
(void) printf(gettext("action: Online the device using "
|
||||
"'zpool online' or replace the device with\n\t'zpool "
|
||||
"replace'.\n"));
|
||||
break;
|
||||
|
||||
|
||||
case ZPOOL_STATUS_RESILVERING:
|
||||
(void) printf(gettext("status: One or more devices is "
|
||||
"currently being resilvered. The pool will\n\tcontinue "
|
||||
@@ -3539,6 +3551,8 @@ zpool_do_upgrade(int argc, char **argv)
|
||||
(void) printf(gettext(" 14 passthrough-x aclinherit\n"));
|
||||
(void) printf(gettext(" 15 user/group space accounting\n"));
|
||||
(void) printf(gettext(" 16 stmf property support\n"));
|
||||
(void) printf(gettext(" 17 Triple-parity RAID-Z\n"));
|
||||
(void) printf(gettext(" 18 snapshot user holds\n"));
|
||||
(void) printf(gettext("For more information on a particular "
|
||||
"version, including supported releases, see:\n\n"));
|
||||
(void) printf("http://www.opensolaris.org/os/community/zfs/"
|
||||
@@ -3624,6 +3638,8 @@ char *hist_event_table[LOG_END] = {
|
||||
"refquota set",
|
||||
"refreservation set",
|
||||
"pool scrub done",
|
||||
"user hold",
|
||||
"user release",
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
+35
-12
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
#include <libdiskmgt.h>
|
||||
#include <libintl.h>
|
||||
#include <libnvpair.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -1093,19 +1094,34 @@ check_in_use(nvlist_t *config, nvlist_t *nv, int force, int isreplacing,
|
||||
}
|
||||
|
||||
static const char *
|
||||
is_grouping(const char *type, int *mindev)
|
||||
is_grouping(const char *type, int *mindev, int *maxdev)
|
||||
{
|
||||
if (strcmp(type, "raidz") == 0 || strcmp(type, "raidz1") == 0) {
|
||||
if (strncmp(type, "raidz", 5) == 0) {
|
||||
const char *p = type + 5;
|
||||
char *end;
|
||||
long nparity;
|
||||
|
||||
if (*p == '\0') {
|
||||
nparity = 1;
|
||||
} else if (*p == '0') {
|
||||
return (NULL); /* no zero prefixes allowed */
|
||||
} else {
|
||||
errno = 0;
|
||||
nparity = strtol(p, &end, 10);
|
||||
if (errno != 0 || nparity < 1 || nparity >= 255 ||
|
||||
*end != '\0')
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (mindev != NULL)
|
||||
*mindev = 2;
|
||||
*mindev = nparity + 1;
|
||||
if (maxdev != NULL)
|
||||
*maxdev = 255;
|
||||
return (VDEV_TYPE_RAIDZ);
|
||||
}
|
||||
|
||||
if (strcmp(type, "raidz2") == 0) {
|
||||
if (mindev != NULL)
|
||||
*mindev = 3;
|
||||
return (VDEV_TYPE_RAIDZ);
|
||||
}
|
||||
if (maxdev != NULL)
|
||||
*maxdev = INT_MAX;
|
||||
|
||||
if (strcmp(type, "mirror") == 0) {
|
||||
if (mindev != NULL)
|
||||
@@ -1144,7 +1160,7 @@ nvlist_t *
|
||||
construct_spec(int argc, char **argv)
|
||||
{
|
||||
nvlist_t *nvroot, *nv, **top, **spares, **l2cache;
|
||||
int t, toplevels, mindev, nspares, nlogs, nl2cache;
|
||||
int t, toplevels, mindev, maxdev, nspares, nlogs, nl2cache;
|
||||
const char *type;
|
||||
uint64_t is_log;
|
||||
boolean_t seen_logs;
|
||||
@@ -1166,7 +1182,7 @@ construct_spec(int argc, char **argv)
|
||||
* If it's a mirror or raidz, the subsequent arguments are
|
||||
* its leaves -- until we encounter the next mirror or raidz.
|
||||
*/
|
||||
if ((type = is_grouping(argv[0], &mindev)) != NULL) {
|
||||
if ((type = is_grouping(argv[0], &mindev, &maxdev)) != NULL) {
|
||||
nvlist_t **child = NULL;
|
||||
int c, children = 0;
|
||||
|
||||
@@ -1223,7 +1239,7 @@ construct_spec(int argc, char **argv)
|
||||
}
|
||||
|
||||
for (c = 1; c < argc; c++) {
|
||||
if (is_grouping(argv[c], NULL) != NULL)
|
||||
if (is_grouping(argv[c], NULL, NULL) != NULL)
|
||||
break;
|
||||
children++;
|
||||
child = realloc(child,
|
||||
@@ -1243,6 +1259,13 @@ construct_spec(int argc, char **argv)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (children > maxdev) {
|
||||
(void) fprintf(stderr, gettext("invalid vdev "
|
||||
"specification: %s supports no more than "
|
||||
"%d devices\n"), argv[0], maxdev);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
argc -= c;
|
||||
argv += c;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user