2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* CDDL HEADER START
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the terms of the
|
|
|
|
* Common Development and Distribution License (the "License").
|
|
|
|
* You may not use this file except in compliance with the License.
|
|
|
|
*
|
|
|
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
|
|
* or http://www.opensolaris.org/os/licensing.
|
|
|
|
* See the License for the specific language governing permissions
|
|
|
|
* and limitations under the License.
|
|
|
|
*
|
|
|
|
* When distributing Covered Code, include this CDDL HEADER in each
|
|
|
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
|
|
* If applicable, add the following below this CDDL HEADER, with the
|
|
|
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
|
|
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
|
|
|
*
|
|
|
|
* CDDL HEADER END
|
|
|
|
*/
|
|
|
|
/*
|
2009-07-02 22:44:48 +00:00
|
|
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
2008-11-20 20:01:55 +00:00
|
|
|
* Use is subject to license terms.
|
|
|
|
*/
|
2013-12-11 22:33:41 +00:00
|
|
|
/*
|
2016-09-12 15:15:20 +00:00
|
|
|
* Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
2013-12-11 22:33:41 +00:00
|
|
|
*/
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Common name validation routines for ZFS. These routines are shared by the
|
|
|
|
* userland code as well as the ioctl() layer to ensure that we don't
|
|
|
|
* inadvertently expose a hole through direct ioctl()s that never gets tested.
|
|
|
|
* In userland, however, we want significantly more information about _why_ the
|
|
|
|
* name is invalid. In the kernel, we only care whether it's valid or not.
|
|
|
|
* Each routine therefore takes a 'namecheck_err_t' which describes exactly why
|
|
|
|
* the name failed to validate.
|
|
|
|
*/
|
|
|
|
|
2018-02-16 01:53:18 +00:00
|
|
|
#if !defined(_KERNEL)
|
2008-11-20 20:01:55 +00:00
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
|
2017-07-24 19:56:49 +00:00
|
|
|
#include <sys/dsl_dir.h>
|
2008-11-20 20:01:55 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/nvpair.h>
|
|
|
|
#include "zfs_namecheck.h"
|
|
|
|
#include "zfs_deleg.h"
|
|
|
|
|
2016-09-12 15:15:20 +00:00
|
|
|
/*
|
|
|
|
* Deeply nested datasets can overflow the stack, so we put a limit
|
|
|
|
* in the amount of nesting a path can have. zfs_max_dataset_nesting
|
|
|
|
* can be tuned temporarily to fix existing datasets that exceed our
|
|
|
|
* predefined limit.
|
|
|
|
*/
|
|
|
|
int zfs_max_dataset_nesting = 50;
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
static int
|
|
|
|
valid_char(char c)
|
|
|
|
{
|
|
|
|
return ((c >= 'a' && c <= 'z') ||
|
|
|
|
(c >= 'A' && c <= 'Z') ||
|
|
|
|
(c >= '0' && c <= '9') ||
|
2008-12-03 20:09:06 +00:00
|
|
|
c == '-' || c == '_' || c == '.' || c == ':' || c == ' ');
|
2008-11-20 20:01:55 +00:00
|
|
|
}
|
|
|
|
|
2016-09-12 15:15:20 +00:00
|
|
|
/*
|
|
|
|
* Looks at a path and returns its level of nesting (depth).
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
get_dataset_depth(const char *path)
|
|
|
|
{
|
|
|
|
const char *loc = path;
|
|
|
|
int nesting = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Keep track of nesting until you hit the end of the
|
2019-08-30 21:32:18 +00:00
|
|
|
* path or found the snapshot/bookmark separator.
|
2016-09-12 15:15:20 +00:00
|
|
|
*/
|
|
|
|
for (int i = 0; loc[i] != '\0' &&
|
|
|
|
loc[i] != '@' &&
|
|
|
|
loc[i] != '#'; i++) {
|
|
|
|
if (loc[i] == '/')
|
|
|
|
nesting++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (nesting);
|
|
|
|
}
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* Snapshot names must be made up of alphanumeric characters plus the following
|
|
|
|
* characters:
|
|
|
|
*
|
2016-09-12 15:15:20 +00:00
|
|
|
* [-_.: ]
|
|
|
|
*
|
|
|
|
* Returns 0 on success, -1 on error.
|
2008-11-20 20:01:55 +00:00
|
|
|
*/
|
|
|
|
int
|
2013-12-11 22:33:41 +00:00
|
|
|
zfs_component_namecheck(const char *path, namecheck_err_t *why, char *what)
|
2008-11-20 20:01:55 +00:00
|
|
|
{
|
|
|
|
const char *loc;
|
|
|
|
|
2016-06-15 21:28:36 +00:00
|
|
|
if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN) {
|
2008-11-20 20:01:55 +00:00
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_TOOLONG;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (path[0] == '\0') {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_EMPTY_COMPONENT;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (loc = path; *loc; loc++) {
|
|
|
|
if (!valid_char(*loc)) {
|
|
|
|
if (why) {
|
|
|
|
*why = NAME_ERR_INVALCHAR;
|
|
|
|
*what = *loc;
|
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Permissions set name must start with the letter '@' followed by the
|
|
|
|
* same character restrictions as snapshot names, except that the name
|
|
|
|
* cannot exceed 64 characters.
|
2016-09-12 15:15:20 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success, -1 on error.
|
2008-11-20 20:01:55 +00:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
permset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
|
|
|
{
|
|
|
|
if (strlen(path) >= ZFS_PERMSET_MAXLEN) {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_TOOLONG;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (path[0] != '@') {
|
|
|
|
if (why) {
|
|
|
|
*why = NAME_ERR_NO_AT;
|
|
|
|
*what = path[0];
|
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
2013-12-11 22:33:41 +00:00
|
|
|
return (zfs_component_namecheck(&path[1], why, what));
|
2008-11-20 20:01:55 +00:00
|
|
|
}
|
|
|
|
|
2016-09-12 15:15:20 +00:00
|
|
|
/*
|
|
|
|
* Dataset paths should not be deeper than zfs_max_dataset_nesting
|
|
|
|
* in terms of nesting.
|
|
|
|
*
|
|
|
|
* Returns 0 on success, -1 on error.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
dataset_nestcheck(const char *path)
|
|
|
|
{
|
|
|
|
return ((get_dataset_depth(path) < zfs_max_dataset_nesting) ? 0 : -1);
|
|
|
|
}
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
2017-01-26 22:42:15 +00:00
|
|
|
* Entity names must be of the following form:
|
2008-11-20 20:01:55 +00:00
|
|
|
*
|
2016-09-12 15:15:20 +00:00
|
|
|
* [component/]*[component][(@|#)component]?
|
2008-11-20 20:01:55 +00:00
|
|
|
*
|
|
|
|
* Where each component is made up of alphanumeric characters plus the following
|
|
|
|
* characters:
|
|
|
|
*
|
2020-01-24 05:11:54 +00:00
|
|
|
* [-_.: %]
|
2008-11-20 20:01:55 +00:00
|
|
|
*
|
|
|
|
* We allow '%' here as we use that character internally to create unique
|
|
|
|
* names for temporary clones (for online recv).
|
2016-09-12 15:15:20 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success, -1 on error.
|
2008-11-20 20:01:55 +00:00
|
|
|
*/
|
|
|
|
int
|
2017-01-26 22:42:15 +00:00
|
|
|
entity_namecheck(const char *path, namecheck_err_t *why, char *what)
|
2008-11-20 20:01:55 +00:00
|
|
|
{
|
2016-09-12 15:15:20 +00:00
|
|
|
const char *end;
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2019-11-11 07:24:14 +00:00
|
|
|
EQUIV(why == NULL, what == NULL);
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* Make sure the name is not too long.
|
|
|
|
*/
|
2016-06-15 21:28:36 +00:00
|
|
|
if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN) {
|
2008-11-20 20:01:55 +00:00
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_TOOLONG;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Explicitly check for a leading slash. */
|
|
|
|
if (path[0] == '/') {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_LEADING_SLASH;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (path[0] == '\0') {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_EMPTY_COMPONENT;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
2016-09-12 15:15:20 +00:00
|
|
|
const char *start = path;
|
|
|
|
boolean_t found_delim = B_FALSE;
|
2008-11-20 20:01:55 +00:00
|
|
|
for (;;) {
|
|
|
|
/* Find the end of this component */
|
2017-01-26 22:42:15 +00:00
|
|
|
end = start;
|
|
|
|
while (*end != '/' && *end != '@' && *end != '#' &&
|
|
|
|
*end != '\0')
|
2008-11-20 20:01:55 +00:00
|
|
|
end++;
|
|
|
|
|
|
|
|
if (*end == '\0' && end[-1] == '/') {
|
|
|
|
/* trailing slashes are not allowed */
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_TRAILING_SLASH;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Validate the contents of this component */
|
2017-11-04 20:25:13 +00:00
|
|
|
for (const char *loc = start; loc != end; loc++) {
|
2008-11-20 20:01:55 +00:00
|
|
|
if (!valid_char(*loc) && *loc != '%') {
|
|
|
|
if (why) {
|
|
|
|
*why = NAME_ERR_INVALCHAR;
|
|
|
|
*what = *loc;
|
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-13 15:56:15 +00:00
|
|
|
if (*end == '\0' || *end == '/') {
|
|
|
|
int component_length = end - start;
|
|
|
|
/* Validate the contents of this component is not '.' */
|
|
|
|
if (component_length == 1) {
|
|
|
|
if (start[0] == '.') {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_SELF_REF;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Validate the content of this component is not '..' */
|
|
|
|
if (component_length == 2) {
|
|
|
|
if (start[0] == '.' && start[1] == '.') {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_PARENT_REF;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:42:15 +00:00
|
|
|
/* Snapshot or bookmark delimiter found */
|
|
|
|
if (*end == '@' || *end == '#') {
|
|
|
|
/* Multiple delimiters are not allowed */
|
|
|
|
if (found_delim != 0) {
|
2008-11-20 20:01:55 +00:00
|
|
|
if (why)
|
2017-01-26 22:42:15 +00:00
|
|
|
*why = NAME_ERR_MULTIPLE_DELIMITERS;
|
2008-11-20 20:01:55 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
2016-09-12 15:15:20 +00:00
|
|
|
found_delim = B_TRUE;
|
2008-11-20 20:01:55 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 22:42:15 +00:00
|
|
|
/* Zero-length components are not allowed */
|
|
|
|
if (start == end) {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_EMPTY_COMPONENT;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we've reached the end of the string, we're OK */
|
|
|
|
if (*end == '\0')
|
|
|
|
return (0);
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
2017-01-26 22:42:15 +00:00
|
|
|
* If there is a '/' in a snapshot or bookmark name
|
2008-11-20 20:01:55 +00:00
|
|
|
* then report an error
|
|
|
|
*/
|
2017-01-26 22:42:15 +00:00
|
|
|
if (*end == '/' && found_delim != 0) {
|
2008-11-20 20:01:55 +00:00
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_TRAILING_SLASH;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update to the next component */
|
2017-01-26 22:42:15 +00:00
|
|
|
start = end + 1;
|
2008-11-20 20:01:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-26 22:42:15 +00:00
|
|
|
/*
|
|
|
|
* Dataset is any entity, except bookmark
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
|
|
|
{
|
|
|
|
int ret = entity_namecheck(path, why, what);
|
|
|
|
|
|
|
|
if (ret == 0 && strchr(path, '#') != NULL) {
|
|
|
|
if (why != NULL) {
|
|
|
|
*why = NAME_ERR_INVALCHAR;
|
|
|
|
*what = '#';
|
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2019-11-11 07:24:14 +00:00
|
|
|
/*
|
|
|
|
* Assert path is a valid bookmark name
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
bookmark_namecheck(const char *path, namecheck_err_t *why, char *what)
|
|
|
|
{
|
|
|
|
int ret = entity_namecheck(path, why, what);
|
|
|
|
|
|
|
|
if (ret == 0 && strchr(path, '#') == NULL) {
|
|
|
|
if (why != NULL) {
|
|
|
|
*why = NAME_ERR_NO_POUND;
|
|
|
|
*what = '#';
|
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Assert path is a valid snapshot name
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
snapshot_namecheck(const char *path, namecheck_err_t *why, char *what)
|
|
|
|
{
|
|
|
|
int ret = entity_namecheck(path, why, what);
|
|
|
|
|
|
|
|
if (ret == 0 && strchr(path, '@') == NULL) {
|
|
|
|
if (why != NULL) {
|
|
|
|
*why = NAME_ERR_NO_AT;
|
|
|
|
*what = '@';
|
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* mountpoint names must be of the following form:
|
|
|
|
*
|
|
|
|
* /[component][/]*[component][/]
|
2016-09-12 15:15:20 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success, -1 on error.
|
2008-11-20 20:01:55 +00:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
mountpoint_namecheck(const char *path, namecheck_err_t *why)
|
|
|
|
{
|
|
|
|
const char *start, *end;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure none of the mountpoint component names are too long.
|
|
|
|
* If a component name is too long then the mkdir of the mountpoint
|
|
|
|
* will fail but then the mountpoint property will be set to a value
|
|
|
|
* that can never be mounted. Better to fail before setting the prop.
|
|
|
|
* Extra slashes are OK, they will be tossed by the mountpoint mkdir.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (path == NULL || *path != '/') {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_LEADING_SLASH;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Skip leading slash */
|
|
|
|
start = &path[1];
|
|
|
|
do {
|
|
|
|
end = start;
|
|
|
|
while (*end != '/' && *end != '\0')
|
|
|
|
end++;
|
|
|
|
|
2016-06-15 21:28:36 +00:00
|
|
|
if (end - start >= ZFS_MAX_DATASET_NAME_LEN) {
|
2008-11-20 20:01:55 +00:00
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_TOOLONG;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
start = end + 1;
|
|
|
|
|
|
|
|
} while (*end != '\0');
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For pool names, we have the same set of valid characters as described in
|
|
|
|
* dataset names, with the additional restriction that the pool name must begin
|
|
|
|
* with a letter. The pool names 'raidz' and 'mirror' are also reserved names
|
|
|
|
* that cannot be used.
|
2016-09-12 15:15:20 +00:00
|
|
|
*
|
|
|
|
* Returns 0 on success, -1 on error.
|
2008-11-20 20:01:55 +00:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
pool_namecheck(const char *pool, namecheck_err_t *why, char *what)
|
|
|
|
{
|
|
|
|
const char *c;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure the name is not too long.
|
2017-07-24 19:56:49 +00:00
|
|
|
* If we're creating a pool with version >= SPA_VERSION_DSL_SCRUB (v11)
|
|
|
|
* we need to account for additional space needed by the origin ds which
|
|
|
|
* will also be snapshotted: "poolname"+"/"+"$ORIGIN"+"@"+"$ORIGIN".
|
|
|
|
* Play it safe and enforce this limit even if the pool version is < 11
|
|
|
|
* so it can be upgraded without issues.
|
2008-11-20 20:01:55 +00:00
|
|
|
*/
|
2017-07-24 19:56:49 +00:00
|
|
|
if (strlen(pool) >= (ZFS_MAX_DATASET_NAME_LEN - 2 -
|
|
|
|
strlen(ORIGIN_DIR_NAME) * 2)) {
|
2008-11-20 20:01:55 +00:00
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_TOOLONG;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
c = pool;
|
|
|
|
while (*c != '\0') {
|
|
|
|
if (!valid_char(*c)) {
|
|
|
|
if (why) {
|
|
|
|
*why = NAME_ERR_INVALCHAR;
|
|
|
|
*what = *c;
|
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(*pool >= 'a' && *pool <= 'z') &&
|
|
|
|
!(*pool >= 'A' && *pool <= 'Z')) {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_NOLETTER;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
Distributed Spare (dRAID) Feature
This patch adds a new top-level vdev type called dRAID, which stands
for Distributed parity RAID. This pool configuration allows all dRAID
vdevs to participate when rebuilding to a distributed hot spare device.
This can substantially reduce the total time required to restore full
parity to pool with a failed device.
A dRAID pool can be created using the new top-level `draid` type.
Like `raidz`, the desired redundancy is specified after the type:
`draid[1,2,3]`. No additional information is required to create the
pool and reasonable default values will be chosen based on the number
of child vdevs in the dRAID vdev.
zpool create <pool> draid[1,2,3] <vdevs...>
Unlike raidz, additional optional dRAID configuration values can be
provided as part of the draid type as colon separated values. This
allows administrators to fully specify a layout for either performance
or capacity reasons. The supported options include:
zpool create <pool> \
draid[<parity>][:<data>d][:<children>c][:<spares>s] \
<vdevs...>
- draid[parity] - Parity level (default 1)
- draid[:<data>d] - Data devices per group (default 8)
- draid[:<children>c] - Expected number of child vdevs
- draid[:<spares>s] - Distributed hot spares (default 0)
Abbreviated example `zpool status` output for a 68 disk dRAID pool
with two distributed spares using special allocation classes.
```
pool: tank
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
slag7 ONLINE 0 0 0
draid2:8d:68c:2s-0 ONLINE 0 0 0
L0 ONLINE 0 0 0
L1 ONLINE 0 0 0
...
U25 ONLINE 0 0 0
U26 ONLINE 0 0 0
spare-53 ONLINE 0 0 0
U27 ONLINE 0 0 0
draid2-0-0 ONLINE 0 0 0
U28 ONLINE 0 0 0
U29 ONLINE 0 0 0
...
U42 ONLINE 0 0 0
U43 ONLINE 0 0 0
special
mirror-1 ONLINE 0 0 0
L5 ONLINE 0 0 0
U5 ONLINE 0 0 0
mirror-2 ONLINE 0 0 0
L6 ONLINE 0 0 0
U6 ONLINE 0 0 0
spares
draid2-0-0 INUSE currently in use
draid2-0-1 AVAIL
```
When adding test coverage for the new dRAID vdev type the following
options were added to the ztest command. These options are leverages
by zloop.sh to test a wide range of dRAID configurations.
-K draid|raidz|random - kind of RAID to test
-D <value> - dRAID data drives per group
-S <value> - dRAID distributed hot spares
-R <value> - RAID parity (raidz or dRAID)
The zpool_create, zpool_import, redundancy, replacement and fault
test groups have all been updated provide test coverage for the
dRAID feature.
Co-authored-by: Isaac Huang <he.huang@intel.com>
Co-authored-by: Mark Maybee <mmaybee@cray.com>
Co-authored-by: Don Brady <don.brady@delphix.com>
Co-authored-by: Matthew Ahrens <mahrens@delphix.com>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mmaybee@cray.com>
Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #10102
2020-11-13 21:51:51 +00:00
|
|
|
if (strcmp(pool, "mirror") == 0 ||
|
|
|
|
strcmp(pool, "raidz") == 0 ||
|
|
|
|
strcmp(pool, "draid") == 0) {
|
2008-11-20 20:01:55 +00:00
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_RESERVED;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pool[0] == 'c' && (pool[1] >= '0' && pool[1] <= '9')) {
|
|
|
|
if (why)
|
|
|
|
*why = NAME_ERR_DISKLIKE;
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
2010-08-26 18:49:16 +00:00
|
|
|
|
Implement Redacted Send/Receive
Redacted send/receive allows users to send subsets of their data to
a target system. One possible use case for this feature is to not
transmit sensitive information to a data warehousing, test/dev, or
analytics environment. Another is to save space by not replicating
unimportant data within a given dataset, for example in backup tools
like zrepl.
Redacted send/receive is a three-stage process. First, a clone (or
clones) is made of the snapshot to be sent to the target. In this
clone (or clones), all unnecessary or unwanted data is removed or
modified. This clone is then snapshotted to create the "redaction
snapshot" (or snapshots). Second, the new zfs redact command is used
to create a redaction bookmark. The redaction bookmark stores the
list of blocks in a snapshot that were modified by the redaction
snapshot(s). Finally, the redaction bookmark is passed as a parameter
to zfs send. When sending to the snapshot that was redacted, the
redaction bookmark is used to filter out blocks that contain sensitive
or unwanted information, and those blocks are not included in the send
stream. When sending from the redaction bookmark, the blocks it
contains are considered as candidate blocks in addition to those
blocks in the destination snapshot that were modified since the
creation_txg of the redaction bookmark. This step is necessary to
allow the target to rehydrate data in the case where some blocks are
accidentally or unnecessarily modified in the redaction snapshot.
The changes to bookmarks to enable fast space estimation involve
adding deadlists to bookmarks. There is also logic to manage the
life cycles of these deadlists.
The new size estimation process operates in cases where previously
an accurate estimate could not be provided. In those cases, a send
is performed where no data blocks are read, reducing the runtime
significantly and providing a byte-accurate size estimate.
Reviewed-by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Prashanth Sreenivasa <pks@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Reviewed-by: Chris Williamson <chris.williamson@delphix.com>
Reviewed-by: Pavel Zhakarov <pavel.zakharov@delphix.com>
Reviewed-by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #7958
2019-06-19 16:48:13 +00:00
|
|
|
EXPORT_SYMBOL(entity_namecheck);
|
2010-08-26 18:49:16 +00:00
|
|
|
EXPORT_SYMBOL(pool_namecheck);
|
|
|
|
EXPORT_SYMBOL(dataset_namecheck);
|
2019-11-11 07:24:14 +00:00
|
|
|
EXPORT_SYMBOL(bookmark_namecheck);
|
|
|
|
EXPORT_SYMBOL(snapshot_namecheck);
|
2013-12-11 22:33:41 +00:00
|
|
|
EXPORT_SYMBOL(zfs_component_namecheck);
|
2016-09-12 15:15:20 +00:00
|
|
|
EXPORT_SYMBOL(dataset_nestcheck);
|
|
|
|
EXPORT_SYMBOL(get_dataset_depth);
|
|
|
|
EXPORT_SYMBOL(zfs_max_dataset_nesting);
|
|
|
|
|
2019-09-05 21:49:49 +00:00
|
|
|
ZFS_MODULE_PARAM(zfs, zfs_, max_dataset_nesting, INT, ZMOD_RW,
|
|
|
|
"Limit to the amount of nesting a path can have. Defaults to 50.");
|