Skip to content

Commit

Permalink
Merge pull request #266 from truenas/NAS-133441
Browse files Browse the repository at this point in the history
NAS-133441 / None / Sync truenas/zfs-2.3-release with upstream zfs-2.3-rc5 tag
  • Loading branch information
ixhamza authored Jan 9, 2025
2 parents 83e855f + 51d126c commit 2508b1a
Show file tree
Hide file tree
Showing 46 changed files with 411 additions and 172 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/scripts/qemu-2-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ OSv=$OS

# compressed with .zst extension
REPO="https://github.com/mcmilk/openzfs-freebsd-images"
FREEBSD="$REPO/releases/download/v2024-10-05"
FREEBSD="$REPO/releases/download/v2024-12-14"
URLzs=""

# Ubuntu mirrors
Expand All @@ -40,6 +40,12 @@ case "$OS" in
# dns sometimes fails with that url :/
echo "89.187.191.12 geo.mirror.pkgbuild.com" | sudo tee /etc/hosts > /dev/null
;;
centos-stream10)
OSNAME="CentOS Stream 10"
# TODO: #16903 Overwrite OSv to stream9 for virt-install until it's added to osinfo
OSv="centos-stream9"
URL="https://cloud.centos.org/centos/10-stream/x86_64/images/CentOS-Stream-GenericCloud-10-latest.x86_64.qcow2"
;;
centos-stream9)
OSNAME="CentOS Stream 9"
URL="https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-latest.x86_64.qcow2"
Expand Down Expand Up @@ -76,28 +82,29 @@ case "$OS" in
BASH="/usr/local/bin/bash"
NIC="rtl8139"
;;
freebsd14-0r)
OSNAME="FreeBSD 14.0-RELEASE"
OSv="freebsd14.0"
URLzs="$FREEBSD/amd64-freebsd-14.0-RELEASE.qcow2.zst"
BASH="/usr/local/bin/bash"
;;
freebsd14-1r)
OSNAME="FreeBSD 14.1-RELEASE"
OSv="freebsd14.0"
URLzs="$FREEBSD/amd64-freebsd-14.1-RELEASE.qcow2.zst"
BASH="/usr/local/bin/bash"
;;
freebsd14-2r)
OSNAME="FreeBSD 14.2-RELEASE"
OSv="freebsd14.0"
URLzs="$FREEBSD/amd64-freebsd-14.2-RELEASE.qcow2.zst"
BASH="/usr/local/bin/bash"
;;
freebsd13-4s)
OSNAME="FreeBSD 13.4-STABLE"
OSv="freebsd13.0"
URLzs="$FREEBSD/amd64-freebsd-13.4-STABLE.qcow2.zst"
BASH="/usr/local/bin/bash"
NIC="rtl8139"
;;
freebsd14-1s)
OSNAME="FreeBSD 14.1-STABLE"
freebsd14-2s)
OSNAME="FreeBSD 14.2-STABLE"
OSv="freebsd14.0"
URLzs="$FREEBSD/amd64-freebsd-14.1-STABLE.qcow2.zst"
URLzs="$FREEBSD/amd64-freebsd-14.2-STABLE.qcow2.zst"
BASH="/usr/local/bin/bash"
;;
freebsd15-0c)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/qemu-3-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ case "$1" in
sudo dnf install -y kernel-abi-whitelists
echo "##[endgroup]"
;;
almalinux9|centos-stream9)
almalinux9|centos-stream9|centos-stream10)
echo "##[group]Enable epel and crb repositories"
sudo dnf config-manager -y --set-enabled crb
sudo dnf install -y epel-release
Expand Down
34 changes: 30 additions & 4 deletions .github/workflows/zfs-qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ name: zfs-qemu
on:
push:
pull_request:
workflow_dispatch:
inputs:
include_stream9:
type: boolean
required: false
default: false
description: 'Test on CentOS 9 stream'
include_stream10:
type: boolean
required: false
default: false
description: 'Test on CentOS 10 stream'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -22,8 +34,8 @@ jobs:
- name: Generate OS config and CI type
id: os
run: |
FULL_OS='["almalinux8", "almalinux9", "centos-stream9", "debian11", "debian12", "fedora40", "fedora41", "freebsd13-4r", "freebsd14-0r", "freebsd14-1s", "ubuntu20", "ubuntu22", "ubuntu24"]'
QUICK_OS='["almalinux8", "almalinux9", "debian12", "fedora41", "freebsd13-3r", "freebsd14-1r", "ubuntu24"]'
FULL_OS='["almalinux8", "almalinux9", "debian11", "debian12", "fedora40", "fedora41", "freebsd13-3r", "freebsd13-4s", "freebsd14-1r", "freebsd14-2s", "freebsd15-0c", "ubuntu20", "ubuntu22", "ubuntu24"]'
QUICK_OS='["almalinux8", "almalinux9", "debian12", "fedora41", "freebsd13-3r", "freebsd14-2r", "ubuntu24"]'
# determine CI type when running on PR
ci_type="full"
if ${{ github.event_name == 'pull_request' }}; then
Expand All @@ -37,9 +49,22 @@ jobs:
os_selection="$FULL_OS"
fi
os_json=$(echo ${os_selection} | jq -c)
# Add optional runners
if [ "${{ github.event.inputs.include_stream9 }}" == 'true' ]; then
os_json=$(echo $os_json | jq -c '. += ["centos-stream9"]')
fi
if [ "${{ github.event.inputs.include_stream10 }}" == 'true' ]; then
os_json=$(echo $os_json | jq -c '. += ["centos-stream10"]')
fi
echo $os_json
echo "os=$os_json" >> $GITHUB_OUTPUT
echo "ci_type=$ci_type" >> $GITHUB_OUTPUT
qemu-vm:
name: qemu-x86
needs: [ test-config ]
Expand All @@ -49,8 +74,9 @@ jobs:
# rhl: almalinux8, almalinux9, centos-stream9, fedora40, fedora41
# debian: debian11, debian12, ubuntu20, ubuntu22, ubuntu24
# misc: archlinux, tumbleweed
# FreeBSD Release: freebsd13-3r, freebsd13-4r, freebsd14-0r, freebsd14-1r
# FreeBSD Stable: freebsd13-4s, freebsd14-1s
# FreeBSD variants of 2024-12:
# FreeBSD Release: freebsd13-3r, freebsd13-4r, freebsd14-1r, freebsd14-2r
# FreeBSD Stable: freebsd13-4s, freebsd14-2s
# FreeBSD Current: freebsd15-0c
os: ${{ fromJson(needs.test-config.outputs.test_os) }}
runs-on: ubuntu-24.04
Expand Down
32 changes: 16 additions & 16 deletions cmd/zfs/zfs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ usage_prop_cb(int prop, void *cb)
{
FILE *fp = cb;

(void) fprintf(fp, "\t%-15s ", zfs_prop_to_name(prop));
(void) fprintf(fp, "\t%-22s ", zfs_prop_to_name(prop));

if (zfs_prop_readonly(prop))
(void) fprintf(fp, " NO ");
Expand Down Expand Up @@ -561,40 +561,40 @@ usage(boolean_t requested)
(void) fprintf(fp, "%s",
gettext("\nThe following properties are supported:\n"));

(void) fprintf(fp, "\n\t%-14s %s %s %s\n\n",
(void) fprintf(fp, "\n\t%-21s %s %s %s\n\n",
"PROPERTY", "EDIT", "INHERIT", "VALUES");

/* Iterate over all properties */
(void) zprop_iter(usage_prop_cb, fp, B_FALSE, B_TRUE,
ZFS_TYPE_DATASET);

(void) fprintf(fp, "\t%-15s ", "userused@...");
(void) fprintf(fp, "\t%-22s ", "userused@...");
(void) fprintf(fp, " NO NO <size>\n");
(void) fprintf(fp, "\t%-15s ", "groupused@...");
(void) fprintf(fp, "\t%-22s ", "groupused@...");
(void) fprintf(fp, " NO NO <size>\n");
(void) fprintf(fp, "\t%-15s ", "projectused@...");
(void) fprintf(fp, "\t%-22s ", "projectused@...");
(void) fprintf(fp, " NO NO <size>\n");
(void) fprintf(fp, "\t%-15s ", "userobjused@...");
(void) fprintf(fp, "\t%-22s ", "userobjused@...");
(void) fprintf(fp, " NO NO <size>\n");
(void) fprintf(fp, "\t%-15s ", "groupobjused@...");
(void) fprintf(fp, "\t%-22s ", "groupobjused@...");
(void) fprintf(fp, " NO NO <size>\n");
(void) fprintf(fp, "\t%-15s ", "projectobjused@...");
(void) fprintf(fp, "\t%-22s ", "projectobjused@...");
(void) fprintf(fp, " NO NO <size>\n");
(void) fprintf(fp, "\t%-15s ", "userquota@...");
(void) fprintf(fp, "\t%-22s ", "userquota@...");
(void) fprintf(fp, "YES NO <size> | none\n");
(void) fprintf(fp, "\t%-15s ", "groupquota@...");
(void) fprintf(fp, "\t%-22s ", "groupquota@...");
(void) fprintf(fp, "YES NO <size> | none\n");
(void) fprintf(fp, "\t%-15s ", "projectquota@...");
(void) fprintf(fp, "\t%-22s ", "projectquota@...");
(void) fprintf(fp, "YES NO <size> | none\n");
(void) fprintf(fp, "\t%-15s ", "userobjquota@...");
(void) fprintf(fp, "\t%-22s ", "userobjquota@...");
(void) fprintf(fp, "YES NO <size> | none\n");
(void) fprintf(fp, "\t%-15s ", "groupobjquota@...");
(void) fprintf(fp, "\t%-22s ", "groupobjquota@...");
(void) fprintf(fp, "YES NO <size> | none\n");
(void) fprintf(fp, "\t%-15s ", "projectobjquota@...");
(void) fprintf(fp, "\t%-22s ", "projectobjquota@...");
(void) fprintf(fp, "YES NO <size> | none\n");
(void) fprintf(fp, "\t%-15s ", "written@<snap>");
(void) fprintf(fp, "\t%-22s ", "written@<snap>");
(void) fprintf(fp, " NO NO <size>\n");
(void) fprintf(fp, "\t%-15s ", "written#<bookmark>");
(void) fprintf(fp, "\t%-22s ", "written#<bookmark>");
(void) fprintf(fp, " NO NO <size>\n");

(void) fprintf(fp, gettext("\nSizes are specified in bytes "
Expand Down
5 changes: 5 additions & 0 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,16 @@ AC_DEFUN([ZFS_LINUX_COMPILE], [
building kernel modules])
AC_ARG_VAR([KERNEL_LLVM], [Binary option to
build kernel modules with LLVM/CLANG toolchain])
AC_ARG_VAR([KERNEL_CROSS_COMPILE], [Cross compile prefix
for kernel module builds])
AC_ARG_VAR([KERNEL_ARCH], [Architecture to build kernel modules for])
AC_TRY_COMMAND([
KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6"
make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC}
${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM}
CONFIG_MODULES=y CFLAGS_MODULE=-DCONFIG_MODULES
${KERNEL_CROSS_COMPILE:+CROSS_COMPILE=$KERNEL_CROSS_COMPILE}
${KERNEL_ARCH:+ARCH=$KERNEL_ARCH}
-C $LINUX_OBJ $ARCH_UM M=$PWD/$1 >$1/build.log 2>&1])
AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4])
])
Expand Down
2 changes: 1 addition & 1 deletion config/user.m4
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV
ZFS_AC_CONFIG_USER_ZFSEXEC
AC_CHECK_FUNCS([execvpe issetugid mlockall strerror_l strlcat strlcpy gettid])
AC_CHECK_FUNCS([execvpe issetugid mlockall strlcat strlcpy gettid])
AC_SUBST(RM)
])
2 changes: 2 additions & 0 deletions config/zfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ AC_DEFUN([ZFS_AC_RPM], [
RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernel_cc KERNEL_CC=$(KERNEL_CC)"'
RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernel_ld KERNEL_LD=$(KERNEL_LD)"'
RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernel_llvm KERNEL_LLVM=$(KERNEL_LLVM)"'
RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernel_cross_compile KERNEL_CROSS_COMPILE=$(KERNEL_CROSS_COMPILE)"'
RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernel_arch KERNEL_ARCH=$(KERNEL_ARCH)"'
])
RPM_DEFINE_DKMS=''
Expand Down
15 changes: 9 additions & 6 deletions include/libzutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define _LIBZUTIL_H extern __attribute__((visibility("default")))

#include <string.h>
#include <locale.h>
#include <pthread.h>
#include <sys/nvpair.h>
#include <sys/fs/zfs.h>

Expand Down Expand Up @@ -276,11 +276,14 @@ _LIBZUTIL_H void update_vdev_config_dev_sysfs_path(nvlist_t *nv,
* Thread-safe strerror() for use in ZFS libraries
*/
static inline char *zfs_strerror(int errnum) {
#ifdef HAVE_STRERROR_L
return (strerror_l(errnum, uselocale(0)));
#else
return (strerror(errnum));
#endif
static __thread char errbuf[512];
static pthread_mutex_t zfs_strerror_lock = PTHREAD_MUTEX_INITIALIZER;

(void) pthread_mutex_lock(&zfs_strerror_lock);
(void) strlcpy(errbuf, strerror(errnum), sizeof (errbuf));
(void) pthread_mutex_unlock(&zfs_strerror_lock);

return (errbuf);
}

#ifdef __cplusplus
Expand Down
2 changes: 0 additions & 2 deletions include/sys/zvol.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ extern int zvol_set_ro(const char *, boolean_t);
extern zvol_state_handle_t *zvol_suspend(const char *);
extern int zvol_resume(zvol_state_handle_t *);
extern void *zvol_tag(zvol_state_handle_t *);
extern int zvol_clone_range(zvol_state_handle_t *, uint64_t,
zvol_state_handle_t *, uint64_t, uint64_t);

extern int zvol_init(void);
extern void zvol_fini(void);
Expand Down
8 changes: 5 additions & 3 deletions include/sys/zvol_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ void zvol_log_truncate(zvol_state_t *zv, dmu_tx_t *tx, uint64_t off,
uint64_t len);
void zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, uint64_t offset,
uint64_t size, boolean_t commit);
void zvol_log_clone_range(zilog_t *zilog, dmu_tx_t *tx, int txtype,
uint64_t off, uint64_t len, uint64_t blksz, const blkptr_t *bps,
size_t nbps);
int zvol_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf,
struct lwb *lwb, zio_t *zio);
int zvol_init_impl(void);
void zvol_fini_impl(void);
void zvol_wait_close(zvol_state_t *zv);
int zvol_clone_range(zvol_state_handle_t *, uint64_t,
zvol_state_handle_t *, uint64_t, uint64_t);
void zvol_log_clone_range(zilog_t *zilog, dmu_tx_t *tx, int txtype,
uint64_t off, uint64_t len, uint64_t blksz, const blkptr_t *bps,
size_t nbps);

/*
* platform dependent functions exported to platform independent code
Expand Down
16 changes: 14 additions & 2 deletions lib/libzfs/libzfs_changelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,15 @@ change_one(zfs_handle_t *zhp, void *data)
cn = NULL;
}

if (!clp->cl_alldependents)
ret = zfs_iter_children_v2(zhp, 0, change_one, data);
if (!clp->cl_alldependents) {
if (clp->cl_prop != ZFS_PROP_MOUNTPOINT) {
ret = zfs_iter_filesystems_v2(zhp, 0,
change_one, data);
} else {
ret = zfs_iter_children_v2(zhp, 0, change_one,
data);
}
}

/*
* If we added the handle to the changelist, we will re-use it
Expand Down Expand Up @@ -738,6 +745,11 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int gather_flags,
changelist_free(clp);
return (NULL);
}
} else if (clp->cl_prop != ZFS_PROP_MOUNTPOINT) {
if (zfs_iter_filesystems_v2(zhp, 0, change_one, clp) != 0) {
changelist_free(clp);
return (NULL);
}
} else if (zfs_iter_children_v2(zhp, 0, change_one, clp) != 0) {
changelist_free(clp);
return (NULL);
Expand Down
3 changes: 2 additions & 1 deletion lib/libzfs/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -5345,7 +5345,8 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
strval = fnvlist_lookup_string(nv, ZPROP_VALUE);
} else {
/* user prop not found */
return (-1);
src = ZPROP_SRC_DEFAULT;
strval = "-";
}
(void) strlcpy(buf, strval, len);
if (srctype)
Expand Down
4 changes: 2 additions & 2 deletions man/man4/zfs.4
Original file line number Diff line number Diff line change
Expand Up @@ -867,14 +867,14 @@ where that percent may exceed
This
only operates during memory pressure/reclaim.
.
.It Sy zfs_arc_shrinker_limit Ns = Ns Sy 10000 Pq int
.It Sy zfs_arc_shrinker_limit Ns = Ns Sy 0 Pq int
This is a limit on how many pages the ARC shrinker makes available for
eviction in response to one page allocation attempt.
Note that in practice, the kernel's shrinker can ask us to evict
up to about four times this for one allocation attempt.
To reduce OOM risk, this limit is applied for kswapd reclaims only.
.Pp
The default limit of
For example a value of
.Sy 10000 Pq in practice, Em 160 MiB No per allocation attempt with 4 KiB pages
limits the amount of time spent attempting to reclaim ARC memory to
less than 100 ms per allocation attempt,
Expand Down
2 changes: 2 additions & 0 deletions module/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ modules-Linux:
@# Build the kernel modules.
$(MAKE) -C @LINUX_OBJ@ $(if @KERNEL_CC@,CC=@KERNEL_CC@) \
$(if @KERNEL_LD@,LD=@KERNEL_LD@) $(if @KERNEL_LLVM@,LLVM=@KERNEL_LLVM@) \
$(if @KERNEL_CROSS_COMPILE@,CROSS_COMPILE=@KERNEL_CROSS_COMPILE@) \
$(if @KERNEL_ARCH@,ARCH=@KERNEL_ARCH@) \
M="$$PWD" @KERNEL_MAKE@ CONFIG_ZFS=m modules

modules-FreeBSD:
Expand Down
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/zfs_vnops_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -6258,7 +6258,7 @@ struct vop_vector zfs_vnodeops = {
.vop_fplookup_vexec = zfs_freebsd_fplookup_vexec,
.vop_fplookup_symlink = zfs_freebsd_fplookup_symlink,
.vop_access = zfs_freebsd_access,
.vop_allocate = VOP_EINVAL,
.vop_allocate = VOP_EOPNOTSUPP,
#if __FreeBSD_version >= 1400032
.vop_deallocate = zfs_deallocate,
#endif
Expand Down
4 changes: 2 additions & 2 deletions module/os/linux/zfs/arc_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
* practice, the kernel's shrinker can ask us to evict up to about 4x this
* for one allocation attempt.
*
* The default limit of 10,000 (in practice, 160MB per allocation attempt
* For example a value of 10,000 (in practice, 160MB per allocation attempt
* with 4K pages) limits the amount of time spent attempting to reclaim ARC
* memory to less than 100ms per allocation attempt, even with a small
* average compressed block size of ~8KB.
*
* See also the comment in arc_shrinker_count().
* Set to 0 to disable limit.
*/
static int zfs_arc_shrinker_limit = 10000;
static int zfs_arc_shrinker_limit = 0;

/*
* Relative cost of ARC eviction, AKA number of seeks needed to restore evicted
Expand Down
Loading

0 comments on commit 2508b1a

Please sign in to comment.