Compare commits

...

28 Commits

Author SHA1 Message Date
Tony Hutter 6150fbe67f Tag zfs-2.0.4
META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
2021-03-08 13:04:37 -08:00
manfromafar 458bb8c8a1 Clarify compressed zfs send/recv behavior
Docs for send and receive do not explain behavior when sending a 
compressed stream then receiving on a host that overrides compression 
with -o compress=value.

The data from the send stream is written as it was from the send is 
the compressed form but the compression algorithm set on the receiver 
is the overridden version which causes some confusion as to what 
algorithm was actually used.

Updated man docs to clarify behavior

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed By: Allan Jude <allanjude@freebsd.org>
Signed-off-by: manfromafar <manfromafar@outlook.com>
Closes #11690
2021-03-08 09:07:32 -08:00
Ryan Moeller cda6fdd500 Intentionally allow ZFS_READONLY in zfs_write
ZFS_READONLY represents the "DOS R/O" attribute.
When that flag is set, we should behave as if write access
were not granted by anything in the ACL.  In particular:
We _must_ allow writes after opening the file r/w, then
setting the DOS R/O attribute, and writing some more.
(Similar to how you can write after fchmod(fd, 0444).)

Restore these semantics which were lost on FreeBSD when refactoring
zfs_write.  To my knowledge Linux does not actually expose this flag,
but we'll need it to eventually so I've added the supporting checks.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #11693
2021-03-08 09:07:29 -08:00
Brian Behlendorf df8271301e Suppress cppcheck invalidSyntax warninigs
For some reason cppcheck 1.90 is generating an invalidSyntax warning
when the BF64_SET macro is used in the zstream source.  The same
warning is not reported by cppcheck 2.3, nor is their any evident
problem with the expanded macro.  This appears to be an issue with
this version of cppcheck.  This commit annotates the source to suppress
the warning.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #11700
2021-03-08 09:07:25 -08:00
Brian Behlendorf e219935f10 Initialize ZIL buffers
When populating a ZIL destination buffer ensure it is always
zeroed before its contents are constructed.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Tom Caputi <caputit1@tcnj.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #11687
2021-03-08 09:07:21 -08:00
Thomas Lamprecht bb9104f1e8 zpool: use tab to intend continuation from removal status
Bring the output of the removal status in line with the other
"fields" that zpool status outputs, and thus allows an parser to
easier detect this as continuation of the 'remove:' output.

Before:
remove: Removal of vdev 0 copied 282G in 0h9m, completed on [...]
    776K memory used for removed device mappings

Now:
remove: Removal of vdev 0 copied 282G in 0h9m, completed on [...]
	776K memory used for removed device mappings

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Closes #11674
2021-03-08 09:07:18 -08:00
James Wah 94b240bae0 Don't bomb out when using keylocation=file://
Avoid following the error path when the operation in fact succeeded.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: James Wah <james@laird-wah.net>
Closes #11651
2021-03-05 12:59:07 -08:00
Jake Howard e93203e004 Add "zstd-fast" to help options for "compression" property
This value does work as expected, and is documented in the manpage.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jake Howard <git@theorangeone.net>
Closes #11670
2021-03-05 12:58:47 -08:00
Andriy Gapon ccb453acd0 Fix assert in FreeBSD-specific dmu_read_pages
The function has three similar pieces of code: for read-behind pages,
requested pages and read-ahead pages.  All three pieces had an
assert to ensure that the page is not mapped.  Later the assert was
relaxed to require that the page is not mapped for writing.  But that
was done in two places out of three.  This change fixes the third piece,
read-ahead.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Andriy Gapon <avg@FreeBSD.org>
Closes #11654
2021-03-05 12:58:08 -08:00
Coleman Kane 6c1989923e Linux 5.12 compat: replace bio_*_io_acct with disk_*_io_acct
The bio_*_acct functions became GPL exports, which causes the
kernel modules to refuse to compile. This replaces code with
alternate function calls to the disk_*_io_acct interfaces, which
are not GPL exports. This change was added in kernel commit
99dfc43ecbf67f12a06512918aaba61d55863efc.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Coleman Kane <ckane@colemankane.org>
Closes #11639
2021-03-05 12:57:54 -08:00
Coleman Kane a0eb5a77a0 Linux 5.12 compat: bio->bi_disk member moved
The struct bio member bi_disk was moved underneath a new member named
bi_bdev. So all attempts to reference bio->bi_disk need to now become
bio->bi_bdev->bd_disk.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Coleman Kane <ckane@colemankane.org>
Closes #11639
2021-03-05 12:57:46 -08:00
Brian Behlendorf fe77c48320 Linux: increase max nvlist_src size
On Linux increase the maximum allowed size of the src nvlist which
can be passed to the /dev/zfs ioctl.  Originally, this was set
to a maximum of KMALLOC_MAX_SIZE (4M) because it was kmalloc'd.
Since that time it's been converted to a vmalloc so that's no
longer a hard limit, and it's desirable for `zfs send/recv` to
allow larger nvlists so more snapshots can be sent at once.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #6572
Closes #11638
2021-03-05 12:54:57 -08:00
Cedric Maunoury db9b29895e send_iterate_snap : doall send without fromsnap
The behavior of a NULL fromsnap was inadvertently changed for a doall
send when the send/recv logic in libzfs was updated.  Restore the
previous behavior by correcting send_iterate_snap() to include all
the snapshots in the nvlist for this case. 

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Cedric Maunoury <cedric.maunoury@gmail.com>
Closes #11608
2021-03-05 12:54:39 -08:00
fbynite 4d4dd76f0f vdev_ops: don't try to call vdev_op_hold or vdev_op_rele when NULL
This prevents a panic after a SLOG add/removal on the root pool followed
by a zpool scrub.

When a SLOG is removed, a hole takes its place - the vdev_ops for a hole
is vdev_hole_ops, which defines the handler functions of vdev_op_hold
and vdev_op_rele as NULL.

This bug has been reported in illumos and FreeBSD, a different trigger
in the FreeBSD report though.

Credit for this patch goes to Patrick Mooney <pmooney@pfmooney.com>

Obtained from: illumos-gate commit: c65bd18728f34725
External-issue: https://www.illumos.org/issues/12981
External-issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252396
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Wing <rob.fx907@gmail.com>
Closes #11623
2021-03-05 12:53:50 -08:00
Christian Schwarz 286c7f75bb libzpool: set_global_var: fix endianness handling (fixes zdb -o )
Without this patch I get the error

  Setting global variables is only supported on little-endian systems

when using `zdb -o` on my amd64 machine.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Signed-off-by: Christian Schwarz <me@cschwarz.com>
Closes #11602
2021-03-05 12:51:48 -08:00
Ryan Moeller 403703d57a Restore FreeBSD resource usage accounting
Add zfs_racct_* interfaces for platform-dependent read/write accounting.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #11613
2021-03-05 12:50:32 -08:00
Mark Johnston f17c843eff FreeBSD: disable the use of hardware crypto offload drivers for now
First, the crypto request completion handler contains a bug in that it
fails to reset fs_done correctly after the request is completed.  This
is only a problem for asynchronous drivers.  Second, some hardware
drivers have input constraints which ZFS does not satisfy.  For
instance, ccp(4) apparently requires the AAD length for AES-GCM to be a
multiple of the cipher block size, and with qat(4) the AES-GCM AAD
length may not be longer than 240 bytes.  FreeBSD's generic crypto
framework doesn't have a mechanism to automatically fall back to a
software implementation if a hardware driver cannot process a request,
and ZFS does not tolerate such errors.

The plan is to implement such a fallback mechanism, but with FreeBSD
13.0 approaching we should simply disable the use hardware drivers for
now.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #11612
2021-03-05 12:49:41 -08:00
Andriy Gapon f6440fa094 Fix report_mount_progress never calling set_progress_header
That happens because of an off-by-one mistake.
share_mount_one_cb() calls report_mount_progress(current=sm_done) after
having incremented sm_done by one.  Then report_mount_progress()
increments the parameter again.  It appears that that logic became
obsolete after commit a10d50f999, parallel zfs mount.

On FreeBSD I observe that zfs mount -a -v prints, for example,
    (null): (201/248)
That happens because set_progress_header() is never called.

With this change the output becomes correct:
    Mounting ZFS filesystems: (209/248)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Andriy Gapon <avg@FreeBSD.org>
Closes #11607
2021-03-05 12:49:22 -08:00
José Luis Salvador Rufo 62f9691e10 Support uClibc for the tests compilations
There are two issues that don't allow ZFS to be compiled using uClibc.
`backtrace()`, and `program_invocation_short_name` as a `const`.
This patch adds uClibc to the conditionals in the same way there are
already for Glibc for `backtrace()`; and removes the external param
`program_invocation_short_name` because its only used here for the
whole project.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com>
Closes #11600
2021-03-05 12:48:50 -08:00
Brian Behlendorf 73e26fdc09 Linux 5.11 compat: META
Increase the Linux-Maximum version in the META file to 5.11.
All of the required compatibility patches have been merged.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #11586
2021-03-05 12:48:08 -08:00
Tony Hutter 65a89d9f49 Tag zfs-2.0.3
META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
2021-02-10 13:03:21 -08:00
Antonio Russo 8829ba19b7 Set file mode during zfs_write
3d40b65 refactored zfs_vnops.c, which shared much code verbatim between
Linux and BSD.  After a successful write, the suid/sgid bits are reset,
and the mode to be written is stored in newmode.  On Linux, this was
propagated to both the in-memory inode and znode, which is then updated
with sa_update.

3d40b65 accidentally removed the initialization of newmode, which
happened to occur on the same line as the inode update (which has been
moved out of the function).

The uninitialized newmode can be saved to disk, leading to a crash on
stat() of that file, in addition to a merely incorrect file mode.

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Antonio Russo <aerusso@aerusso.net>
Closes #11474 
Closes #11576
2021-02-08 09:20:38 -08:00
наб 642d86af0d zfs-import-{cache,scan}: change condition to FileNotEmpty
When all pools are exported ZFS will generate an empty cache file.
This will cause the import service to fail, which is sub-optimal, 
since this means that dracut fails, and it necessary to run 
`zpool import -a` to boot, delete the file, and regenerate+reinstall 
the initrd.

This resolves the issue by treating an zero-length cache files the
same as a missing cache file.  This aligns the behavior with that
of the `zpool` command itself.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Laager <rlaager@wiktel.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11568
2021-02-05 11:42:40 -08:00
Lorenz Hüdepohl 07ca7592ad dracut: Fix race condition between load-key and import
zfs-load-key.sh is called by the dracut-pre-mount.service unit which has
no explicit 'After' dependency on zfs-import.target. That way it can be
that the pool has not yet been imported and the zfs-load-key.sh finishes
without ever seeing the relevant pool.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Lorenz Hüdepohl <dev@stellardeath.org>
Closes #11500
2021-02-05 11:40:33 -08:00
Brian Behlendorf fb0d807477 zfs-list.8: clarify listing snapshots
Clarify how to include snapshots in the `zpool list` output by
referencing the full name of the `listsnapshots` pool property,
and the `zpool list -t snapshot` option.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #11562
Closes #11565
2021-02-05 11:32:22 -08:00
George Melikov 858ea8861c zts-report.py: ignore some skipped tests in Github CI
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Melikov <mail@gmelikov.ru>
Closes #11554
2021-02-05 11:31:56 -08:00
George Melikov 549841ef9a CI: add ubuntu-* functional tests runner
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Melikov <mail@gmelikov.ru>
Closes #11554
2021-02-05 11:31:38 -08:00
George Melikov 96f322e7e2 CI: rename zfs-tests workflow
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Melikov <mail@gmelikov.ru>
Closes #11554
2021-02-05 11:31:34 -08:00
51 changed files with 612 additions and 66 deletions
@@ -0,0 +1,64 @@
name: zfs-tests-functional
on:
push:
pull_request:
jobs:
tests-functional-ubuntu:
strategy:
fail-fast: false
matrix:
os: [18.04, 20.04]
runs-on: ubuntu-${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --yes -qq build-essential autoconf libtool gdb lcov \
git alien fakeroot wget curl bc fio acl \
sysstat mdadm lsscsi parted gdebi attr dbench watchdog ksh \
nfs-kernel-server samba rng-tools xz-utils \
zlib1g-dev uuid-dev libblkid-dev libselinux-dev \
xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \
libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \
libpam0g-dev pamtester python-dev python-setuptools python-cffi \
python3 python3-dev python3-setuptools python3-cffi
- name: Autogen.sh
run: |
sh autogen.sh
- name: Configure
run: |
./configure --enable-debug --enable-debuginfo
- name: Make
run: |
make --no-print-directory -s pkg-utils pkg-kmod
- name: Install
run: |
sudo dpkg -i *.deb
# Update order of directories to search for modules, otherwise
# Ubuntu will load kernel-shipped ones.
sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
sudo depmod
sudo modprobe zfs
- name: Tests
run: |
/usr/share/zfs/zfs-tests.sh -v -s 3G
- name: Prepare artifacts
if: failure()
run: |
RESULTS_PATH=$(readlink -f /var/tmp/test_results/current)
sudo dmesg > $RESULTS_PATH/dmesg
sudo cp /var/log/syslog $RESULTS_PATH/
sudo chmod +r $RESULTS_PATH/*
# Replace ':' in dir names, actions/upload-artifact doesn't support it
for f in $(find $RESULTS_PATH -name '*:*'); do mv "$f" "${f//:/__}"; done
- uses: actions/upload-artifact@v2
if: failure()
with:
name: Test logs Ubuntu-${{ matrix.os }}
path: /var/tmp/test_results/20*/
if-no-files-found: ignore
@@ -50,6 +50,8 @@ jobs:
sudo dmesg > $RESULTS_PATH/dmesg sudo dmesg > $RESULTS_PATH/dmesg
sudo cp /var/log/syslog $RESULTS_PATH/ sudo cp /var/log/syslog $RESULTS_PATH/
sudo chmod +r $RESULTS_PATH/* sudo chmod +r $RESULTS_PATH/*
# Replace ':' in dir names, actions/upload-artifact doesn't support it
for f in $(find $RESULTS_PATH -name '*:*'); do mv "$f" "${f//:/__}"; done
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
if: failure() if: failure()
with: with:
+2 -2
View File
@@ -1,10 +1,10 @@
Meta: 1 Meta: 1
Name: zfs Name: zfs
Branch: 1.0 Branch: 1.0
Version: 2.0.2 Version: 2.0.4
Release: 1 Release: 1
Release-Tags: relext Release-Tags: relext
License: CDDL License: CDDL
Author: OpenZFS Author: OpenZFS
Linux-Maximum: 5.10 Linux-Maximum: 5.11
Linux-Minimum: 3.10 Linux-Minimum: 3.10
-3
View File
@@ -6790,9 +6790,6 @@ report_mount_progress(int current, int total)
time_t now = time(NULL); time_t now = time(NULL);
char info[32]; char info[32];
/* report 1..n instead of 0..n-1 */
++current;
/* display header if we're here for the first time */ /* display header if we're here for the first time */
if (current == 1) { if (current == 1) {
set_progress_header(gettext("Mounting ZFS filesystems")); set_progress_header(gettext("Mounting ZFS filesystems"));
+4 -4
View File
@@ -7735,8 +7735,8 @@ print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs)
* do not print estimated time if hours_left is more than * do not print estimated time if hours_left is more than
* 30 days * 30 days
*/ */
(void) printf(gettext(" %s copied out of %s at %s/s, " (void) printf(gettext(
"%.2f%% done"), "\t%s copied out of %s at %s/s, %.2f%% done"),
examined_buf, total_buf, rate_buf, 100 * fraction_done); examined_buf, total_buf, rate_buf, 100 * fraction_done);
if (hours_left < (30 * 24)) { if (hours_left < (30 * 24)) {
(void) printf(gettext(", %lluh%um to go\n"), (void) printf(gettext(", %lluh%um to go\n"),
@@ -7751,8 +7751,8 @@ print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs)
if (prs->prs_mapping_memory > 0) { if (prs->prs_mapping_memory > 0) {
char mem_buf[7]; char mem_buf[7];
zfs_nicenum(prs->prs_mapping_memory, mem_buf, sizeof (mem_buf)); zfs_nicenum(prs->prs_mapping_memory, mem_buf, sizeof (mem_buf));
(void) printf(gettext(" %s memory used for " (void) printf(gettext(
"removed device mappings\n"), "\t%s memory used for removed device mappings\n"),
mem_buf); mem_buf);
} }
} }
+1
View File
@@ -248,6 +248,7 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose)
fflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); fflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo);
fflags &= ~(DMU_BACKUP_FEATURE_DEDUP | fflags &= ~(DMU_BACKUP_FEATURE_DEDUP |
DMU_BACKUP_FEATURE_DEDUPPROPS); DMU_BACKUP_FEATURE_DEDUPPROPS);
/* cppcheck-suppress syntaxError */
DMU_SET_FEATUREFLAGS(drrb->drr_versioninfo, fflags); DMU_SET_FEATUREFLAGS(drrb->drr_versioninfo, fflags);
int sz = drr->drr_payloadlen; int sz = drr->drr_payloadlen;
+2 -2
View File
@@ -132,7 +132,7 @@
#include <libnvpair.h> #include <libnvpair.h>
#include <libzutil.h> #include <libzutil.h>
#include <sys/crypto/icp.h> #include <sys/crypto/icp.h>
#ifdef __GLIBC__ #if (__GLIBC__ && !__UCLIBC__)
#include <execinfo.h> /* for backtrace() */ #include <execinfo.h> /* for backtrace() */
#endif #endif
@@ -556,7 +556,7 @@ dump_debug_buffer(void)
static void sig_handler(int signo) static void sig_handler(int signo)
{ {
struct sigaction action; struct sigaction action;
#ifdef __GLIBC__ /* backtrace() is a GNU extension */ #if (__GLIBC__ && !__UCLIBC__) /* backtrace() is a GNU extension */
int nptrs; int nptrs;
void *buffer[BACKTRACE_SZ]; void *buffer[BACKTRACE_SZ];
+29
View File
@@ -369,6 +369,33 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [
]) ])
]) ])
dnl #
dnl # Linux 5.12 API,
dnl #
dnl # The Linux 5.12 kernel updated struct bio to create a new bi_bdev member
dnl # and bio->bi_disk was moved to bio->bi_bdev->bd_disk
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BDEV_DISK], [
ZFS_LINUX_TEST_SRC([bio_bdev_disk], [
#include <linux/blk_types.h>
#include <linux/blkdev.h>
],[
struct bio *b = NULL;
struct gendisk *d = b->bi_bdev->bd_disk;
blk_register_queue(d);
])
])
AC_DEFUN([ZFS_AC_KERNEL_BIO_BDEV_DISK], [
AC_MSG_CHECKING([whether bio->bi_bdev->bd_disk exists])
ZFS_LINUX_TEST_RESULT([bio_bdev_disk], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_BDEV_DISK, 1, [bio->bi_bdev->bd_disk exists])
],[
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
ZFS_AC_KERNEL_SRC_REQ ZFS_AC_KERNEL_SRC_REQ
ZFS_AC_KERNEL_SRC_BIO_OPS ZFS_AC_KERNEL_SRC_BIO_OPS
@@ -379,6 +406,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
ZFS_AC_KERNEL_SRC_BIO_SUBMIT_BIO ZFS_AC_KERNEL_SRC_BIO_SUBMIT_BIO
ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST
ZFS_AC_KERNEL_SRC_BLKG_TRYGET ZFS_AC_KERNEL_SRC_BLKG_TRYGET
ZFS_AC_KERNEL_SRC_BIO_BDEV_DISK
]) ])
AC_DEFUN([ZFS_AC_KERNEL_BIO], [ AC_DEFUN([ZFS_AC_KERNEL_BIO], [
@@ -400,4 +428,5 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO], [
ZFS_AC_KERNEL_BIO_SUBMIT_BIO ZFS_AC_KERNEL_BIO_SUBMIT_BIO
ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST
ZFS_AC_KERNEL_BLKG_TRYGET ZFS_AC_KERNEL_BLKG_TRYGET
ZFS_AC_KERNEL_BIO_BDEV_DISK
]) ])
+47 -22
View File
@@ -2,6 +2,17 @@ dnl #
dnl # Check for generic io accounting interface. dnl # Check for generic io accounting interface.
dnl # dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
ZFS_LINUX_TEST_SRC([disk_io_acct], [
#include <linux/blkdev.h>
], [
struct gendisk *disk = NULL;
struct bio *bio = NULL;
unsigned long start_time;
start_time = disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio));
disk_end_io_acct(disk, bio_op(bio), start_time);
])
ZFS_LINUX_TEST_SRC([bio_io_acct], [ ZFS_LINUX_TEST_SRC([bio_io_acct], [
#include <linux/blkdev.h> #include <linux/blkdev.h>
], [ ], [
@@ -39,48 +50,62 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [ AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [
dnl # dnl #
dnl # 5.7 API, dnl # 5.12 API,
dnl # dnl #
dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers. dnl # bio_start_io_acct() and bio_end_io_acct() became GPL-exported
dnl # so use disk_start_io_acct() and disk_end_io_acct() instead
dnl # dnl #
AC_MSG_CHECKING([whether generic bio_*_io_acct() are available]) AC_MSG_CHECKING([whether generic disk_*_io_acct() are available])
ZFS_LINUX_TEST_RESULT([bio_io_acct], [ ZFS_LINUX_TEST_RESULT([disk_io_acct], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available]) AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available])
], [ ], [
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
dnl # dnl #
dnl # 4.14 API, dnl # 5.7 API,
dnl # dnl #
dnl # generic_start_io_acct/generic_end_io_acct now require dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers.
dnl # request_queue to be provided. No functional changes,
dnl # but preparation for inflight accounting.
dnl # dnl #
AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args]) AC_MSG_CHECKING([whether generic bio_*_io_acct() are available])
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args], ZFS_LINUX_TEST_RESULT([bio_io_acct], [
[generic_start_io_acct], [block/bio.c], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1, AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available])
[generic_*_io_acct() 4 arg available])
], [ ], [
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
dnl # dnl #
dnl # 3.19 API addition dnl # 4.14 API,
dnl # dnl #
dnl # torvalds/linux@394ffa50 allows us to increment dnl # generic_start_io_acct/generic_end_io_acct now require
dnl # iostat counters without generic_make_request(). dnl # request_queue to be provided. No functional changes,
dnl # but preparation for inflight accounting.
dnl # dnl #
AC_MSG_CHECKING( AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args])
[whether generic_*_io_acct wants 3 args]) ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args],
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args],
[generic_start_io_acct], [block/bio.c], [ [generic_start_io_acct], [block/bio.c], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1, AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1,
[generic_*_io_acct() 3 arg available]) [generic_*_io_acct() 4 arg available])
], [ ], [
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
dnl #
dnl # 3.19 API addition
dnl #
dnl # torvalds/linux@394ffa50 allows us to increment
dnl # iostat counters without generic_make_request().
dnl #
AC_MSG_CHECKING(
[whether generic_*_io_acct wants 3 args])
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args],
[generic_start_io_acct], [block/bio.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
[generic_*_io_acct() 3 arg available])
], [
AC_MSG_RESULT(no)
])
]) ])
]) ])
]) ])
+1
View File
@@ -228,6 +228,7 @@ AC_CONFIG_FILES([
tests/zfs-tests/cmd/readmmap/Makefile tests/zfs-tests/cmd/readmmap/Makefile
tests/zfs-tests/cmd/rename_dir/Makefile tests/zfs-tests/cmd/rename_dir/Makefile
tests/zfs-tests/cmd/rm_lnkcnt_zero_file/Makefile tests/zfs-tests/cmd/rm_lnkcnt_zero_file/Makefile
tests/zfs-tests/cmd/send_doall/Makefile
tests/zfs-tests/cmd/stride_dd/Makefile tests/zfs-tests/cmd/stride_dd/Makefile
tests/zfs-tests/cmd/threadsappend/Makefile tests/zfs-tests/cmd/threadsappend/Makefile
tests/zfs-tests/cmd/user_ns_exec/Makefile tests/zfs-tests/cmd/user_ns_exec/Makefile
+8
View File
@@ -59,4 +59,12 @@ echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR"/sysr
[ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires ] || mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires [ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires ] || mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires
ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount
[ -d "$GENERATOR_DIR"/dracut-pre-mount.service.d ] || mkdir "$GENERATOR_DIR"/dracut-pre-mount.service.d
{
echo "[Unit]"
echo "After=zfs-import.target"
} > "$GENERATOR_DIR"/dracut-pre-mount.service.d/zfs-enhancement.conf
echo "zfs-generator: finished" >> /dev/kmsg echo "zfs-generator: finished" >> /dev/kmsg
@@ -8,7 +8,7 @@ After=cryptsetup.target
After=multipathd.target After=multipathd.target
After=systemd-remount-fs.service After=systemd-remount-fs.service
Before=zfs-import.target Before=zfs-import.target
ConditionPathExists=@sysconfdir@/zfs/zpool.cache ConditionFileNotEmpty=@sysconfdir@/zfs/zpool.cache
ConditionPathIsDirectory=/sys/module/zfs ConditionPathIsDirectory=/sys/module/zfs
[Service] [Service]
@@ -7,7 +7,7 @@ After=systemd-udev-settle.service
After=cryptsetup.target After=cryptsetup.target
After=multipathd.target After=multipathd.target
Before=zfs-import.target Before=zfs-import.target
ConditionPathExists=!@sysconfdir@/zfs/zpool.cache ConditionFileNotEmpty=!@sysconfdir@/zfs/zpool.cache
ConditionPathIsDirectory=/sys/module/zfs ConditionPathIsDirectory=/sys/module/zfs
[Service] [Service]
@@ -520,7 +520,9 @@ blk_generic_start_io_acct(struct request_queue *q __attribute__((unused)),
struct gendisk *disk __attribute__((unused)), struct gendisk *disk __attribute__((unused)),
int rw __attribute__((unused)), struct bio *bio) int rw __attribute__((unused)), struct bio *bio)
{ {
#if defined(HAVE_BIO_IO_ACCT) #if defined(HAVE_DISK_IO_ACCT)
return (disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio)));
#elif defined(HAVE_BIO_IO_ACCT)
return (bio_start_io_acct(bio)); return (bio_start_io_acct(bio));
#elif defined(HAVE_GENERIC_IO_ACCT_3ARG) #elif defined(HAVE_GENERIC_IO_ACCT_3ARG)
unsigned long start_time = jiffies; unsigned long start_time = jiffies;
@@ -541,7 +543,9 @@ blk_generic_end_io_acct(struct request_queue *q __attribute__((unused)),
struct gendisk *disk __attribute__((unused)), struct gendisk *disk __attribute__((unused)),
int rw __attribute__((unused)), struct bio *bio, unsigned long start_time) int rw __attribute__((unused)), struct bio *bio, unsigned long start_time)
{ {
#if defined(HAVE_BIO_IO_ACCT) #if defined(HAVE_DISK_IO_ACCT)
disk_end_io_acct(disk, bio_op(bio), start_time);
#elif defined(HAVE_BIO_IO_ACCT)
bio_end_io_acct(bio, start_time); bio_end_io_acct(bio, start_time);
#elif defined(HAVE_GENERIC_IO_ACCT_3ARG) #elif defined(HAVE_GENERIC_IO_ACCT_3ARG)
generic_end_io_acct(rw, &disk->part0, start_time); generic_end_io_acct(rw, &disk->part0, start_time);
+1
View File
@@ -110,6 +110,7 @@ COMMON_H = \
zfs_fuid.h \ zfs_fuid.h \
zfs_project.h \ zfs_project.h \
zfs_quota.h \ zfs_quota.h \
zfs_racct.h \
zfs_ratelimit.h \ zfs_ratelimit.h \
zfs_refcount.h \ zfs_refcount.h \
zfs_rlock.h \ zfs_rlock.h \
+2
View File
@@ -39,6 +39,7 @@ redact_block_get_size(redact_block_phys_t *rbp)
static inline void static inline void
redact_block_set_size(redact_block_phys_t *rbp, uint64_t size) redact_block_set_size(redact_block_phys_t *rbp, uint64_t size)
{ {
/* cppcheck-suppress syntaxError */
BF64_SET_SB((rbp)->rbp_size_count, 48, 16, SPA_MINBLOCKSHIFT, 0, size); BF64_SET_SB((rbp)->rbp_size_count, 48, 16, SPA_MINBLOCKSHIFT, 0, size);
} }
@@ -51,6 +52,7 @@ redact_block_get_count(redact_block_phys_t *rbp)
static inline void static inline void
redact_block_set_count(redact_block_phys_t *rbp, uint64_t count) redact_block_set_count(redact_block_phys_t *rbp, uint64_t count)
{ {
/* cppcheck-suppress syntaxError */
BF64_SET_SB((rbp)->rbp_size_count, 0, 48, 0, 1, count); BF64_SET_SB((rbp)->rbp_size_count, 0, 48, 0, 1, count);
} }
+37
View File
@@ -0,0 +1,37 @@
/*
* 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
*/
/*
* Portions Copyright 2021 iXsystems, Inc.
*/
#ifndef _SYS_ZFS_RACCT_H
#define _SYS_ZFS_RACCT_H
#include <sys/zfs_context.h>
/*
* Platform-dependent resource accounting hooks
*/
void zfs_racct_read(uint64_t size, uint64_t iops);
void zfs_racct_write(uint64_t size, uint64_t iops);
#endif /* _SYS_ZFS_RACCT_H */
+7 -3
View File
@@ -532,6 +532,8 @@ get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,
break; break;
case ZFS_KEYLOCATION_URI: case ZFS_KEYLOCATION_URI:
ret = ENOTSUP;
for (handler = uri_handlers; handler->zuh_scheme != NULL; for (handler = uri_handlers; handler->zuh_scheme != NULL;
handler++) { handler++) {
if (strcmp(handler->zuh_scheme, uri_scheme) != 0) if (strcmp(handler->zuh_scheme, uri_scheme) != 0)
@@ -544,9 +546,11 @@ get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,
break; break;
} }
ret = ENOTSUP; if (ret == ENOTSUP) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"URI scheme is not supported")); "URI scheme is not supported"));
goto error;
}
break; break;
default: default:
+9
View File
@@ -321,6 +321,15 @@ send_iterate_snap(zfs_handle_t *zhp, void *arg)
} }
if (!sd->recursive) { if (!sd->recursive) {
/*
* To allow a doall stream to work properly
* with a NULL fromsnap
*/
if (sd->doall && sd->fromsnap == NULL && !sd->seenfrom) {
sd->seenfrom = B_TRUE;
}
if (!sd->seenfrom && isfromsnap) { if (!sd->seenfrom && isfromsnap) {
sd->seenfrom = B_TRUE; sd->seenfrom = B_TRUE;
zfs_close(zhp); zfs_close(zhp);
+1
View File
@@ -161,6 +161,7 @@ KERNEL_C = \
zfs_debug.c \ zfs_debug.c \
zfs_fm.c \ zfs_fm.c \
zfs_fuid.c \ zfs_fuid.c \
zfs_racct.c \
zfs_sa.c \ zfs_sa.c \
zfs_znode.c \ zfs_znode.c \
zfs_ratelimit.c \ zfs_ratelimit.c \
+1 -1
View File
@@ -159,7 +159,7 @@ set_global_var(char *arg)
char *varname = arg, *varval; char *varname = arg, *varval;
u_longlong_t val; u_longlong_t val;
#ifndef _LITTLE_ENDIAN #ifndef _ZFS_LITTLE_ENDIAN
/* /*
* On big endian systems changing a 64-bit variable would set the high * On big endian systems changing a 64-bit variable would set the high
* 32 bits instead of the low 32 bits, which could cause unexpected * 32 bits instead of the low 32 bits, which could cause unexpected
+1 -1
View File
@@ -1186,7 +1186,7 @@ amount of memory. When the limit is exceeded, the ioctl fails with EINVAL and a
description of the error is sent to the zfs-dbgmsg log. This parameter should description of the error is sent to the zfs-dbgmsg log. This parameter should
not need to be touched under normal circumstances. On FreeBSD, the default is not need to be touched under normal circumstances. On FreeBSD, the default is
based on the system limit on user wired memory. On Linux, the default is based on the system limit on user wired memory. On Linux, the default is
\fBKMALLOC_MAX_SIZE\fR . \fB128MB\fR.
.sp .sp
Default value: \fB0\fR (kernel decides) Default value: \fB0\fR (kernel decides)
.RE .RE
+8 -3
View File
@@ -63,12 +63,17 @@ If specified, you can list property information by the absolute pathname or the
relative pathname. relative pathname.
By default, all file systems and volumes are displayed. By default, all file systems and volumes are displayed.
Snapshots are displayed if the Snapshots are displayed if the
.Sy listsnaps .Sy listsnapshots
property is pool property is
.Sy on .Sy on
.Po the default is .Po the default is
.Sy off .Sy off
.Pc . .Pc ,
or if the
.Fl t Sy snapshot
or
.Fl t Sy all
options are specified.
The following fields are displayed: The following fields are displayed:
.Sy name Ns \&, Sy used Ns \&, Sy available Ns \&, Sy referenced Ns \&, Sy mountpoint Ns . .Sy name Ns \&, Sy used Ns \&, Sy available Ns \&, Sy referenced Ns \&, Sy mountpoint Ns .
.Bl -tag -width "-H" .Bl -tag -width "-H"
+10
View File
@@ -261,6 +261,16 @@ causes the property to be inherited by all descendant datasets, as through
was run on any descendant datasets that have this property set on the was run on any descendant datasets that have this property set on the
sending system. sending system.
.Pp .Pp
If the send stream was sent with
.Fl c
then overriding the
.Sy compression
property will have no affect on received data but the
.Sy compression
property will be set. To have the data recompressed on receive remove the
.Fl c
flag from the send stream.
.Pp
Any editable property can be set at receive time. Set-once properties bound Any editable property can be set at receive time. Set-once properties bound
to the received data, such as to the received data, such as
.Sy normalization .Sy normalization
+6 -1
View File
@@ -189,7 +189,12 @@ feature is enabled on the sending system but the
option is not supplied in conjunction with option is not supplied in conjunction with
.Fl c , .Fl c ,
then the data will be decompressed before sending so it can be split into then the data will be decompressed before sending so it can be split into
smaller block sizes. smaller block sizes. Streams sent with
.Fl c
will not have their data recompressed on the receiver side using
.Fl o compress=value.
The data will stay compressed as it was from the sender. The new compression
property will be set for future data.
.It Fl w, -raw .It Fl w, -raw
For encrypted datasets, send data exactly as it exists on disk. This allows For encrypted datasets, send data exactly as it exists on disk. This allows
backups to be taken even if encryption keys are not currently loaded. The backups to be taken even if encryption keys are not currently loaded. The
+1
View File
@@ -153,6 +153,7 @@ SRCS+= abd_os.c \
zfs_dir.c \ zfs_dir.c \
zfs_ioctl_compat.c \ zfs_ioctl_compat.c \
zfs_ioctl_os.c \ zfs_ioctl_os.c \
zfs_racct.c \
zfs_vfsops.c \ zfs_vfsops.c \
zfs_vnops_os.c \ zfs_vnops_os.c \
zfs_znode.c \ zfs_znode.c \
+13 -2
View File
@@ -293,8 +293,19 @@ freebsd_crypt_newsession(freebsd_crypt_session_t *sessp,
error = ENOTSUP; error = ENOTSUP;
goto bad; goto bad;
} }
error = crypto_newsession(&sessp->fs_sid, &csp,
CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE); /*
* Disable the use of hardware drivers on FreeBSD 13 and later since
* common crypto offload drivers impose constraints on AES-GCM AAD
* lengths that make them unusable for ZFS, and we currently do not have
* a mechanism to fall back to a software driver for requests not
* handled by a hardware driver.
*
* On 12 we continue to permit the use of hardware drivers since
* CPU-accelerated drivers such as aesni(4) register themselves as
* hardware drivers.
*/
error = crypto_newsession(&sessp->fs_sid, &csp, CRYPTOCAP_F_SOFTWARE);
mtx_init(&sessp->fs_lock, "FreeBSD Cryptographic Session Lock", mtx_init(&sessp->fs_lock, "FreeBSD Cryptographic Session Lock",
NULL, MTX_DEF); NULL, MTX_DEF);
crypt_sessions++; crypt_sessions++;
+1 -1
View File
@@ -319,7 +319,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
break; break;
} }
ASSERT(m->dirty == 0); ASSERT(m->dirty == 0);
ASSERT(!pmap_page_is_mapped(m)); ASSERT(!pmap_page_is_write_mapped(m));
ASSERT(db->db_size > PAGE_SIZE); ASSERT(db->db_size > PAGE_SIZE);
bufoff = IDX_TO_OFF(m->pindex) % db->db_size; bufoff = IDX_TO_OFF(m->pindex) % db->db_size;
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2021 iXsystems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/zfs_racct.h>
#include <sys/racct.h>
void
zfs_racct_read(uint64_t size, uint64_t iops)
{
curthread->td_ru.ru_inblock += iops;
#ifdef RACCT
if (racct_enable) {
PROC_LOCK(curproc);
racct_add_force(curproc, RACCT_READBPS, size);
racct_add_force(curproc, RACCT_READIOPS, iops);
PROC_UNLOCK(curproc);
}
#endif /* RACCT */
}
void
zfs_racct_write(uint64_t size, uint64_t iops)
{
curthread->td_ru.ru_oublock += iops;
#ifdef RACCT
if (racct_enable) {
PROC_LOCK(curproc);
racct_add_force(curproc, RACCT_WRITEBPS, size);
racct_add_force(curproc, RACCT_WRITEIOPS, iops);
PROC_UNLOCK(curproc);
}
#endif /* RACCT */
}
+1
View File
@@ -22,6 +22,7 @@ $(MODULE)-objs += ../os/linux/zfs/zfs_debug.o
$(MODULE)-objs += ../os/linux/zfs/zfs_dir.o $(MODULE)-objs += ../os/linux/zfs/zfs_dir.o
$(MODULE)-objs += ../os/linux/zfs/zfs_file_os.o $(MODULE)-objs += ../os/linux/zfs/zfs_file_os.o
$(MODULE)-objs += ../os/linux/zfs/zfs_ioctl_os.o $(MODULE)-objs += ../os/linux/zfs/zfs_ioctl_os.o
$(MODULE)-objs += ../os/linux/zfs/zfs_racct.o
$(MODULE)-objs += ../os/linux/zfs/zfs_sysfs.o $(MODULE)-objs += ../os/linux/zfs/zfs_sysfs.o
$(MODULE)-objs += ../os/linux/zfs/zfs_uio.o $(MODULE)-objs += ../os/linux/zfs/zfs_uio.o
$(MODULE)-objs += ../os/linux/zfs/zfs_vfsops.o $(MODULE)-objs += ../os/linux/zfs/zfs_vfsops.o
+4
View File
@@ -499,7 +499,11 @@ vdev_blkg_tryget(struct blkcg_gq *blkg)
static inline void static inline void
vdev_bio_associate_blkg(struct bio *bio) vdev_bio_associate_blkg(struct bio *bio)
{ {
#if defined(HAVE_BIO_BDEV_DISK)
struct request_queue *q = bio->bi_bdev->bd_disk->queue;
#else
struct request_queue *q = bio->bi_disk->queue; struct request_queue *q = bio->bi_disk->queue;
#endif
ASSERT3P(q, !=, NULL); ASSERT3P(q, !=, NULL);
ASSERT3P(bio->bi_blkg, ==, NULL); ASSERT3P(bio->bi_blkg, ==, NULL);
+21 -5
View File
@@ -2214,13 +2214,11 @@ zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mode)
} }
/* /*
* Only check for READONLY on non-directories. * Intentionally allow ZFS_READONLY through here.
* See zfs_zaccess_common().
*/ */
if ((v4_mode & WRITE_MASK_DATA) && if ((v4_mode & WRITE_MASK_DATA) &&
((!S_ISDIR(ZTOI(zp)->i_mode) && (zp->z_pflags & ZFS_IMMUTABLE)) {
(zp->z_pflags & (ZFS_READONLY | ZFS_IMMUTABLE))) ||
(S_ISDIR(ZTOI(zp)->i_mode) &&
(zp->z_pflags & ZFS_IMMUTABLE)))) {
return (SET_ERROR(EPERM)); return (SET_ERROR(EPERM));
} }
@@ -2434,6 +2432,24 @@ zfs_zaccess_common(znode_t *zp, uint32_t v4_mode, uint32_t *working_mode,
return (0); return (0);
} }
/*
* Note: ZFS_READONLY represents the "DOS R/O" attribute.
* When that flag is set, we should behave as if write access
* were not granted by anything in the ACL. In particular:
* We _must_ allow writes after opening the file r/w, then
* setting the DOS R/O attribute, and writing some more.
* (Similar to how you can write after fchmod(fd, 0444).)
*
* Therefore ZFS_READONLY is ignored in the dataset check
* above, and checked here as if part of the ACL check.
* Also note: DOS R/O is ignored for directories.
*/
if ((v4_mode & WRITE_MASK_DATA) &&
S_ISDIR(ZTOI(zp)->i_mode) &&
(zp->z_pflags & ZFS_READONLY)) {
return (SET_ERROR(EPERM));
}
return (zfs_zaccess_aces_check(zp, working_mode, B_FALSE, cr)); return (zfs_zaccess_aces_check(zp, working_mode, B_FALSE, cr));
} }
+1 -1
View File
@@ -209,7 +209,7 @@ zfs_max_nvlist_src_size_os(void)
if (zfs_max_nvlist_src_size != 0) if (zfs_max_nvlist_src_size != 0)
return (zfs_max_nvlist_src_size); return (zfs_max_nvlist_src_size);
return (KMALLOC_MAX_SIZE); return (MIN(ptob(zfs_totalram_pages) / 4, 128 * 1024 * 1024));
} }
void void
+36
View File
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2021 iXsystems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/zfs_racct.h>
void
zfs_racct_read(uint64_t size, uint64_t iops)
{
}
void
zfs_racct_write(uint64_t size, uint64_t iops)
{
}
+1
View File
@@ -1399,6 +1399,7 @@ zio_crypt_init_uios_zil(boolean_t encrypt, uint8_t *plainbuf,
nr_src = 1; nr_src = 1;
nr_dst = 0; nr_dst = 0;
} }
bzero(dst, datalen);
/* find the start and end record of the log block */ /* find the start and end record of the log block */
zilc = (zil_chain_t *)src; zilc = (zil_chain_t *)src;
+4
View File
@@ -307,7 +307,11 @@ zvol_request(struct request_queue *q, struct bio *bio)
#endif #endif
{ {
#ifdef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS #ifdef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS
#if defined(HAVE_BIO_BDEV_DISK)
struct request_queue *q = bio->bi_bdev->bd_disk->queue;
#else
struct request_queue *q = bio->bi_disk->queue; struct request_queue *q = bio->bi_disk->queue;
#endif
#endif #endif
zvol_state_t *zv = q->queuedata; zvol_state_t *zv = q->queuedata;
fstrans_cookie_t cookie = spl_fstrans_mark(); fstrans_cookie_t cookie = spl_fstrans_mark();
+1 -1
View File
@@ -417,7 +417,7 @@ zfs_prop_init(void)
ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
"on | off | lzjb | gzip | gzip-[1-9] | zle | lz4 | " "on | off | lzjb | gzip | gzip-[1-9] | zle | lz4 | "
"zstd | zstd-[1-19] | " "zstd | zstd-[1-19] | "
"zstd-fast-[1-10,20,30,40,50,60,70,80,90,100,500,1000]", "zstd-fast | zstd-fast-[1-10,20,30,40,50,60,70,80,90,100,500,1000]",
"COMPRESS", compress_table); "COMPRESS", compress_table);
zprop_register_index(ZFS_PROP_SNAPDIR, "snapdir", ZFS_SNAPDIR_HIDDEN, zprop_register_index(ZFS_PROP_SNAPDIR, "snapdir", ZFS_SNAPDIR_HIDDEN,
PROP_INHERIT, ZFS_TYPE_FILESYSTEM, PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
+2
View File
@@ -308,6 +308,7 @@
#include <sys/aggsum.h> #include <sys/aggsum.h>
#include <cityhash.h> #include <cityhash.h>
#include <sys/vdev_trim.h> #include <sys/vdev_trim.h>
#include <sys/zfs_racct.h>
#include <sys/zstd/zstd.h> #include <sys/zstd/zstd.h>
#ifndef _KERNEL #ifndef _KERNEL
@@ -6180,6 +6181,7 @@ top:
ARCSTAT_CONDSTAT(!HDR_PREFETCH(hdr), ARCSTAT_CONDSTAT(!HDR_PREFETCH(hdr),
demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data, demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data,
metadata, misses); metadata, misses);
zfs_racct_read(size, 1);
} }
if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) { if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) {
+5
View File
@@ -52,6 +52,7 @@
#include <sys/zfeature.h> #include <sys/zfeature.h>
#include <sys/abd.h> #include <sys/abd.h>
#include <sys/trace_zfs.h> #include <sys/trace_zfs.h>
#include <sys/zfs_racct.h>
#include <sys/zfs_rlock.h> #include <sys/zfs_rlock.h>
#ifdef _KERNEL #ifdef _KERNEL
#include <sys/vmsystm.h> #include <sys/vmsystm.h>
@@ -548,6 +549,9 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
dbp[i] = &db->db; dbp[i] = &db->db;
} }
if (!read)
zfs_racct_write(length, nblks);
if ((flags & DMU_READ_NO_PREFETCH) == 0 && if ((flags & DMU_READ_NO_PREFETCH) == 0 &&
DNODE_META_IS_CACHEABLE(dn) && length <= zfetch_array_rd_sz) { DNODE_META_IS_CACHEABLE(dn) && length <= zfetch_array_rd_sz) {
dmu_zfetch(&dn->dn_zfetch, blkid, nblks, dmu_zfetch(&dn->dn_zfetch, blkid, nblks,
@@ -1587,6 +1591,7 @@ dmu_assign_arcbuf_by_dnode(dnode_t *dn, uint64_t offset, arc_buf_t *buf,
* same size as the dbuf, and the dbuf is not metadata. * same size as the dbuf, and the dbuf is not metadata.
*/ */
if (offset == db->db.db_offset && blksz == db->db.db_size) { if (offset == db->db.db_offset && blksz == db->db.db_size) {
zfs_racct_write(blksz, 1);
dbuf_assign_arcbuf(db, buf, tx); dbuf_assign_arcbuf(db, buf, tx);
dbuf_rele(db, FTAG); dbuf_rele(db, FTAG);
} else { } else {
+2 -2
View File
@@ -2317,7 +2317,7 @@ vdev_hold(vdev_t *vd)
for (int c = 0; c < vd->vdev_children; c++) for (int c = 0; c < vd->vdev_children; c++)
vdev_hold(vd->vdev_child[c]); vdev_hold(vd->vdev_child[c]);
if (vd->vdev_ops->vdev_op_leaf) if (vd->vdev_ops->vdev_op_leaf && vd->vdev_ops->vdev_op_hold != NULL)
vd->vdev_ops->vdev_op_hold(vd); vd->vdev_ops->vdev_op_hold(vd);
} }
@@ -2328,7 +2328,7 @@ vdev_rele(vdev_t *vd)
for (int c = 0; c < vd->vdev_children; c++) for (int c = 0; c < vd->vdev_children; c++)
vdev_rele(vd->vdev_child[c]); vdev_rele(vd->vdev_child[c]);
if (vd->vdev_ops->vdev_op_leaf) if (vd->vdev_ops->vdev_op_leaf && vd->vdev_ops->vdev_op_rele != NULL)
vd->vdev_ops->vdev_op_rele(vd); vd->vdev_ops->vdev_op_rele(vd);
} }
+5 -2
View File
@@ -258,9 +258,11 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
} }
/* /*
* If immutable or not appending then return EPERM * If immutable or not appending then return EPERM.
* Intentionally allow ZFS_READONLY through here.
* See zfs_zaccess_common()
*/ */
if ((zp->z_pflags & (ZFS_IMMUTABLE | ZFS_READONLY)) || if ((zp->z_pflags & ZFS_IMMUTABLE) ||
((zp->z_pflags & ZFS_APPENDONLY) && !(ioflag & O_APPEND) && ((zp->z_pflags & ZFS_APPENDONLY) && !(ioflag & O_APPEND) &&
(uio->uio_loffset < zp->z_size))) { (uio->uio_loffset < zp->z_size))) {
ZFS_EXIT(zfsvfs); ZFS_EXIT(zfsvfs);
@@ -528,6 +530,7 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
((zp->z_mode & S_ISUID) != 0 && uid == 0)) != 0) { ((zp->z_mode & S_ISUID) != 0 && uid == 0)) != 0) {
uint64_t newmode; uint64_t newmode;
zp->z_mode &= ~(S_ISUID | S_ISGID); zp->z_mode &= ~(S_ISUID | S_ISGID);
newmode = zp->z_mode;
(void) sa_update(zp->z_sa_hdl, SA_ZPL_MODE(zfsvfs), (void) sa_update(zp->z_sa_hdl, SA_ZPL_MODE(zfsvfs),
(void *)&newmode, sizeof (uint64_t), tx); (void *)&newmode, sizeof (uint64_t), tx);
} }
+1 -1
View File
@@ -804,7 +804,7 @@ tests = ['recv_dedup', 'recv_dedup_encrypted_zvol', 'rsend_001_pos',
'send_freeobjects', 'send_realloc_files', 'send_freeobjects', 'send_realloc_files',
'send_realloc_encrypted_files', 'send_spill_block', 'send_holds', 'send_realloc_encrypted_files', 'send_spill_block', 'send_holds',
'send_hole_birth', 'send_mixed_raw', 'send-wR_encrypted_zvol', 'send_hole_birth', 'send_mixed_raw', 'send-wR_encrypted_zvol',
'send_partial_dataset', 'send_invalid'] 'send_partial_dataset', 'send_invalid', 'send_doall']
tags = ['functional', 'rsend'] tags = ['functional', 'rsend']
[tests/functional/scrub_mirror] [tests/functional/scrub_mirror]
+34
View File
@@ -127,6 +127,11 @@ trim_reason = 'DISKS must support discard (TRIM/UNMAP)'
# #
na_reason = "Not applicable" na_reason = "Not applicable"
#
# Some test cases doesn't have all requirements to run on Github actions CI.
#
ci_reason = 'CI runner doesn\'t have all requirements'
summary = { summary = {
'total': float(0), 'total': float(0),
'passed': float(0), 'passed': float(0),
@@ -274,6 +279,35 @@ elif sys.platform.startswith('linux'):
}) })
# Not all Github actions runners have scsi_debug module, so we may skip
# some tests which use it.
if os.environ.get('CI') == 'true':
known.update({
'cli_root/zpool_expand/zpool_expand_001_pos': ['SKIP', ci_reason],
'cli_root/zpool_expand/zpool_expand_003_neg': ['SKIP', ci_reason],
'cli_root/zpool_expand/zpool_expand_005_pos': ['SKIP', ci_reason],
'cli_root/zpool_reopen/setup': ['SKIP', ci_reason],
'cli_root/zpool_reopen/zpool_reopen_001_pos': ['SKIP', ci_reason],
'cli_root/zpool_reopen/zpool_reopen_002_pos': ['SKIP', ci_reason],
'cli_root/zpool_reopen/zpool_reopen_003_pos': ['SKIP', ci_reason],
'cli_root/zpool_reopen/zpool_reopen_004_pos': ['SKIP', ci_reason],
'cli_root/zpool_reopen/zpool_reopen_005_pos': ['SKIP', ci_reason],
'cli_root/zpool_reopen/zpool_reopen_006_neg': ['SKIP', ci_reason],
'cli_root/zpool_reopen/zpool_reopen_007_pos': ['SKIP', ci_reason],
'cli_root/zpool_split/zpool_split_wholedisk': ['SKIP', ci_reason],
'fault/auto_offline_001_pos': ['SKIP', ci_reason],
'fault/auto_online_001_pos': ['SKIP', ci_reason],
'fault/auto_replace_001_pos': ['SKIP', ci_reason],
'fault/auto_spare_ashift': ['SKIP', ci_reason],
'fault/auto_spare_shared': ['SKIP', ci_reason],
'procfs/pool_state': ['SKIP', ci_reason],
})
maybe.update({
'events/events_002_pos': ['FAIL', '11546'],
})
def usage(s): def usage(s):
print(s) print(s)
sys.exit(1) sys.exit(1)
+1
View File
@@ -24,6 +24,7 @@ SUBDIRS = \
readmmap \ readmmap \
rename_dir \ rename_dir \
rm_lnkcnt_zero_file \ rm_lnkcnt_zero_file \
send_doall \
stride_dd \ stride_dd \
threadsappend threadsappend
@@ -0,0 +1 @@
/send_doall
@@ -0,0 +1,11 @@
include $(top_srcdir)/config/Rules.am
pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
pkgexec_PROGRAMS = send_doall
send_doall_SOURCES = send_doall.c
send_doall_LDADD = \
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
$(abs_top_builddir)/lib/libzfs/libzfs.la \
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
@@ -0,0 +1,87 @@
/*
* 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
*/
/*
* Portions Copyright 2020 iXsystems, Inc.
*/
/*
* Test a corner case : a "doall" send without children datasets.
*/
#include <libzfs.h>
#include <libzfs_core.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sysexits.h>
#include <err.h>
static void
usage(const char *name)
{
fprintf(stderr, "usage: %s snap\n", name);
exit(EX_USAGE);
}
int
main(int argc, char const * const argv[])
{
sendflags_t flags = { 0 };
libzfs_handle_t *zhdl;
zfs_handle_t *zhp;
const char *tofull, *fsname, *tosnap, *p;
int error;
if (argc != 2)
usage(argv[0]);
tofull = argv[1];
p = strchr(tofull, '@');
if (p == NULL)
usage(argv[0]);
tosnap = p + 1;
fsname = strndup(tofull, p - tofull);
zhdl = libzfs_init();
if (zhdl == NULL)
errx(EX_OSERR, "libzfs_init(): %s", libzfs_error_init(errno));
zhp = zfs_open(zhdl, fsname, ZFS_TYPE_FILESYSTEM);
if (zhp == NULL)
err(EX_OSERR, "zfs_open(\"%s\")", fsname);
flags.doall = B_TRUE;
error = zfs_send(zhp, NULL, tosnap, &flags,
STDOUT_FILENO, NULL, NULL, NULL);
zfs_close(zhp);
libzfs_fini(zhdl);
free((void *)fsname);
return (error);
}
+2 -4
View File
@@ -44,11 +44,9 @@
#include <sys/time.h> #include <sys/time.h>
#include <linux/limits.h> #include <linux/limits.h>
extern char *program_invocation_short_name;
#define ERROR(fmt, ...) \ #define ERROR(fmt, ...) \
fprintf(stderr, "%s: %s:%d: %s: " fmt "\n", \ fprintf(stderr, "xattrtest: %s:%d: %s: " fmt "\n", \
program_invocation_short_name, __FILE__, __LINE__, \ __FILE__, __LINE__, \
__func__, ## __VA_ARGS__); __func__, ## __VA_ARGS__);
static const char shortopts[] = "hvycdn:f:x:s:p:t:e:rRko:"; static const char shortopts[] = "hvycdn:f:x:s:p:t:e:rRko:";
+1
View File
@@ -215,6 +215,7 @@ export ZFSTEST_FILES='badsend
readmmap readmmap
rename_dir rename_dir
rm_lnkcnt_zero_file rm_lnkcnt_zero_file
send_doall
threadsappend threadsappend
user_ns_exec user_ns_exec
xattrtest xattrtest
@@ -53,7 +53,8 @@ dist_pkgdata_SCRIPTS = \
send_hole_birth.ksh \ send_hole_birth.ksh \
send_invalid.ksh \ send_invalid.ksh \
send_mixed_raw.ksh \ send_mixed_raw.ksh \
send-wR_encrypted_zvol.ksh send-wR_encrypted_zvol.ksh \
send_doall.ksh
dist_pkgdata_DATA = \ dist_pkgdata_DATA = \
dedup.zsend.bz2 \ dedup.zsend.bz2 \
@@ -62,3 +63,4 @@ dist_pkgdata_DATA = \
fs.tar.gz \ fs.tar.gz \
rsend.cfg \ rsend.cfg \
rsend.kshlib rsend.kshlib
+67
View File
@@ -0,0 +1,67 @@
#!/bin/ksh
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2019 by Lawrence Livermore National Security, LLC.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/rsend/rsend.kshlib
#
# Description:
# Verify send_doall stream is properly received
#
# Strategy:
# 1) Create a set of snapshots.
# 2) Send these snapshots (from origin to the last one) to a file using send_doall.
# 3) Receive the file to newfs to test if the stream is properly handled.
#
verify_runnable "both"
log_assert "Verify send_doall stream is correct"
function cleanup
{
rm -f $BACKDIR/fs@*
destroy_dataset $POOL/fs "-rR"
destroy_dataset $POOL/newfs "-rR"
}
log_onexit cleanup
log_must zfs create $POOL/fs
log_must zfs create $POOL/fs/child
# Create 3 files and a snapshot between each file creation.
for i in {1..3}; do
file="/$POOL/fs/file$i"
log_must mkfile 16384 $file
file="/$POOL/fs/child/file$i"
log_must mkfile 16384 $file
log_must zfs snapshot -r $POOL/fs@snap$i
done
# Snapshot the pool and send it to the new dataset.
log_must eval "send_doall $POOL/fs@snap3 >$BACKDIR/fs@snap3"
log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs@snap3"
zfs list $POOL/newfs/child
if [[ $? -eq 0 ]]; then
log_fail "Children dataset should not have been received"
fi
log_pass "Verify send_doall stream is correct"