Notable upstream pull request merges:
 #15240 bbac1d297 Update the behavior of mountpoint property
 #15240 c63aabaf1 Improve the handling of sharesmb,sharenfs properties
 #15248 741c215ba Fix l2arc_apply_transforms ztest crash
 #15274 ee720ad7b Retire z_nr_znodes
 #15278 90149552b ZIL: Fix potential race on flush deferring
 #15279 e923bcd16 Update the MOS directory on spa_upgrade_errlog()
 #15281 529bec7d7 zed: Allow autoreplace and fault LEDs for removed vdevs
 #15288 7228ba111 cmd: add 'help' subcommand to zpool and zfs
 #15297 4647353c8 status: report pool suspension state under
                  failmode=continue

Obtained from:	OpenZFS
OpenZFS commit:	4647353c8b
This commit is contained in:
Martin Matuska 2023-09-21 11:25:53 +02:00
commit cbfe997563
34 changed files with 264 additions and 98 deletions

View File

@ -6,5 +6,5 @@ Release: 1
Release-Tags: relext
License: CDDL
Author: OpenZFS
Linux-Maximum: 6.4
Linux-Maximum: 6.5
Linux-Minimum: 3.10

View File

@ -372,6 +372,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
/* Only autoreplace bad disks */
if ((vs->vs_state != VDEV_STATE_DEGRADED) &&
(vs->vs_state != VDEV_STATE_FAULTED) &&
(vs->vs_state != VDEV_STATE_REMOVED) &&
(vs->vs_state != VDEV_STATE_CANT_OPEN)) {
zed_log_msg(LOG_INFO, " not autoreplacing since disk isn't in "
"a bad state (currently %llu)", vs->vs_state);

View File

@ -121,7 +121,7 @@ state_to_val()
{
state="$1"
case "$state" in
FAULTED|DEGRADED|UNAVAIL)
FAULTED|DEGRADED|UNAVAIL|REMOVED)
echo 1
;;
ONLINE)

View File

@ -132,6 +132,8 @@ static int zfs_do_zone(int argc, char **argv);
static int zfs_do_unzone(int argc, char **argv);
#endif
static int zfs_do_help(int argc, char **argv);
/*
* Enable a reasonable set of defaults for libumem debugging on DEBUG builds.
*/
@ -606,6 +608,9 @@ usage(boolean_t requested)
(void) fprintf(fp,
gettext("\nFor the delegated permission list, run: %s\n"),
"zfs allow|unallow");
(void) fprintf(fp,
gettext("\nFor further help on a command or topic, "
"run: %s\n"), "zfs help [<topic>]");
}
/*
@ -4202,8 +4207,9 @@ static int
set_callback(zfs_handle_t *zhp, void *data)
{
nvlist_t *props = data;
int ret = zfs_prop_set_list(zhp, props);
if (zfs_prop_set_list(zhp, props) != 0) {
if (ret != 0 || libzfs_errno(g_zfs) != EZFS_SUCCESS) {
switch (libzfs_errno(g_zfs)) {
case EZFS_MOUNTFAILED:
(void) fprintf(stderr, gettext("property may be set "
@ -4214,9 +4220,8 @@ set_callback(zfs_handle_t *zhp, void *data)
"but unable to reshare filesystem\n"));
break;
}
return (1);
}
return (0);
return (ret);
}
static int
@ -8730,6 +8735,25 @@ zfs_do_version(int argc, char **argv)
return (zfs_version_print() != 0);
}
/* Display documentation */
static int
zfs_do_help(int argc, char **argv)
{
char page[MAXNAMELEN];
if (argc < 3 || strcmp(argv[2], "zfs") == 0)
strcpy(page, "zfs");
else if (strcmp(argv[2], "concepts") == 0 ||
strcmp(argv[2], "props") == 0)
snprintf(page, sizeof (page), "zfs%s", argv[2]);
else
snprintf(page, sizeof (page), "zfs-%s", argv[2]);
execlp("man", "man", page, NULL);
fprintf(stderr, "couldn't run man program: %s", strerror(errno));
return (-1);
}
int
main(int argc, char **argv)
{
@ -8785,6 +8809,12 @@ main(int argc, char **argv)
if ((strcmp(cmdname, "-V") == 0) || (strcmp(cmdname, "--version") == 0))
return (zfs_do_version(argc, argv));
/*
* Special case 'help'
*/
if (strcmp(cmdname, "help") == 0)
return (zfs_do_help(argc, argv));
if ((g_zfs = libzfs_init()) == NULL) {
(void) fprintf(stderr, "%s\n", libzfs_error_init(errno));
return (1);

View File

@ -126,6 +126,8 @@ static int zpool_do_version(int, char **);
static int zpool_do_wait(int, char **);
static int zpool_do_help(int argc, char **argv);
static zpool_compat_status_t zpool_do_load_compat(
const char *, boolean_t *);
@ -538,6 +540,10 @@ usage(boolean_t requested)
(void) fprintf(fp, "%s",
get_usage(command_table[i].usage));
}
(void) fprintf(fp,
gettext("\nFor further help on a command or topic, "
"run: %s\n"), "zpool help [<topic>]");
} else {
(void) fprintf(fp, gettext("usage:\n"));
(void) fprintf(fp, "%s", get_usage(current_command->usage));
@ -11051,6 +11057,25 @@ zpool_do_version(int argc, char **argv)
return (zfs_version_print() != 0);
}
/* Display documentation */
static int
zpool_do_help(int argc, char **argv)
{
char page[MAXNAMELEN];
if (argc < 3 || strcmp(argv[2], "zpool") == 0)
strcpy(page, "zpool");
else if (strcmp(argv[2], "concepts") == 0 ||
strcmp(argv[2], "props") == 0)
snprintf(page, sizeof (page), "zpool%s", argv[2]);
else
snprintf(page, sizeof (page), "zpool-%s", argv[2]);
execlp("man", "man", page, NULL);
fprintf(stderr, "couldn't run man program: %s", strerror(errno));
return (-1);
}
/*
* Do zpool_load_compat() and print error message on failure
*/
@ -11118,6 +11143,12 @@ main(int argc, char **argv)
if ((strcmp(cmdname, "-V") == 0) || (strcmp(cmdname, "--version") == 0))
return (zpool_do_version(argc, argv));
/*
* Special case 'help'
*/
if (strcmp(cmdname, "help") == 0)
return (zpool_do_help(argc, argv));
if ((g_zfs = libzfs_init()) == NULL) {
(void) fprintf(stderr, "%s\n", libzfs_error_init(errno));
return (1);

View File

@ -3767,7 +3767,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
else if (ashift > oldvd->vdev_top->vdev_ashift)
expected_error = EDOM;
else if (newvd_is_dspare && pvd != vdev_draid_spare_get_parent(newvd))
expected_error = ENOTSUP;
expected_error = EINVAL;
else
expected_error = 0;

View File

@ -39,12 +39,14 @@
* ASSERT3U() - Assert unsigned X OP Y is true, if not panic.
* ASSERT3P() - Assert pointer X OP Y is true, if not panic.
* ASSERT0() - Assert value is zero, if not panic.
* ASSERT0P() - Assert pointer is null, if not panic.
* VERIFY() - Verify X is true, if not panic.
* VERIFY3B() - Verify boolean X OP Y is true, if not panic.
* VERIFY3S() - Verify signed X OP Y is true, if not panic.
* VERIFY3U() - Verify unsigned X OP Y is true, if not panic.
* VERIFY3P() - Verify pointer X OP Y is true, if not panic.
* VERIFY0() - Verify value is zero, if not panic.
* VERIFY0P() - Verify pointer is null, if not panic.
*/
#ifndef _SPL_DEBUG_H
@ -89,8 +91,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%d " #OP " %d)\n", \
(boolean_t)(_verify3_left), \
(boolean_t)(_verify3_right)); \
(boolean_t)_verify3_left, \
(boolean_t)_verify3_right); \
} while (0)
#define VERIFY3S(LEFT, OP, RIGHT) do { \
@ -100,8 +102,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%lld " #OP " %lld)\n", \
(long long) (_verify3_left), \
(long long) (_verify3_right)); \
(long long)_verify3_left, \
(long long)_verify3_right); \
} while (0)
#define VERIFY3U(LEFT, OP, RIGHT) do { \
@ -111,8 +113,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%llu " #OP " %llu)\n", \
(unsigned long long) (_verify3_left), \
(unsigned long long) (_verify3_right)); \
(unsigned long long)_verify3_left, \
(unsigned long long)_verify3_right); \
} while (0)
#define VERIFY3P(LEFT, OP, RIGHT) do { \
@ -121,19 +123,27 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
if (unlikely(!(_verify3_left OP _verify3_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%px " #OP " %px)\n", \
(void *) (_verify3_left), \
(void *) (_verify3_right)); \
"failed (%p " #OP " %p)\n", \
(void *)_verify3_left, \
(void *)_verify3_right); \
} while (0)
#define VERIFY0(RIGHT) do { \
const int64_t _verify3_left = (int64_t)(0); \
const int64_t _verify3_right = (int64_t)(RIGHT); \
if (unlikely(!(_verify3_left == _verify3_right))) \
const int64_t _verify0_right = (int64_t)(RIGHT); \
if (unlikely(!(0 == _verify0_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY0(0 == " #RIGHT ") " \
"VERIFY0(" #RIGHT ") " \
"failed (0 == %lld)\n", \
(long long) (_verify3_right)); \
(long long)_verify0_right); \
} while (0)
#define VERIFY0P(RIGHT) do { \
const uintptr_t _verify0_right = (uintptr_t)(RIGHT); \
if (unlikely(!(0 == _verify0_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY0P(" #RIGHT ") " \
"failed (NULL == %p)\n", \
(void *)_verify0_right); \
} while (0)
/*
@ -151,6 +161,7 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
#define ASSERT3P(x, y, z) \
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
#define ASSERT0(x) ((void) sizeof ((uintptr_t)(x)))
#define ASSERT0P(x) ((void) sizeof ((uintptr_t)(x)))
#define IMPLY(A, B) \
((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B)))
#define EQUIV(A, B) \
@ -166,6 +177,7 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
#define ASSERT3U VERIFY3U
#define ASSERT3P VERIFY3P
#define ASSERT0 VERIFY0
#define ASSERT0P VERIFY0P
#define ASSERT VERIFY
#define IMPLY(A, B) \
((void)(likely((!(A)) || (B)) || \

View File

@ -34,12 +34,14 @@
* ASSERT3U() - Assert unsigned X OP Y is true, if not panic.
* ASSERT3P() - Assert pointer X OP Y is true, if not panic.
* ASSERT0() - Assert value is zero, if not panic.
* ASSERT0P() - Assert pointer is null, if not panic.
* VERIFY() - Verify X is true, if not panic.
* VERIFY3B() - Verify boolean X OP Y is true, if not panic.
* VERIFY3S() - Verify signed X OP Y is true, if not panic.
* VERIFY3U() - Verify unsigned X OP Y is true, if not panic.
* VERIFY3P() - Verify pointer X OP Y is true, if not panic.
* VERIFY0() - Verify value is zero, if not panic.
* VERIFY0P() - Verify pointer is null, if not panic.
*/
#ifndef _SPL_DEBUG_H
@ -93,8 +95,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%d " #OP " %d)\n", \
(boolean_t)(_verify3_left), \
(boolean_t)(_verify3_right)); \
(boolean_t)_verify3_left, \
(boolean_t)_verify3_right); \
} while (0)
#define VERIFY3S(LEFT, OP, RIGHT) do { \
@ -104,8 +106,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%lld " #OP " %lld)\n", \
(long long)(_verify3_left), \
(long long)(_verify3_right)); \
(long long)_verify3_left, \
(long long)_verify3_right); \
} while (0)
#define VERIFY3U(LEFT, OP, RIGHT) do { \
@ -115,8 +117,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%llu " #OP " %llu)\n", \
(unsigned long long)(_verify3_left), \
(unsigned long long)(_verify3_right)); \
(unsigned long long)_verify3_left, \
(unsigned long long)_verify3_right); \
} while (0)
#define VERIFY3P(LEFT, OP, RIGHT) do { \
@ -126,18 +128,26 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%px " #OP " %px)\n", \
(void *) (_verify3_left), \
(void *) (_verify3_right)); \
(void *)_verify3_left, \
(void *)_verify3_right); \
} while (0)
#define VERIFY0(RIGHT) do { \
const int64_t _verify3_left = (int64_t)(0); \
const int64_t _verify3_right = (int64_t)(RIGHT); \
if (unlikely(!(_verify3_left == _verify3_right))) \
const int64_t _verify0_right = (int64_t)(RIGHT); \
if (unlikely(!(0 == _verify0_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY0(0 == " #RIGHT ") " \
"VERIFY0(" #RIGHT ") " \
"failed (0 == %lld)\n", \
(long long) (_verify3_right)); \
(long long)_verify0_right); \
} while (0)
#define VERIFY0P(RIGHT) do { \
const uintptr_t _verify0_right = (uintptr_t)(RIGHT); \
if (unlikely(!(0 == _verify0_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY0P(" #RIGHT ") " \
"failed (NULL == %px)\n", \
(void *)_verify0_right); \
} while (0)
#define VERIFY_IMPLY(A, B) \
@ -165,6 +175,7 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
#define ASSERT3P(x, y, z) \
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
#define ASSERT0(x) ((void) sizeof ((uintptr_t)(x)))
#define ASSERT0P(x) ((void) sizeof ((uintptr_t)(x)))
#define IMPLY(A, B) \
((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B)))
#define EQUIV(A, B) \
@ -180,6 +191,7 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
#define ASSERT3U VERIFY3U
#define ASSERT3P VERIFY3P
#define ASSERT0 VERIFY0
#define ASSERT0P VERIFY0P
#define ASSERT VERIFY
#define IMPLY VERIFY_IMPLY
#define EQUIV VERIFY_EQUIV

View File

@ -105,7 +105,6 @@ struct zfsvfs {
rrmlock_t z_teardown_lock;
krwlock_t z_teardown_inactive_lock;
list_t z_all_znodes; /* all znodes in the fs */
uint64_t z_nr_znodes; /* number of znodes in the fs */
unsigned long z_rollback_time; /* last online rollback time */
unsigned long z_snap_defer_time; /* last snapshot unmount deferral */
kmutex_t z_znodes_lock; /* lock for z_all_znodes */

View File

@ -161,7 +161,8 @@ nfs_is_shared(sa_share_impl_t impl_share)
static int
nfs_validate_shareopts(const char *shareopts)
{
(void) shareopts;
if (strlen(shareopts) == 0)
return (SA_SYNTAX_ERR);
return (SA_OK);
}

View File

@ -319,12 +319,49 @@ get_linux_shareopts_cb(const char *key, const char *value, void *cookie)
"wdelay" };
char **plinux_opts = (char **)cookie;
char *host, *val_dup, *literal, *next;
/* host-specific options, these are taken care of elsewhere */
if (strcmp(key, "ro") == 0 || strcmp(key, "rw") == 0 ||
strcmp(key, "sec") == 0)
if (strcmp(key, "sec") == 0)
return (SA_OK);
if (strcmp(key, "ro") == 0 || strcmp(key, "rw") == 0) {
if (value == NULL || strlen(value) == 0)
return (SA_OK);
val_dup = strdup(value);
host = val_dup;
if (host == NULL)
return (SA_NO_MEMORY);
do {
if (*host == '[') {
host++;
literal = strchr(host, ']');
if (literal == NULL) {
free(val_dup);
return (SA_SYNTAX_ERR);
}
if (literal[1] == '\0')
next = NULL;
else if (literal[1] == '/') {
next = strchr(literal + 2, ':');
if (next != NULL)
++next;
} else if (literal[1] == ':')
next = literal + 2;
else {
free(val_dup);
return (SA_SYNTAX_ERR);
}
} else {
next = strchr(host, ':');
if (next != NULL)
++next;
}
host = next;
} while (host != NULL);
free(val_dup);
return (SA_OK);
}
if (strcmp(key, "anon") == 0)
key = "anonuid";
@ -472,6 +509,10 @@ static int
nfs_validate_shareopts(const char *shareopts)
{
char *linux_opts = NULL;
if (strlen(shareopts) == 0)
return (SA_SYNTAX_ERR);
int error = get_linux_shareopts(shareopts, &linux_opts);
if (error != SA_OK)
return (error);

View File

@ -107,8 +107,8 @@ do { \
const uintptr_t __right = (uintptr_t)(RIGHT); \
if (!(__left OP __right)) \
libspl_assertf(__FILE__, __FUNCTION__, __LINE__, \
"%s %s %s (0x%llx %s 0x%llx)", #LEFT, #OP, #RIGHT, \
(u_longlong_t)__left, #OP, (u_longlong_t)__right); \
"%s %s %s (%p %s %p)", #LEFT, #OP, #RIGHT, \
(void *)__left, #OP, (void *)__right); \
} while (0)
#define VERIFY0(LEFT) \
@ -120,6 +120,15 @@ do { \
(u_longlong_t)__left); \
} while (0)
#define VERIFY0P(LEFT) \
do { \
const uintptr_t __left = (uintptr_t)(LEFT); \
if (!(__left == 0)) \
libspl_assertf(__FILE__, __FUNCTION__, __LINE__, \
"%s == 0 (%p == 0)", #LEFT, \
(void *)__left); \
} while (0)
#ifdef assert
#undef assert
#endif
@ -134,6 +143,7 @@ do { \
#define ASSERT3P(x, y, z) \
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
#define ASSERT0(x) ((void) sizeof ((uintptr_t)(x)))
#define ASSERT0P(x) ((void) sizeof ((uintptr_t)(x)))
#define ASSERT(x) ((void) sizeof ((uintptr_t)(x)))
#define assert(x) ((void) sizeof ((uintptr_t)(x)))
#define IMPLY(A, B) \
@ -146,6 +156,7 @@ do { \
#define ASSERT3U VERIFY3U
#define ASSERT3P VERIFY3P
#define ASSERT0 VERIFY0
#define ASSERT0P VERIFY0P
#define ASSERT VERIFY
#define assert VERIFY
#define IMPLY(A, B) \

View File

@ -174,7 +174,6 @@ changelist_postfix(prop_changelist_t *clp)
prop_changenode_t *cn;
uu_avl_walk_t *walk;
char shareopts[ZFS_MAXPROPLEN];
int errors = 0;
boolean_t commit_smb_shares = B_FALSE;
boolean_t commit_nfs_shares = B_FALSE;
@ -244,13 +243,13 @@ changelist_postfix(prop_changelist_t *clp)
zfs_is_mounted(cn->cn_handle, NULL);
if (!mounted && !needs_key && (cn->cn_mounted ||
((sharenfs || sharesmb || clp->cl_waslegacy) &&
(((clp->cl_prop == ZFS_PROP_MOUNTPOINT &&
clp->cl_prop == clp->cl_realprop) ||
sharenfs || sharesmb || clp->cl_waslegacy) &&
(zfs_prop_get_int(cn->cn_handle,
ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON)))) {
if (zfs_mount(cn->cn_handle, NULL, 0) != 0)
errors++;
else
if (zfs_mount(cn->cn_handle, NULL, 0) == 0)
mounted = TRUE;
}
@ -262,19 +261,19 @@ changelist_postfix(prop_changelist_t *clp)
const enum sa_protocol nfs[] =
{SA_PROTOCOL_NFS, SA_NO_PROTOCOL};
if (sharenfs && mounted) {
errors += zfs_share(cn->cn_handle, nfs);
zfs_share(cn->cn_handle, nfs);
commit_nfs_shares = B_TRUE;
} else if (cn->cn_shared || clp->cl_waslegacy) {
errors += zfs_unshare(cn->cn_handle, NULL, nfs);
zfs_unshare(cn->cn_handle, NULL, nfs);
commit_nfs_shares = B_TRUE;
}
const enum sa_protocol smb[] =
{SA_PROTOCOL_SMB, SA_NO_PROTOCOL};
if (sharesmb && mounted) {
errors += zfs_share(cn->cn_handle, smb);
zfs_share(cn->cn_handle, smb);
commit_smb_shares = B_TRUE;
} else if (cn->cn_shared || clp->cl_waslegacy) {
errors += zfs_unshare(cn->cn_handle, NULL, smb);
zfs_unshare(cn->cn_handle, NULL, smb);
commit_smb_shares = B_TRUE;
}
}
@ -288,7 +287,7 @@ changelist_postfix(prop_changelist_t *clp)
zfs_commit_shares(proto);
uu_avl_walk_end(walk);
return (errors ? -1 : 0);
return (0);
}
/*

View File

@ -29,7 +29,7 @@
* Copyright (c) 2017, Intel Corporation.
* Copyright (c) 2018, loli10K <ezomori.nozomu@gmail.com>
* Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
* Copyright (c) 2021, Klara Inc.
* Copyright (c) 2021, 2023, Klara Inc.
*/
#include <errno.h>
@ -255,6 +255,7 @@ zpool_get_state_str(zpool_handle_t *zhp)
if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
str = gettext("FAULTED");
} else if (status == ZPOOL_STATUS_IO_FAILURE_WAIT ||
status == ZPOOL_STATUS_IO_FAILURE_CONTINUE ||
status == ZPOOL_STATUS_IO_FAILURE_MMP) {
str = gettext("SUSPENDED");
} else {

View File

@ -650,10 +650,12 @@ send_worker(void *arg)
unsigned int bufsiz = max_pipe_buffer(ctx->from);
ssize_t rd;
while ((rd = splice(ctx->from, NULL, ctx->to, NULL, bufsiz,
SPLICE_F_MOVE | SPLICE_F_MORE)) > 0)
;
for (;;) {
rd = splice(ctx->from, NULL, ctx->to, NULL, bufsiz,
SPLICE_F_MOVE | SPLICE_F_MORE);
if ((rd == -1 && errno != EINTR) || rd == 0)
break;
}
int err = (rd == -1) ? errno : 0;
close(ctx->from);
return ((void *)(uintptr_t)err);

View File

@ -203,11 +203,9 @@ For more information, see the
section.
.El
.Pp
Virtual devices cannot be nested, so a mirror or raidz virtual device can only
contain files or disks.
Mirrors of mirrors
.Pq or other combinations
are not allowed.
Virtual devices cannot be nested arbitrarily.
A mirror, raidz or draid virtual device can only be created with files or disks.
Mirrors of mirrors or other such combinations are not allowed.
.Pp
A pool can have any number of virtual devices at the top of the configuration
.Po known as

View File

@ -168,4 +168,4 @@ gen-zstd-symbols:
for obj in $(addprefix zstd/,$(ZSTD_UPSTREAM_OBJS)); do echo; echo "/* $${obj#zstd/}: */"; @OBJDUMP@ -t $$obj | awk '$$2 == "g" && !/ zfs_/ {print "#define\t" $$6 " zfs_" $$6}' | sort; done >> zstd/include/zstd_compat_wrapper.h
check-zstd-symbols:
@OBJDUMP@ -t $(addprefix zstd/,$(ZSTD_UPSTREAM_OBJS)) | awk '/file format/ {print} $$2 == "g" && !/ zfs_/ {++ret; print} END {exit ret}'
@OBJDUMP@ -t $(addprefix zstd/,$(ZSTD_UPSTREAM_OBJS)) | awk '/file format/ {print} $$2 == "g" && (!/ zfs_/ && !/ __pfx_zfs_/) {++ret; print} END {exit ret}'

View File

@ -537,7 +537,6 @@ zfsctl_inode_alloc(zfsvfs_t *zfsvfs, uint64_t id,
mutex_enter(&zfsvfs->z_znodes_lock);
list_insert_tail(&zfsvfs->z_all_znodes, zp);
zfsvfs->z_nr_znodes++;
membar_producer();
mutex_exit(&zfsvfs->z_znodes_lock);

View File

@ -1330,12 +1330,11 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
* may add the parents of dir-based xattrs to the taskq
* so we want to wait for these.
*
* We can safely read z_nr_znodes without locking because the
* VFS has already blocked operations which add to the
* z_all_znodes list and thus increment z_nr_znodes.
* We can safely check z_all_znodes for being empty because the
* VFS has already blocked operations which add to it.
*/
int round = 0;
while (zfsvfs->z_nr_znodes > 0) {
while (!list_is_empty(&zfsvfs->z_all_znodes)) {
taskq_wait_outstanding(dsl_pool_zrele_taskq(
dmu_objset_pool(zfsvfs->z_os)), 0);
if (++round > 1 && !unmounting)

View File

@ -390,7 +390,6 @@ zfs_inode_destroy(struct inode *ip)
mutex_enter(&zfsvfs->z_znodes_lock);
if (list_link_active(&zp->z_link_node)) {
list_remove(&zfsvfs->z_all_znodes, zp);
zfsvfs->z_nr_znodes--;
}
mutex_exit(&zfsvfs->z_znodes_lock);
@ -641,7 +640,6 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
mutex_enter(&zfsvfs->z_znodes_lock);
list_insert_tail(&zfsvfs->z_all_znodes, zp);
zfsvfs->z_nr_znodes++;
mutex_exit(&zfsvfs->z_znodes_lock);
if (links > 0)

View File

@ -9092,15 +9092,16 @@ l2arc_apply_transforms(spa_t *spa, arc_buf_hdr_t *hdr, uint64_t asize,
* write things before deciding to fail compression in nearly
* every case.)
*/
cabd = abd_alloc_for_io(size, ismd);
tmp = abd_borrow_buf(cabd, size);
uint64_t bufsize = MAX(size, asize);
cabd = abd_alloc_for_io(bufsize, ismd);
tmp = abd_borrow_buf(cabd, bufsize);
psize = zio_compress_data(compress, to_write, &tmp, size,
hdr->b_complevel);
if (psize >= asize) {
psize = HDR_GET_PSIZE(hdr);
abd_return_buf_copy(cabd, tmp, size);
abd_return_buf_copy(cabd, tmp, bufsize);
HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_OFF);
to_write = cabd;
abd_copy(to_write, hdr->b_l1hdr.b_pabd, psize);
@ -9110,9 +9111,9 @@ l2arc_apply_transforms(spa_t *spa, arc_buf_hdr_t *hdr, uint64_t asize,
}
ASSERT3U(psize, <=, HDR_GET_PSIZE(hdr));
if (psize < asize)
memset((char *)tmp + psize, 0, asize - psize);
memset((char *)tmp + psize, 0, bufsize - psize);
psize = HDR_GET_PSIZE(hdr);
abd_return_buf_copy(cabd, tmp, size);
abd_return_buf_copy(cabd, tmp, bufsize);
to_write = cabd;
}

View File

@ -2701,7 +2701,7 @@ dmu_buf_will_clone(dmu_buf_t *db_fake, dmu_tx_t *tx)
*/
mutex_enter(&db->db_mtx);
VERIFY(!dbuf_undirty(db, tx));
ASSERT3P(dbuf_find_dirty_eq(db, tx->tx_txg), ==, NULL);
ASSERT0P(dbuf_find_dirty_eq(db, tx->tx_txg));
if (db->db_buf != NULL) {
arc_buf_destroy(db->db_buf, db);
db->db_buf = NULL;

View File

@ -930,12 +930,21 @@ spa_upgrade_errlog(spa_t *spa, dmu_tx_t *tx)
if (spa->spa_errlog_last != 0) {
sync_upgrade_errlog(spa, spa->spa_errlog_last, &newobj, tx);
spa->spa_errlog_last = newobj;
(void) zap_update(spa->spa_meta_objset,
DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_ERRLOG_LAST,
sizeof (uint64_t), 1, &spa->spa_errlog_last, tx);
}
if (spa->spa_errlog_scrub != 0) {
sync_upgrade_errlog(spa, spa->spa_errlog_scrub, &newobj, tx);
spa->spa_errlog_scrub = newobj;
(void) zap_update(spa->spa_meta_objset,
DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_ERRLOG_SCRUB,
sizeof (uint64_t), 1, &spa->spa_errlog_scrub, tx);
}
mutex_exit(&spa->spa_errlog_lock);
}

View File

@ -27,6 +27,7 @@
* Copyright (c) 2017 Datto Inc.
* Copyright (c) 2017, Intel Corporation.
* Copyright (c) 2019, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
* Copyright (c) 2023, Klara Inc.
*/
#include <sys/zfs_context.h>
@ -2762,8 +2763,7 @@ spa_state_to_name(spa_t *spa)
vdev_state_t state = rvd->vdev_state;
vdev_aux_t aux = rvd->vdev_stat.vs_aux;
if (spa_suspended(spa) &&
(spa_get_failmode(spa) != ZIO_FAILURE_MODE_CONTINUE))
if (spa_suspended(spa))
return ("SUSPENDED");
switch (state) {

View File

@ -1550,7 +1550,16 @@ zil_lwb_write_done(zio_t *zio)
lwb->lwb_state = LWB_STATE_WRITE_DONE;
lwb->lwb_child_zio = NULL;
lwb->lwb_write_zio = NULL;
/*
* If nlwb is not yet issued, zil_lwb_set_zio_dependency() is not
* called for it yet, and when it will be, it won't be able to make
* its write ZIO a parent this ZIO. In such case we can not defer
* our flushes or below may be a race between the done callbacks.
*/
nlwb = list_next(&zilog->zl_lwb_list, lwb);
if (nlwb && nlwb->lwb_state != LWB_STATE_ISSUED)
nlwb = NULL;
mutex_exit(&zilog->zl_lock);
if (avl_numnodes(t) == 0)

View File

@ -1588,7 +1588,9 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
functional/online_offline/setup.ksh \
functional/pam/cleanup.ksh \
functional/pam/pam_basic.ksh \
functional/pam/pam_change_unmounted.ksh \
functional/pam/pam_nounmount.ksh \
functional/pam/pam_recursive.ksh \
functional/pam/pam_short_password.ksh \
functional/pam/setup.ksh \
functional/pool_checkpoint/checkpoint_after_rewind.ksh \

View File

@ -94,7 +94,7 @@ while (( depth < MAXDEPTH )); do
done
log_must zfs set mountpoint=$mtpt $TESTPOOL/$TESTFS
log_must zfs $mountcmd $TESTPOOL/$TESTFS
log_must ismounted $TESTPOOL/$TESTFS
log_must zfs set overlay=off $TESTPOOL/$TESTFS
if ! is_illumos; then

View File

@ -71,7 +71,7 @@ log_must mkfile 1M $testfile $testfile1
log_must zfs unmount $fs1
log_must zfs set mountpoint=$mntpnt $fs1
log_must zfs mount $fs1
log_must ismounted $fs1
log_must zfs unmount $fs1
log_must zfs mount -O $fs1
@ -85,7 +85,7 @@ log_must ls $mntpnt/$TESTFILE1 $mntpnt/$TESTFILE2
# Verify $TESTFILE2 was created in $fs1, rather than $fs
log_must zfs unmount $fs1
log_must zfs set mountpoint=$mntpnt1 $fs1
log_must zfs mount $fs1
log_must ismounted $fs1
log_must ls $testfile1 $mntpnt1/$TESTFILE2
# Verify $TESTFILE2 was not created in $fs, and $fs is accessible again.

View File

@ -25,13 +25,12 @@
# STRATEGY:
# 1. Unmount the dataset
# 2. Create a new empty directory
# 3. Set the dataset's mountpoint
# 4. Attempt to mount the dataset
# 5. Verify the mount succeeds
# 6. Unmount the dataset
# 7. Create a file in the directory created in step 2
# 8. Attempt to mount the dataset
# 9. Verify the mount succeeds
# 3. Set the dataset's mountpoint, this should mount the dataset
# 4. Verify the mount succeeds
# 5. Unmount the dataset
# 6. Create a file in the directory created in step 2
# 7. Attempt to mount the dataset
# 8. Verify the mount succeeds
#
verify_runnable "both"
@ -43,7 +42,7 @@ fs=$TESTPOOL/$TESTFS
log_must zfs umount $fs
log_must mkdir -p $TESTDIR
log_must zfs set mountpoint=$TESTDIR $fs
log_must zfs mount $fs
log_must ismounted $fs
log_must zfs umount $fs
log_must touch $TESTDIR/testfile.$$
log_must zfs mount $fs

View File

@ -117,7 +117,9 @@ usage:
For the property list, run: zfs set|get
For the delegated permission list, run: zfs allow|unallow")
For the delegated permission list, run: zfs allow|unallow
For further help on a command or topic, run: zfs help [<topic>]")
cnt=0
for cmd in ${neg_cmds[@]}; do
log_mustnot zfs program $cmd $TESTPOOL $TESTZCP $TESTDS 2>&1

View File

@ -35,7 +35,9 @@
#
# DESCRIPTION:
# If ZFS is currently managing the file system but it is currently unmounted,
# and the mountpoint property is changed, the file system remains unmounted.
# and the mountpoint property is changed, the file system should be mounted
# if it is a valid mountpoint and canmount allows to mount, otherwise it
# should not be mounted.
#
# STRATEGY:
# 1. Setup a pool and create fs, ctr within it.
@ -62,7 +64,7 @@ function cleanup
}
log_assert "Setting a valid mountpoint for an unmounted file system, \
it remains unmounted."
it gets mounted."
log_onexit cleanup
old_fs_mpt=$(get_prop mountpoint $TESTPOOL/$TESTFS)
@ -83,7 +85,11 @@ while (( i < ${#dataset[@]} )); do
while (( j < ${#values[@]} )); do
set_n_check_prop "${values[j]}" "mountpoint" \
"${dataset[i]}"
log_mustnot ismounted ${dataset[i]}
if [ "${dataset[i]}" = "$TESTPOOL/$TESTFS" ]; then
log_must ismounted ${dataset[i]}
else
log_mustnot ismounted ${dataset[i]}
fi
(( j += 1 ))
done
cleanup

View File

@ -33,7 +33,9 @@
#
# DESCRIPTION:
# 'zfs set mountpoint/sharenfs' should fail when the mountpoint is invalid
# 'zfs set mountpoint/sharenfs' should set the property when mountpoint
# is invalid. Setting the property should be successful, but dataset
# should not be mounted, as mountpoint is invalid.
#
# STRATEGY:
# 1. Create invalid scenarios
@ -62,10 +64,12 @@ longpath=$(gen_dataset_name 1030 "abcdefg")
log_must zfs create -o mountpoint=legacy $TESTPOOL/foo
# Do the negative testing about "property may be set but unable to remount filesystem"
log_mustnot eval "zfs set mountpoint=$badpath $TESTPOOL/foo >/dev/null 2>&1"
set_n_check_prop "$badpath" "mountpoint" "$TESTPOOL/foo"
log_mustnot ismounted $TESTPOOL/foo
# Do the negative testing about "property may be set but unable to reshare filesystem"
log_mustnot eval "zfs set sharenfs=on $TESTPOOL/foo >/dev/null 2>&1"
set_n_check_prop "on" "sharenfs" "$TESTPOOL/foo"
log_mustnot ismounted $TESTPOOL/foo
# Do the negative testing about "sharenfs property can not be set to null"
log_mustnot eval "zfs set sharenfs= $TESTPOOL/foo >/dev/null 2>&1"

View File

@ -1095,7 +1095,7 @@
/* #undef ZFS_IS_GPL_COMPATIBLE */
/* Define the project alias string. */
#define ZFS_META_ALIAS "zfs-2.2.99-FreeBSD_g0ee9b0239"
#define ZFS_META_ALIAS "zfs-2.2.99-FreeBSD_g4647353c8"
/* Define the project author. */
#define ZFS_META_AUTHOR "OpenZFS"
@ -1104,7 +1104,7 @@
/* #undef ZFS_META_DATA */
/* Define the maximum compatible kernel version. */
#define ZFS_META_KVER_MAX "6.4"
#define ZFS_META_KVER_MAX "6.5"
/* Define the minimum compatible kernel version. */
#define ZFS_META_KVER_MIN "3.10"
@ -1125,7 +1125,7 @@
#define ZFS_META_NAME "zfs"
/* Define the project release. */
#define ZFS_META_RELEASE "FreeBSD_g0ee9b0239"
#define ZFS_META_RELEASE "FreeBSD_g4647353c8"
/* Define the project version. */
#define ZFS_META_VERSION "2.2.99"

View File

@ -1 +1 @@
#define ZFS_META_GITREV "zfs-2.2.99-85-g0ee9b0239"
#define ZFS_META_GITREV "zfs-2.2.99-103-g4647353c8"