Skip to content

Commit

Permalink
Merge pull request #248 from truenas/NAS-130547-dragonfish
Browse files Browse the repository at this point in the history
NAS-130547 / 24.04.3 / Sync stable/dragonfish with upstream zfs-2.2.5
  • Loading branch information
amotin authored Aug 14, 2024
2 parents 2e68614 + a964222 commit 6704dda
Show file tree
Hide file tree
Showing 48 changed files with 914 additions and 210 deletions.
6 changes: 6 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ Yanping Gao <[email protected]>
Youzhong Yang <[email protected]>

# Signed-off-by: overriding Author:
Ryan <[email protected]> <[email protected]>
Qiuhao Chen <[email protected]> <[email protected]>
Yuxin Wang <[email protected]> <[email protected]>
Zhenlei Huang <[email protected]> <[email protected]>

# Commits from strange places, long ago
Brian Behlendorf <[email protected]> <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Expand All @@ -95,13 +98,15 @@ Alek Pinchuk <[email protected]> <[email protected]>
Alexander Lobakin <[email protected]> <[email protected]>
Alexey Smirnoff <[email protected]> <[email protected]>
Allen Holl <[email protected]> <[email protected]>
Alphan Yılmaz <[email protected]> <[email protected]>
Ameer Hamza <[email protected]> <[email protected]>
Andrew J. Hesford <[email protected]> <[email protected]>>
Andrew Sun <[email protected]> <[email protected]>
Aron Xu <[email protected]> <[email protected]>
Arun KV <[email protected]> <[email protected]>
Ben Wolsieffer <[email protected]> <[email protected]>
bernie1995 <[email protected]> <[email protected]>
Bojan Novković <[email protected]> <[email protected]>
Boris Protopopov <[email protected]> <[email protected]>
Brad Forschinger <[email protected]> <[email protected]>
Brandon Thetford <[email protected]> <[email protected]>
Expand Down Expand Up @@ -193,6 +198,7 @@ Stefan Lendl <[email protected]> <[email protected]>
Thomas Bertschinger <[email protected]> <[email protected]>
Thomas Geppert <[email protected]> <[email protected]>
Tim Crawford <[email protected]> <[email protected]>
Todd Seidelmann <[email protected]>
Tom Matthews <[email protected]> <[email protected]>
Tony Perkins <[email protected]> <[email protected]>
Torsten Wörtwein <[email protected]> <[email protected]>
Expand Down
13 changes: 13 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ CONTRIBUTORS:
Alex Zhuravlev <[email protected]>
Allan Jude <[email protected]>
Allen Holl <[email protected]>
Alphan Yılmaz <[email protected]>
alteriks <[email protected]>
Alyssa Ross <[email protected]>
Ameer Hamza <[email protected]>
Expand Down Expand Up @@ -99,6 +100,7 @@ CONTRIBUTORS:
bernie1995 <[email protected]>
Bill McGonigle <[email protected]>
Bill Pijewski <[email protected]>
Bojan Novković <[email protected]>
Boris Protopopov <[email protected]>
Brad Forschinger <[email protected]>
Brad Lewis <[email protected]>
Expand Down Expand Up @@ -168,6 +170,7 @@ CONTRIBUTORS:
Daniel Hoffman <[email protected]>
Daniel Kobras <[email protected]>
Daniel Kolesa <[email protected]>
Daniel Perry <[email protected]>
Daniel Reichelt <[email protected]>
Daniel Stevenson <[email protected]>
Daniel Verite <[email protected]>
Expand All @@ -187,6 +190,7 @@ CONTRIBUTORS:
Dennis R. Friedrichsen <[email protected]>
Denys Rtveliashvili <[email protected]>
Derek Dai <[email protected]>
Derek Schrock <[email protected]>
Dex Wood <[email protected]>
DHE <[email protected]>
Didier Roche <[email protected]>
Expand Down Expand Up @@ -245,6 +249,7 @@ CONTRIBUTORS:
Gionatan Danti <[email protected]>
Giuseppe Di Natale <[email protected]>
Glenn Washburn <[email protected]>
glibg10b <[email protected]>
gofaster <[email protected]>
Gordan Bobic <[email protected]>
Gordon Bergling <[email protected]>
Expand Down Expand Up @@ -410,6 +415,7 @@ CONTRIBUTORS:
Mart Frauenlob <[email protected]>
Martin Matuska <[email protected]>
Martin Rüegg <[email protected]>
Martin Wagner <[email protected]>
Massimo Maggi <[email protected]>
Mateusz Guzik <[email protected]>
Mateusz Piotrowski <[email protected]>
Expand Down Expand Up @@ -488,6 +494,7 @@ CONTRIBUTORS:
Peng <[email protected]>
Peter Ashford <[email protected]>
Peter Dave Hello <[email protected]>
Peter Doherty <[email protected]>
Peter Levine <[email protected]>
Peter Wirdemo <[email protected]>
Petros Koutoupis <[email protected]>
Expand All @@ -501,6 +508,7 @@ CONTRIBUTORS:
Prasad Joshi <[email protected]>
privb0x23 <[email protected]>
P.SCH <[email protected]>
Qiuhao Chen <[email protected]>
Quartz <[email protected]>
Quentin Zdanis <[email protected]>
Rafael Kitover <[email protected]>
Expand Down Expand Up @@ -532,6 +540,7 @@ CONTRIBUTORS:
Roman Strashkin <[email protected]>
Ross Williams <[email protected]>
Ruben Kerkhof <[email protected]>
Ryan <[email protected]>
Ryan Hirasaki <[email protected]>
Ryan Lahfa <[email protected]>
Ryan Libby <[email protected]>
Expand All @@ -556,6 +565,7 @@ CONTRIBUTORS:
Sen Haerens <[email protected]>
Serapheim Dimitropoulos <[email protected]>
Seth Forshee <[email protected]>
Seth Troisi <[email protected]>
Shaan Nobee <[email protected]>
Shampavman <[email protected]>
Shaun Tancheff <[email protected]>
Expand Down Expand Up @@ -602,6 +612,7 @@ CONTRIBUTORS:
Tim Schumacher <[email protected]>
Tino Reichardt <[email protected]>
Tobin Harding <[email protected]>
Todd Seidelmann <[email protected]>
Tom Caputi <[email protected]>
Tom Matthews <[email protected]>
Tomohiro Kusumi <[email protected]>
Expand Down Expand Up @@ -653,6 +664,8 @@ CONTRIBUTORS:
Zachary Bedell <[email protected]>
Zach Dykstra <[email protected]>
zgock <[email protected]>
Zhao Yongming <[email protected]>
Zhenlei Huang <[email protected]>
Zhu Chuang <[email protected]>
Érico Nogueira <[email protected]>
Đoàn Trần Công Danh <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions META
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Meta: 1
Name: zfs
Branch: 1.0
Version: 2.2.4
Version: 2.2.5
Release: 1
Release-Tags: relext
License: CDDL
Author: OpenZFS
Linux-Maximum: 6.8
Linux-Maximum: 6.9
Linux-Minimum: 3.10
93 changes: 83 additions & 10 deletions cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include <sys/spa_impl.h>
#include <sys/dmu.h>
#include <sys/zap.h>
#include <sys/zap_impl.h>
#include <sys/fs/zfs.h>
#include <sys/zfs_znode.h>
#include <sys/zfs_sa.h>
Expand Down Expand Up @@ -84,6 +85,9 @@
#include <sys/brt_impl.h>
#include <zfs_comutil.h>
#include <sys/zstd/zstd.h>
#if (__GLIBC__ && !__UCLIBC__)
#include <execinfo.h> /* for backtrace() */
#endif

#include <libnvpair.h>
#include <libzutil.h>
Expand Down Expand Up @@ -931,11 +935,41 @@ usage(void)
static void
dump_debug_buffer(void)
{
if (dump_opt['G']) {
(void) printf("\n");
(void) fflush(stdout);
zfs_dbgmsg_print("zdb");
}
ssize_t ret __attribute__((unused));

if (!dump_opt['G'])
return;
/*
* We use write() instead of printf() so that this function
* is safe to call from a signal handler.
*/
ret = write(STDOUT_FILENO, "\n", 1);
zfs_dbgmsg_print("zdb");
}

#define BACKTRACE_SZ 100

static void sig_handler(int signo)
{
struct sigaction action;
#if (__GLIBC__ && !__UCLIBC__) /* backtrace() is a GNU extension */
int nptrs;
void *buffer[BACKTRACE_SZ];

nptrs = backtrace(buffer, BACKTRACE_SZ);
backtrace_symbols_fd(buffer, nptrs, STDERR_FILENO);
#endif
dump_debug_buffer();

/*
* Restore default action and re-raise signal so SIGSEGV and
* SIGABRT can trigger a core dump.
*/
action.sa_handler = SIG_DFL;
sigemptyset(&action.sa_mask);
action.sa_flags = 0;
(void) sigaction(signo, &action, NULL);
raise(signo);
}

/*
Expand Down Expand Up @@ -1204,16 +1238,33 @@ dump_zap(objset_t *os, uint64_t object, void *data, size_t size)
for (zap_cursor_init(&zc, os, object);
zap_cursor_retrieve(&zc, &attr) == 0;
zap_cursor_advance(&zc)) {
(void) printf("\t\t%s = ", attr.za_name);
boolean_t key64 =
!!(zap_getflags(zc.zc_zap) & ZAP_FLAG_UINT64_KEY);

if (key64)
(void) printf("\t\t0x%010lx = ",
*(uint64_t *)attr.za_name);
else
(void) printf("\t\t%s = ", attr.za_name);

if (attr.za_num_integers == 0) {
(void) printf("\n");
continue;
}
prop = umem_zalloc(attr.za_num_integers *
attr.za_integer_length, UMEM_NOFAIL);
(void) zap_lookup(os, object, attr.za_name,
attr.za_integer_length, attr.za_num_integers, prop);
if (attr.za_integer_length == 1) {

if (key64)
(void) zap_lookup_uint64(os, object,
(const uint64_t *)attr.za_name, 1,
attr.za_integer_length, attr.za_num_integers,
prop);
else
(void) zap_lookup(os, object, attr.za_name,
attr.za_integer_length, attr.za_num_integers,
prop);

if (attr.za_integer_length == 1 && !key64) {
if (strcmp(attr.za_name,
DSL_CRYPTO_KEY_MASTER_KEY) == 0 ||
strcmp(attr.za_name,
Expand All @@ -1232,6 +1283,10 @@ dump_zap(objset_t *os, uint64_t object, void *data, size_t size)
} else {
for (i = 0; i < attr.za_num_integers; i++) {
switch (attr.za_integer_length) {
case 1:
(void) printf("%u ",
((uint8_t *)prop)[i]);
break;
case 2:
(void) printf("%u ",
((uint16_t *)prop)[i]);
Expand Down Expand Up @@ -8954,12 +9009,30 @@ main(int argc, char **argv)
char *spa_config_path_env, *objset_str;
boolean_t target_is_spa = B_TRUE, dataset_lookup = B_FALSE;
nvlist_t *cfg = NULL;
struct sigaction action;
boolean_t force_import = B_FALSE;
boolean_t config_path_console = B_FALSE;
char pbuf[MAXPATHLEN];

dprintf_setup(&argc, argv);

/*
* Set up signal handlers, so if we crash due to bad on-disk data we
* can get more info. Unlike ztest, we don't bail out if we can't set
* up signal handlers, because zdb is very useful without them.
*/
action.sa_handler = sig_handler;
sigemptyset(&action.sa_mask);
action.sa_flags = 0;
if (sigaction(SIGSEGV, &action, NULL) < 0) {
(void) fprintf(stderr, "zdb: cannot catch SIGSEGV: %s\n",
strerror(errno));
}
if (sigaction(SIGABRT, &action, NULL) < 0) {
(void) fprintf(stderr, "zdb: cannot catch SIGABRT: %s\n",
strerror(errno));
}

/*
* If there is an environment variable SPA_CONFIG_PATH it overrides
* default spa_config_path setting. If -U flag is specified it will
Expand Down Expand Up @@ -9198,7 +9271,7 @@ main(int argc, char **argv)
char *pname = strdup(target);
const char *value;
nvlist_t *pnvl = NULL;
nvlist_t *vnvl;
nvlist_t *vnvl = NULL;

if (strpbrk(pname, "/@") != NULL)
*strpbrk(pname, "/@") = '\0';
Expand Down
4 changes: 3 additions & 1 deletion cmd/zstream/zstream_redup.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,16 @@ static void
zfs_redup_stream(int infd, int outfd, boolean_t verbose)
{
int bufsz = SPA_MAXBLOCKSIZE;
dmu_replay_record_t thedrr = { 0 };
dmu_replay_record_t thedrr;
dmu_replay_record_t *drr = &thedrr;
redup_table_t rdt;
zio_cksum_t stream_cksum;
uint64_t numbuckets;
uint64_t num_records = 0;
uint64_t num_write_byref_records = 0;

memset(&thedrr, 0, sizeof (dmu_replay_record_t));

#ifdef _ILP32
uint64_t max_rde_size = SMALLEST_POSSIBLE_MAX_RDT_MB << 20;
#else
Expand Down
4 changes: 2 additions & 2 deletions config/find_system_library.m4
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ AC_DEFUN([ZFS_AC_FIND_SYSTEM_LIBRARY], [
AC_DEFINE([HAVE_][$1], [1], [Define if you have [$5]])
$7
],[dnl ELSE
AC_SUBST([$1]_CFLAGS, [])
AC_SUBST([$1]_LIBS, [])
AC_SUBST([$1]_CFLAGS, [""])
AC_SUBST([$1]_LIBS, [""])
AC_MSG_WARN([cannot find [$5] via pkg-config or in the standard locations])
$8
])
Expand Down
4 changes: 2 additions & 2 deletions config/kernel-blk-queue.m4
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [
ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [
AC_MSG_RESULT(yes)
],[
ZFS_LINUX_TEST_ERROR([blk_queue_max_hw_sectors])
AC_MSG_RESULT(no)
])
])

Expand All @@ -355,7 +355,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [
ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [
AC_MSG_RESULT(yes)
], [
ZFS_LINUX_TEST_ERROR([blk_queue_max_segments])
AC_MSG_RESULT(no)
])
])

Expand Down
26 changes: 26 additions & 0 deletions config/kernel-blkdev.m4
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,30 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE], [
])
])

dnl #
dnl # 5.16 API change
dnl # Added bdev_nr_bytes() helper.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_NR_BYTES], [
ZFS_LINUX_TEST_SRC([bdev_nr_bytes], [
#include <linux/blkdev.h>
],[
struct block_device *bdev = NULL;
loff_t nr_bytes __attribute__ ((unused)) = 0;
nr_bytes = bdev_nr_bytes(bdev);
])
])

AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_NR_BYTES], [
AC_MSG_CHECKING([whether bdev_nr_bytes() is available])
ZFS_LINUX_TEST_RESULT([bdev_nr_bytes], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BDEV_NR_BYTES, 1, [bdev_nr_bytes() is available])
],[
AC_MSG_RESULT(no)
])
])

dnl #
dnl # 5.20 API change,
dnl # Removed bdevname(), snprintf(.., %pg) should be used.
Expand Down Expand Up @@ -747,6 +771,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [
ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_NR_BYTES
ZFS_AC_KERNEL_SRC_BLKDEV_BDEVNAME
ZFS_AC_KERNEL_SRC_BLKDEV_ISSUE_DISCARD
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_KOBJ
Expand All @@ -767,6 +792,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [
ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE
ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE
ZFS_AC_KERNEL_BLKDEV_BDEV_NR_BYTES
ZFS_AC_KERNEL_BLKDEV_BDEVNAME
ZFS_AC_KERNEL_BLKDEV_GET_ERESTARTSYS
ZFS_AC_KERNEL_BLKDEV_ISSUE_DISCARD
Expand Down
Loading

0 comments on commit 6704dda

Please sign in to comment.