aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/module/zfs/dsl_dir.c
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2022-03-08 17:52:10 +0000
committerMartin Matuska <mm@FreeBSD.org>2022-03-08 17:53:02 +0000
commitc03c5b1c80914ec656fbee84539355d1fad68bf9 (patch)
tree804d8ffb7943c01f04a7dfa4e98965881bcbfc3c /sys/contrib/openzfs/module/zfs/dsl_dir.c
parent5678114cd8b310bd6f0a5699f036fc5b18addd65 (diff)
parenta86e089415679cf1b98eb424a159bb36aa2c19e3 (diff)
downloadsrc-c03c5b1c80914ec656fbee84539355d1fad68bf9.tar.gz
src-c03c5b1c80914ec656fbee84539355d1fad68bf9.zip
zfs: merge openzfs/zfs@a86e08941 (master) into main
Notable upstream pull request merges: #9078: log xattr=sa create/remove/update to ZIL #11919: Cross-platform xattr user namespace compatibility #13014: Report dnodes with faulty bonuslen #13016: FreeBSD: Fix zvol_cdev_open locking #13019: spl: Don't check FreeBSD rwlocks for double initialization #13027: Fix clearing set-uid and set-gid bits on a file when replying a write #13031: Add enumerated vdev names to 'zpool iostat -v' and 'zpool list -v' #13074: Enable encrypted raw sending to pools with greater ashift #13076: Receive checks should allow unencrypted child datasets #13098: Avoid dirtying the final TXGs when exporting a pool #13172: Fix ENOSPC when unlinking multiple files from full pool Obtained from: OpenZFS OpenZFS commit: a86e089415679cf1b98eb424a159bb36aa2c19e3
Diffstat (limited to 'sys/contrib/openzfs/module/zfs/dsl_dir.c')
-rw-r--r--sys/contrib/openzfs/module/zfs/dsl_dir.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/contrib/openzfs/module/zfs/dsl_dir.c b/sys/contrib/openzfs/module/zfs/dsl_dir.c
index bd5e0c2f627c..aca32ff9bbb9 100644
--- a/sys/contrib/openzfs/module/zfs/dsl_dir.c
+++ b/sys/contrib/openzfs/module/zfs/dsl_dir.c
@@ -121,8 +121,6 @@
* dsl_dir_init_fs_ss_count().
*/
-extern inline dsl_dir_phys_t *dsl_dir_phys(dsl_dir_t *dd);
-
static uint64_t dsl_dir_space_towrite(dsl_dir_t *dd);
typedef struct ddulrt_arg {
@@ -1322,7 +1320,6 @@ top_of_function:
* we're very close to full, this will allow a steady trickle of
* removes to get through.
*/
- uint64_t deferred = 0;
if (dd->dd_parent == NULL) {
uint64_t avail = dsl_pool_unreserved_space(dd->dd_pool,
(netfree) ?
@@ -1337,13 +1334,21 @@ top_of_function:
/*
* If they are requesting more space, and our current estimate
* is over quota, they get to try again unless the actual
- * on-disk is over quota and there are no pending changes (which
- * may free up space for us).
+ * on-disk is over quota and there are no pending changes
+ * or deferred frees (which may free up space for us).
*/
if (used_on_disk + est_inflight >= quota) {
- if (est_inflight > 0 || used_on_disk < quota ||
- (retval == ENOSPC && used_on_disk < quota + deferred))
- retval = ERESTART;
+ if (est_inflight > 0 || used_on_disk < quota) {
+ retval = SET_ERROR(ERESTART);
+ } else {
+ ASSERT3U(used_on_disk, >=, quota);
+
+ if (retval == ENOSPC && (used_on_disk - quota) <
+ dsl_pool_deferred_space(dd->dd_pool)) {
+ retval = SET_ERROR(ERESTART);
+ }
+ }
+
dprintf_dd(dd, "failing: used=%lluK inflight = %lluK "
"quota=%lluK tr=%lluK err=%d\n",
(u_longlong_t)used_on_disk>>10,
@@ -1351,7 +1356,7 @@ top_of_function:
(u_longlong_t)quota>>10, (u_longlong_t)asize>>10, retval);
mutex_exit(&dd->dd_lock);
DMU_TX_STAT_BUMP(dmu_tx_quota);
- return (SET_ERROR(retval));
+ return (retval);
}
/* We need to up our estimated delta before dropping dd_lock */