zfs/config
Brian Behlendorf 3ec3bc2167 OpenZFS 7793 - ztest fails assertion in dmu_tx_willuse_space
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>

Background information: This assertion about tx_space_* verifies that we
are not dirtying more stuff than we thought we would. We “need” to know
how much we will dirty so that we can check if we should fail this
transaction with ENOSPC/EDQUOT, in dmu_tx_assign(). While the
transaction is open (i.e. between dmu_tx_assign() and dmu_tx_commit() —
typically less than a millisecond), we call dbuf_dirty() on the exact
blocks that will be modified. Once this happens, the temporary
accounting in tx_space_* is unnecessary, because we know exactly what
blocks are newly dirtied; we call dnode_willuse_space() to track this
more exact accounting.

The fundamental problem causing this bug is that dmu_tx_hold_*() relies
on the current state in the DMU (e.g. dn_nlevels) to predict how much
will be dirtied by this transaction, but this state can change before we
actually perform the transaction (i.e. call dbuf_dirty()).

This bug will be fixed by removing the assertion that the tx_space_*
accounting is perfectly accurate (i.e. we never dirty more than was
predicted by dmu_tx_hold_*()). By removing the requirement that this
accounting be perfectly accurate, we can also vastly simplify it, e.g.
removing most of the logic in dmu_tx_count_*().

The new tx space accounting will be very approximate, and may be more or
less than what is actually dirtied. It will still be used to determine
if this transaction will put us over quota. Transactions that are marked
by dmu_tx_mark_netfree() will be excepted from this check. We won’t make
an attempt to determine how much space will be freed by the transaction
— this was rarely accurate enough to determine if a transaction should
be permitted when we are over quota, which is why dmu_tx_mark_netfree()
was introduced in 2014.

We also won’t attempt to give “credit” when overwriting existing blocks,
if those blocks may be freed. This allows us to remove the
do_free_accounting logic in dbuf_dirty(), and associated routines. This
logic attempted to predict what will be on disk when this txg syncs, to
know if the overwritten block will be freed (i.e. exists, and has no
snapshots).

OpenZFS-issue: https://www.illumos.org/issues/7793
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/3704e0a
Upstream bugs: DLPX-32883a
Closes #5804 

Porting notes:
- DNODE_SIZE replaced with DNODE_MIN_SIZE in dmu_tx_count_dnode(),
  Using the default dnode size would be slightly better.
- DEBUG_DMU_TX wrappers and configure option removed.
- Resolved _by_dnode() conflicts these changes have not yet been
  applied to OpenZFS.
2017-03-07 09:51:59 -08:00
..
.gitignore Add config/compile to config/.gitignore 2014-10-31 16:25:34 -07:00
Rules.am Allow c99 code to compile 2017-02-08 09:27:48 -08:00
always-arch.m4 Illumos Crypto Port module added to enable native encryption in zfs 2016-07-20 10:43:30 -07:00
always-no-bool-compare.m4 Disable gcc bool-compare warning 2015-07-13 12:55:26 -07:00
always-no-unused-but-set-variable.m4 config: compile test rather than run test 2014-03-20 12:11:57 -07:00
config.awk Add build system 2010-08-31 13:41:27 -07:00
deb.am Fix some minor issues with the SYSV init and initramfs scripts. 2015-07-24 15:05:33 -07:00
kernel-acl.m4 Fix ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE check 2016-11-09 13:53:13 -08:00
kernel-aio-fsync.m4 Kernel 4.9 compat: file_operations->aio_fsync removal 2016-11-15 09:20:46 -08:00
kernel-automount.m4 Fix snapshot automounting with GrSecurity constify plugin. 2012-08-24 08:56:38 -07:00
kernel-bdev-block-device-operations.m4 3.10 API change: block_device_operations->release() returns void 2013-07-08 15:41:57 -07:00
kernel-bdev-logical-size.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-bdev-physical-size.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-bdi-setup-and-register.m4 Linux 4.1 compat: configure bdi_setup_and_register() 2015-08-18 16:43:04 -07:00
kernel-bio-bvec-iter.m4 Linux 3.14 compat: Immutable biovec changes in vdev_disk.c 2014-04-10 14:28:38 -07:00
kernel-bio-end-io-t-args.m4 Linux 4.3 compat: bio_end_io_t / BIO_UPTODATE 2015-09-25 12:44:54 -07:00
kernel-bio-failfast.m4 Linux 2.6.36 compat, use REQ_FAILFAST_MASK and remove pre-2.6.36 support 2015-05-11 15:07:00 -07:00
kernel-bio-op.m4 4.10 compat - BIO flag changes and others 2016-12-30 16:03:59 -06:00
kernel-bio-rw-barrier.m4 zvol processing should use struct bio 2015-09-04 15:30:24 -04:00
kernel-bio-rw-discard.m4 zvol processing should use struct bio 2015-09-04 15:30:24 -04:00
kernel-blk-queue-flush.m4 Linux 4.7 compat: replace blk_queue_flush with blk_queue_write_cache 2016-05-20 11:08:55 -07:00
kernel-blk-queue-max-hw-sectors.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-blk-queue-max-segments.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-blk-queue-unplug.m4 Explicit block device plugging when submitting multiple BIOs 2016-09-29 13:13:31 -07:00
kernel-blkdev-get-by-path.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-blkdev-get.m4 Move partition scanning from userspace to module. 2012-07-17 09:17:31 -07:00
kernel-block-device-operations-release-void.m4 3.10 API change: block_device_operations->release() returns void 2013-07-08 15:41:57 -07:00
kernel-clear-inode.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-commit-metadata.m4 Implement .commit_metadata hook for NFS export 2012-10-03 10:49:45 -07:00
kernel-create-nameidata.m4 Linux 4.2 compat: follow_link() / put_link() 2015-07-17 09:18:16 -07:00
kernel-current_bio_tail.m4 zvol processing should use struct bio 2015-09-04 15:30:24 -04:00
kernel-d-make-root.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-d-obtain-alias.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-d-prune-aliases.m4 Add zfs_sb_prune_aliases() function 2015-06-22 10:22:49 -07:00
kernel-declare-event-class.m4 Swap DTRACE_PROBE* with Linux tracepoints 2014-11-17 11:13:55 -08:00
kernel-dentry-operations.m4 Eliminate runtime function pointer mods in autotools checks 2013-03-04 08:49:17 -08:00
kernel-dirty-inode.m4 Eliminate runtime function pointer mods in autotools checks 2013-03-04 08:49:17 -08:00
kernel-discard-granularity.m4 Set zvol discard_granularity to the volblocksize. 2012-08-07 14:55:31 -07:00
kernel-elevator-change.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-encode-fh-inode.m4 Linux 3.5 compat, eops->encode_fh() takes inodes 2012-07-23 12:29:23 -07:00
kernel-evict-inode.m4 Fix build failures on PaX/GRSecurity patched kernels 2012-07-17 09:22:43 -07:00
kernel-fallocate.m4 Eliminate runtime function pointer mods in autotools checks 2013-03-04 08:49:17 -08:00
kernel-file-dentry.m4 Use file_dentry and file_inode wrappers 2016-08-11 12:06:37 -07:00
kernel-file-inode.m4 Linux 3.19 compat: file_inode was added 2015-02-10 11:24:51 -08:00
kernel-fmode-t.m4 Fix gcc configure warnings 2011-04-19 10:10:47 -07:00
kernel-follow-down-one.m4 Linux 3.18 compat: Snapshot auto-mounting 2015-08-31 13:54:39 -07:00
kernel-fpu.m4 Support for vectorized algorithms on x86 2016-03-21 09:24:34 -07:00
kernel-fsync.m4 Eliminate runtime function pointer mods in autotools checks 2013-03-04 08:49:17 -08:00
kernel-generic_io_acct.m4 Reintroduce IO accounting on zvols on Linux 3.19+ 2015-09-09 09:29:24 -07:00
kernel-generic_readlink.m4 4.10 compat - BIO flag changes and others 2016-12-30 16:03:59 -06:00
kernel-get-disk-ro.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-get-gendisk.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-get-link.m4 Linux 4.5 compat: get_link() / put_link() 2016-01-20 11:36:00 -08:00
kernel-inode-set-flags.m4 Use inode_set_flags when available 2016-12-16 13:54:51 -08:00
kernel-insert-inode-locked.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-invalidate-bdev-args.m4 Fix gcc configure warnings 2011-04-19 10:10:47 -07:00
kernel-is_owner_or_cap.m4 Refactor inode_owner_or_capable() autotools check 2014-05-01 10:06:49 -07:00
kernel-kmap-atomic-args.m4 Add compatibility layer for {kmap,kunmap}_atomic 2015-08-24 10:13:25 -07:00
kernel-kuid-helpers.m4 Check whether the kernel supports i_uid/gid_read/write helpers 2016-07-25 13:21:49 -07:00
kernel-lookup-bdev.m4 Fix lookup_bdev() on Ubuntu 2016-10-26 10:30:43 -07:00
kernel-lookup-nameidata.m4 Linux 4.2 compat: follow_link() / put_link() 2015-07-17 09:18:16 -07:00
kernel-lseek-execute.m4 Add SEEK_DATA/SEEK_HOLE to lseek()/llseek() 2013-07-02 09:24:43 -07:00
kernel-mk-request-fn.m4 Linux 4.4 compat: make_request_fn returns blk_qc_t 2015-12-01 16:48:08 -08:00
kernel-mkdir-umode-t.m4 Fix spelling 2017-01-03 11:31:18 -06:00
kernel-mod-param.m4 Linux compat: Grsecurity kernel 2016-08-22 10:05:45 -07:00
kernel-mount-nodev.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-open-bdev-exclusive.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-put-link.m4 Linux 4.5 compat: get_link() / put_link() 2016-01-20 11:36:00 -08:00
kernel-rename.m4 Linux 4.9 compat: iops->rename() wants flags 2016-10-20 09:39:09 -07:00
kernel-security-inode-init.m4 Use -Werror for all kernel configure tests. 2013-02-24 10:20:28 -08:00
kernel-set-nlink.m4 Linux 3.2 compat: set_nlink() 2011-12-16 20:02:52 -08:00
kernel-setattr-prepare.m4 Linux 4.9 compat: inode_change_ok() renamed setattr_prepare() 2016-10-20 09:39:09 -07:00
kernel-sget-args.m4 Linux 3.6 compat, sget() 2012-10-14 13:06:48 -07:00
kernel-show-options.m4 Fix NULL pointer dereference on PaX/GRSecurity patched Linux 3.3 and later kernels 2012-07-20 12:31:45 -07:00
kernel-shrink.m4 3.12 compat, NUMA-aware per-superblock shrinker 2015-06-17 10:43:13 -07:00
kernel-submit_bio.m4 Linux 4.8 compat: submit_bio() 2016-07-29 14:48:00 -07:00
kernel-super-userns.m4 Linux 4.8 compat: new s_user_ns member of struct super_block 2016-08-08 10:47:22 -07:00
kernel-tmpfile.m4 Add support for O_TMPFILE 2016-11-04 10:46:40 -07:00
kernel-truncate-range.m4 Linux 3.5 compat, iops->truncate_range() removed 2012-07-23 12:29:32 -07:00
kernel-truncate-setsize.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-vfs-iterate.m4 Linux 4.7 compat: use iterate_shared for concurrent readdir 2016-05-20 11:09:16 -07:00
kernel-vfs-rw-iterate.m4 Fix loop device becomes read-only 2017-03-06 09:20:20 -08:00
kernel-xattr-handler.m4 Fix spelling 2017-01-03 11:31:18 -06:00
kernel.m4 Allow c99 code to compile 2017-02-08 09:27:48 -08:00
mount-helper.m4 The mount helper mount.zfs MUST be in /sbin (not '$sbindir'). 2015-05-18 16:54:36 -07:00
rpm.am Support parallel build trees (VPATH builds) 2015-07-17 13:42:51 -07:00
suppressed-warnings.txt Suppress packaging warning 2011-11-08 11:32:04 -08:00
tgz.am Refresh RPM packaging 2013-03-18 15:33:17 -07:00
toolchain-simd.m4 Add support for AVX-512 family of instruction sets 2016-08-16 14:10:33 -07:00
user-commands.m4 Add auto-online test for ZED/FMA as part of the ZTS 2017-02-28 16:25:39 -08:00
user-dracut.m4 Accept udev and dracut paths specified by ./configure 2014-06-11 16:32:57 -07:00
user-frame-larger-than.m4 config: compile test rather than run test 2014-03-20 12:11:57 -07:00
user-libattr.m4 Add the ZFS Test Suite 2016-03-16 13:46:16 -07:00
user-libblkid.m4 Require libblkid 2016-03-09 10:39:22 -08:00
user-libtirpc.m4 Add support for libtirpc 2016-04-28 09:27:40 -07:00
user-libudev.m4 Fix WANT_DEVNAME2DEVID configure error 2016-04-01 09:06:54 -07:00
user-libuuid.m4 Cleanup linking 2016-03-18 13:31:11 -07:00
user-runstatedir.m4 Add defs for makefile installation dir vars 2014-03-31 16:11:13 -07:00
user-systemd.m4 Make systemd-modules-load.service file directory configurable 2014-10-28 09:41:14 -07:00
user-sysvinit.m4 Add systemd unit files for ZFS startup 2014-02-05 12:25:30 -08:00
user-udev.m4 Accept udev and dracut paths specified by ./configure 2014-06-11 16:32:57 -07:00
user-zlib.m4 Cleanup linking 2016-03-18 13:31:11 -07:00
user.m4 Add -c to zpool iostat & status to run command 2016-11-29 14:45:38 -07:00
zfs-build.m4 OpenZFS 7793 - ztest fails assertion in dmu_tx_willuse_space 2017-03-07 09:51:59 -08:00
zfs-meta.m4 Fix automatically generated release number 2016-09-21 13:45:21 -07:00