Update vendor/openzfs to openzfs/zfs/master@3522f57b6

Notable upstream pull request merges:
  #11742 When specifying raidz vdev name, parity count should match
  #11744 Use a helper function to clarify gang block size
  #11771 Support running FreeBSD buildworld on Arm-based macOS hosts
This commit is contained in:
Martin Matuska 2021-04-14 08:03:07 +02:00
parent 48a1c304e8
commit d76d37d9c3
28 changed files with 160 additions and 36 deletions

10
.editorconfig Normal file
View File

@ -0,0 +1,10 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{c,h}]
tab_width = 8
indent_style = tab

70
.gitignore vendored Normal file
View File

@ -0,0 +1,70 @@
#
# N.B.
# This is the toplevel .gitignore file.
# This is not the place for entries that are specific to
# a subdirectory. Instead add those files to the
# .gitignore file in that subdirectory.
#
# N.B.
# Please use 'git ls-files -i --exclude-standard'
# command after changing this file, to see if there are
# any tracked files which get ignored after the change.
#
# Normal rules
#
*.[oa]
*.o.ur-safe
*.lo
*.la
*.mod.c
*~
*.swp
*.gcno
*.gcda
*.pyc
*.pyo
.deps
.libs
.dirstamp
.DS_Store
modules.order
Makefile
Makefile.in
#
# Top level generated files specific to this top level dir
#
/bin
/build
/configure
/config.log
/config.status
/libtool
/zfs_config.h
/zfs_config.h.in
/zfs.release
/stamp-h1
/aclocal.m4
/autom4te.cache
#
# Top level generic files
#
!.gitignore
tags
TAGS
current
cscope.*
*.rpm
*.deb
*.tar.gz
*.patch
*.orig
*.log
*.tmp
venv
*.so
*.so.debug
*.so.full

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "scripts/zfs-images"]
path = scripts/zfs-images
url = https://github.com/zfsonlinux/zfs-images

2
META
View File

@ -1,7 +1,7 @@
Meta: 1 Meta: 1
Name: zfs Name: zfs
Branch: 1.0 Branch: 1.0
Version: 2.0.0 Version: 2.1.0
Release: rc1 Release: rc1
Release-Tags: relext Release-Tags: relext
License: CDDL License: CDDL

View File

@ -31,8 +31,6 @@
#include <sys/vdev_raidz_impl.h> #include <sys/vdev_raidz_impl.h>
#include <stdio.h> #include <stdio.h>
#include <sys/time.h>
#include "raidz_test.h" #include "raidz_test.h"
#define GEN_BENCH_MEMORY (((uint64_t)1ULL)<<32) #define GEN_BENCH_MEMORY (((uint64_t)1ULL)<<32)

View File

@ -173,6 +173,7 @@ _zed_exec_fork_child(uint64_t eid, const char *dir, const char *prog,
zed_log_msg(LOG_WARNING, "Killing hung \"%s\" pid=%d", zed_log_msg(LOG_WARNING, "Killing hung \"%s\" pid=%d",
prog, pid); prog, pid);
(void) kill(pid, SIGKILL); (void) kill(pid, SIGKILL);
(void) waitpid(pid, &status, 0);
} }
} }

View File

@ -53,7 +53,6 @@
#include <grp.h> #include <grp.h>
#include <pwd.h> #include <pwd.h>
#include <signal.h> #include <signal.h>
#include <sys/debug.h>
#include <sys/list.h> #include <sys/list.h>
#include <sys/mkdev.h> #include <sys/mkdev.h>
#include <sys/mntent.h> #include <sys/mntent.h>
@ -71,7 +70,6 @@
#include <zfs_prop.h> #include <zfs_prop.h>
#include <zfs_deleg.h> #include <zfs_deleg.h>
#include <libzutil.h> #include <libzutil.h>
#include <libuutil.h>
#ifdef HAVE_IDMAP #ifdef HAVE_IDMAP
#include <aclutils.h> #include <aclutils.h>
#include <directory.h> #include <directory.h>

View File

@ -79,9 +79,6 @@
#include <scsi/scsi.h> #include <scsi/scsi.h>
#include <scsi/sg.h> #include <scsi/sg.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/efi_partition.h> #include <sys/efi_partition.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/vtoc.h> #include <sys/vtoc.h>

View File

@ -1062,7 +1062,7 @@ def test_bookmarks_empty(self):
lzc.lzc_bookmark({}) lzc.lzc_bookmark({})
@skipUnlessBookmarksSupported @skipUnlessBookmarksSupported
def test_bookmarks_foregin_source(self): def test_bookmarks_foreign_source(self):
snaps = [ZFSTest.pool.makeName(b'fs1@snap1')] snaps = [ZFSTest.pool.makeName(b'fs1@snap1')]
bmarks = [ZFSTest.pool.makeName(b'fs2#bmark1')] bmarks = [ZFSTest.pool.makeName(b'fs2#bmark1')]
bmark_dict = {x: y for x, y in zip(bmarks, snaps)} bmark_dict = {x: y for x, y in zip(bmarks, snaps)}

View File

@ -34,7 +34,6 @@
#include <sys/dsl_dataset.h> #include <sys/dsl_dataset.h>
#include <sys/spa.h> #include <sys/spa.h>
#include <sys/objlist.h> #include <sys/objlist.h>
#include <sys/dsl_bookmark.h>
extern const char *recv_clone_name; extern const char *recv_clone_name;

View File

@ -34,7 +34,6 @@
#include <sys/dsl_bookmark.h> #include <sys/dsl_bookmark.h>
#include <sys/spa.h> #include <sys/spa.h>
#include <sys/objlist.h> #include <sys/objlist.h>
#include <sys/dsl_bookmark.h>
#include <sys/dmu_redact.h> #include <sys/dmu_redact.h>
#define BEGINNV_REDACT_SNAPS "redact_snaps" #define BEGINNV_REDACT_SNAPS "redact_snaps"

View File

@ -405,6 +405,12 @@ typedef struct blkptr {
/* /*
* Macros to get and set fields in a bp or DVA. * Macros to get and set fields in a bp or DVA.
*/ */
/*
* Note, for gang blocks, DVA_GET_ASIZE() is the total space allocated for
* this gang DVA including its children BP's. The space allocated at this
* DVA's vdev/offset is vdev_gang_header_asize(vdev).
*/
#define DVA_GET_ASIZE(dva) \ #define DVA_GET_ASIZE(dva) \
BF64_GET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, SPA_MINBLOCKSHIFT, 0) BF64_GET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, SPA_MINBLOCKSHIFT, 0)
#define DVA_SET_ASIZE(dva, x) \ #define DVA_SET_ASIZE(dva, x) \

View File

@ -133,6 +133,15 @@ extern int64_t vdev_deflated_space(vdev_t *vd, int64_t space);
extern uint64_t vdev_psize_to_asize(vdev_t *vd, uint64_t psize); extern uint64_t vdev_psize_to_asize(vdev_t *vd, uint64_t psize);
/*
* Return the amount of space allocated for a gang block header.
*/
static inline uint64_t
vdev_gang_header_asize(vdev_t *vd)
{
return (vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE));
}
extern int vdev_fault(spa_t *spa, uint64_t guid, vdev_aux_t aux); extern int vdev_fault(spa_t *spa, uint64_t guid, vdev_aux_t aux);
extern int vdev_degrade(spa_t *spa, uint64_t guid, vdev_aux_t aux); extern int vdev_degrade(spa_t *spa, uint64_t guid, vdev_aux_t aux);
extern int vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, extern int vdev_online(spa_t *spa, uint64_t guid, uint64_t flags,

View File

@ -29,6 +29,7 @@
#include_next <sys/stat.h> #include_next <sys/stat.h>
/* Note: this file can be used on linux/macOS when bootstrapping tools. */ /* Note: this file can be used on linux/macOS when bootstrapping tools. */
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
#include <sys/mount.h> /* for BLKGETSIZE64 */ #include <sys/mount.h> /* for BLKGETSIZE64 */
@ -71,4 +72,14 @@ fstat64_blk(int fd, struct stat64 *st)
return (0); return (0);
} }
#endif /* defined(__FreeBSD__) */ #endif /* defined(__FreeBSD__) */
/*
* Only Intel-based Macs have a separate stat64; Arm-based Macs are like
* FreeBSD and have a full 64-bit stat from the start.
*/
#if defined(__APPLE__) && !(defined(__i386__) || defined(__x86_64__))
#define stat64 stat
#define fstat64 fstat
#endif
#endif /* _LIBSPL_SYS_STAT_H */ #endif /* _LIBSPL_SYS_STAT_H */

View File

@ -31,7 +31,6 @@
#include <sys/isa_defs.h> #include <sys/isa_defs.h>
#include <sys/types32.h> #include <sys/types32.h>
#include <sys/isa_defs.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -48,7 +48,6 @@
#include <sys/mount.h> #include <sys/mount.h>
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include <stddef.h>
#include <ucred.h> #include <ucred.h>
#ifdef HAVE_IDMAP #ifdef HAVE_IDMAP
#include <idmap.h> #include <idmap.h>
@ -66,7 +65,6 @@
#include "zfs_namecheck.h" #include "zfs_namecheck.h"
#include "zfs_prop.h" #include "zfs_prop.h"
#include "libzfs_impl.h" #include "libzfs_impl.h"
#include "libzfs.h"
#include "zfs_deleg.h" #include "zfs_deleg.h"
static int userquota_propname_decode(const char *propname, boolean_t zoned, static int userquota_propname_decode(const char *propname, boolean_t zoned,

View File

@ -49,7 +49,6 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <libzutil.h> #include <libzutil.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h>
#include "zfs_namecheck.h" #include "zfs_namecheck.h"
#include "zfs_prop.h" #include "zfs_prop.h"
@ -2670,6 +2669,36 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
errno = 0; errno = 0;
vdev_id = strtoull(idx, &end, 10); vdev_id = strtoull(idx, &end, 10);
/*
* If we are looking for a raidz and a parity is
* specified, make sure it matches.
*/
int rzlen = strlen(VDEV_TYPE_RAIDZ);
assert(rzlen == strlen(VDEV_TYPE_DRAID));
int typlen = strlen(type);
if ((strncmp(type, VDEV_TYPE_RAIDZ, rzlen) == 0 ||
strncmp(type, VDEV_TYPE_DRAID, rzlen) == 0) &&
typlen != rzlen) {
uint64_t vdev_parity;
int parity = *(type + rzlen) - '0';
if (parity <= 0 || parity > 3 ||
(typlen - rzlen) != 1) {
/*
* Nonsense parity specified, can
* never match
*/
free(type);
return (NULL);
}
verify(nvlist_lookup_uint64(nv,
ZPOOL_CONFIG_NPARITY, &vdev_parity) == 0);
if ((int)vdev_parity != parity) {
free(type);
break;
}
}
free(type); free(type);
if (errno != 0) if (errno != 0)
return (NULL); return (NULL);

View File

@ -48,7 +48,6 @@
#include <sys/avl.h> #include <sys/avl.h>
#include <sys/debug.h> #include <sys/debug.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stddef.h>
#include <pthread.h> #include <pthread.h>
#include <umem.h> #include <umem.h>
#include <time.h> #include <time.h>

View File

@ -61,7 +61,6 @@
#include <sys/dktp/fdisk.h> #include <sys/dktp/fdisk.h>
#include <sys/vdev_impl.h> #include <sys/vdev_impl.h>
#include <sys/fs/zfs.h> #include <sys/fs/zfs.h>
#include <sys/vdev_impl.h>
#include <thread_pool.h> #include <thread_pool.h>
#include <libzutil.h> #include <libzutil.h>

View File

@ -62,7 +62,6 @@
#include <sys/dktp/fdisk.h> #include <sys/dktp/fdisk.h>
#include <sys/vdev_impl.h> #include <sys/vdev_impl.h>
#include <sys/fs/zfs.h> #include <sys/fs/zfs.h>
#include <sys/vdev_impl.h>
#include <thread_pool.h> #include <thread_pool.h>
#include <libzutil.h> #include <libzutil.h>

View File

@ -234,8 +234,8 @@ Terminate the daemon.
Events are processed synchronously by a single thread. This can delay the Events are processed synchronously by a single thread. This can delay the
processing of simultaneous zevents. processing of simultaneous zevents.
.PP .PP
There is no maximum timeout for ZEDLET execution. Consequently, a misbehaving ZEDLETs are killed after a maximum of ten seconds.
ZEDLET can delay the processing of subsequent zevents. This can lead to a violation of a ZEDLET's atomicity assumptions.
.PP .PP
The ownership and permissions of the \fIenabled-zedlets\fR directory (along The ownership and permissions of the \fIenabled-zedlets\fR directory (along
with all parent directories) are not checked. If any of these directories with all parent directories) are not checked. If any of these directories

View File

@ -38,7 +38,6 @@
#include <sys/vdev_trim.h> #include <sys/vdev_trim.h>
#include <sys/vdev_impl.h> #include <sys/vdev_impl.h>
#include <sys/dsl_pool.h> #include <sys/dsl_pool.h>
#include <sys/zio_checksum.h>
#include <sys/multilist.h> #include <sys/multilist.h>
#include <sys/abd.h> #include <sys/abd.h>
#include <sys/zil.h> #include <sys/zil.h>

View File

@ -867,7 +867,7 @@ __zpl_ioctl_setflags(struct inode *ip, uint32_t ioctl_flags, xvattr_t *xva)
if ((fchange(ioctl_flags, zfs_flags, FS_IMMUTABLE_FL, ZFS_IMMUTABLE) || if ((fchange(ioctl_flags, zfs_flags, FS_IMMUTABLE_FL, ZFS_IMMUTABLE) ||
fchange(ioctl_flags, zfs_flags, FS_APPEND_FL, ZFS_APPENDONLY)) && fchange(ioctl_flags, zfs_flags, FS_APPEND_FL, ZFS_APPENDONLY)) &&
!capable(CAP_LINUX_IMMUTABLE)) !capable(CAP_LINUX_IMMUTABLE))
return (-EACCES); return (-EPERM);
if (!zpl_inode_owner_or_capable(kcred->user_ns, ip)) if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
return (-EACCES); return (-EACCES);

View File

@ -294,7 +294,6 @@
#include <sys/vdev.h> #include <sys/vdev.h>
#include <sys/vdev_impl.h> #include <sys/vdev_impl.h>
#include <sys/dsl_pool.h> #include <sys/dsl_pool.h>
#include <sys/zio_checksum.h>
#include <sys/multilist.h> #include <sys/multilist.h>
#include <sys/abd.h> #include <sys/abd.h>
#include <sys/zil.h> #include <sys/zil.h>

View File

@ -53,7 +53,6 @@
#include <sys/avl.h> #include <sys/avl.h>
#include <sys/ddt.h> #include <sys/ddt.h>
#include <sys/zfs_onexit.h> #include <sys/zfs_onexit.h>
#include <sys/dmu_send.h>
#include <sys/dsl_destroy.h> #include <sys/dsl_destroy.h>
#include <sys/blkptr.h> #include <sys/blkptr.h>
#include <sys/dsl_bookmark.h> #include <sys/dsl_bookmark.h>

View File

@ -67,7 +67,6 @@
#include <sys/atomic.h> #include <sys/atomic.h>
#include <sys/condvar.h> #include <sys/condvar.h>
#include <sys/console.h> #include <sys/console.h>
#include <sys/time.h>
#include <sys/zfs_ioctl.h> #include <sys/zfs_ioctl.h>
int zfs_zevent_len_max = 0; int zfs_zevent_len_max = 0;

View File

@ -5544,7 +5544,7 @@ metaslab_unalloc_dva(spa_t *spa, const dva_t *dva, uint64_t txg)
ASSERT3P(vd->vdev_indirect_mapping, ==, NULL); ASSERT3P(vd->vdev_indirect_mapping, ==, NULL);
if (DVA_GET_GANG(dva)) if (DVA_GET_GANG(dva))
size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE); size = vdev_gang_header_asize(vd);
msp = vd->vdev_ms[offset >> vd->vdev_ms_shift]; msp = vd->vdev_ms[offset >> vd->vdev_ms_shift];
@ -5579,7 +5579,7 @@ metaslab_free_dva(spa_t *spa, const dva_t *dva, boolean_t checkpoint)
ASSERT3U(spa_config_held(spa, SCL_ALL, RW_READER), !=, 0); ASSERT3U(spa_config_held(spa, SCL_ALL, RW_READER), !=, 0);
if (DVA_GET_GANG(dva)) { if (DVA_GET_GANG(dva)) {
size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE); size = vdev_gang_header_asize(vd);
} }
metaslab_free_impl(vd, offset, size, checkpoint); metaslab_free_impl(vd, offset, size, checkpoint);
@ -5768,7 +5768,7 @@ metaslab_claim_dva(spa_t *spa, const dva_t *dva, uint64_t txg)
ASSERT(DVA_IS_VALID(dva)); ASSERT(DVA_IS_VALID(dva));
if (DVA_GET_GANG(dva)) if (DVA_GET_GANG(dva))
size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE); size = vdev_gang_header_asize(vd);
return (metaslab_claim_impl(vd, offset, size, txg)); return (metaslab_claim_impl(vd, offset, size, txg));
} }
@ -6034,7 +6034,7 @@ metaslab_check_free(spa_t *spa, const blkptr_t *bp)
uint64_t size = DVA_GET_ASIZE(&bp->blk_dva[i]); uint64_t size = DVA_GET_ASIZE(&bp->blk_dva[i]);
if (DVA_GET_GANG(&bp->blk_dva[i])) if (DVA_GET_GANG(&bp->blk_dva[i]))
size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE); size = vdev_gang_header_asize(vd);
ASSERT3P(vd, !=, NULL); ASSERT3P(vd, !=, NULL);

View File

@ -995,7 +995,8 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp, boolean_t config_held,
* that are in the log) to be arbitrarily large. * that are in the log) to be arbitrarily large.
*/ */
for (int i = 0; i < BP_GET_NDVAS(bp); i++) { for (int i = 0; i < BP_GET_NDVAS(bp); i++) {
uint64_t vdevid = DVA_GET_VDEV(&bp->blk_dva[i]); const dva_t *dva = &bp->blk_dva[i];
uint64_t vdevid = DVA_GET_VDEV(dva);
if (vdevid >= spa->spa_root_vdev->vdev_children) { if (vdevid >= spa->spa_root_vdev->vdev_children) {
errors += zfs_blkptr_verify_log(spa, bp, blk_verify, errors += zfs_blkptr_verify_log(spa, bp, blk_verify,
@ -1024,10 +1025,10 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp, boolean_t config_held,
*/ */
continue; continue;
} }
uint64_t offset = DVA_GET_OFFSET(&bp->blk_dva[i]); uint64_t offset = DVA_GET_OFFSET(dva);
uint64_t asize = DVA_GET_ASIZE(&bp->blk_dva[i]); uint64_t asize = DVA_GET_ASIZE(dva);
if (BP_IS_GANG(bp)) if (DVA_GET_GANG(dva))
asize = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE); asize = vdev_gang_header_asize(vd);
if (offset + asize > vd->vdev_asize) { if (offset + asize > vd->vdev_asize) {
errors += zfs_blkptr_verify_log(spa, bp, blk_verify, errors += zfs_blkptr_verify_log(spa, bp, blk_verify,
"blkptr at %p DVA %u has invalid OFFSET %llu", "blkptr at %p DVA %u has invalid OFFSET %llu",
@ -1064,8 +1065,8 @@ zfs_dva_valid(spa_t *spa, const dva_t *dva, const blkptr_t *bp)
uint64_t offset = DVA_GET_OFFSET(dva); uint64_t offset = DVA_GET_OFFSET(dva);
uint64_t asize = DVA_GET_ASIZE(dva); uint64_t asize = DVA_GET_ASIZE(dva);
if (BP_IS_GANG(bp)) if (DVA_GET_GANG(dva))
asize = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE); asize = vdev_gang_header_asize(vd);
if (offset + asize > vd->vdev_asize) if (offset + asize > vd->vdev_asize)
return (B_FALSE); return (B_FALSE);
@ -3984,6 +3985,9 @@ zio_vdev_io_assess(zio_t *zio)
*/ */
if (zio->io_error == ENXIO && zio->io_type == ZIO_TYPE_WRITE && if (zio->io_error == ENXIO && zio->io_type == ZIO_TYPE_WRITE &&
vd != NULL && !vd->vdev_ops->vdev_op_leaf) { vd != NULL && !vd->vdev_ops->vdev_op_leaf) {
vdev_dbgmsg(vd, "zio_vdev_io_assess(zio=%px) setting "
"cant_write=TRUE due to write failure with ENXIO",
zio);
vd->vdev_cant_write = B_TRUE; vd->vdev_cant_write = B_TRUE;
} }