-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When unlinking multiple files from a pool at 100% capacity, it was possible for ENOSPC to be returned after the first few unlinks. This issue was fixed previously by PR #13172 but then this was again introduced by PR #13839. This is resolved using the existing mechanism of returning ERESTART when over quota as long as we know enough space will shortly be available after processing the pending deferred frees. Also, updated the existing testcase which reliably reproduced the issue without this patch. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Dipak Ghosh <[email protected]> Signed-off-by: Akash B <[email protected]> Closes #15312
- Loading branch information
Showing
2 changed files
with
19 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
* Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. | ||
* Copyright (c) 2016 Actifio, Inc. All rights reserved. | ||
* Copyright (c) 2018, loli10K <[email protected]>. All rights reserved. | ||
* Copyright (c) 2023 Hewlett Packard Enterprise Development LP. | ||
*/ | ||
|
||
#include <sys/dmu.h> | ||
|
@@ -1358,30 +1359,23 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree, | |
ext_quota = 0; | ||
|
||
if (used_on_disk >= quota) { | ||
if (retval == ENOSPC && (used_on_disk - quota) < | ||
dsl_pool_deferred_space(dd->dd_pool)) { | ||
retval = SET_ERROR(ERESTART); | ||
} | ||
/* Quota exceeded */ | ||
mutex_exit(&dd->dd_lock); | ||
DMU_TX_STAT_BUMP(dmu_tx_quota); | ||
return (retval); | ||
} else if (used_on_disk + est_inflight >= quota + ext_quota) { | ||
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", | ||
"quota=%lluK tr=%lluK\n", | ||
(u_longlong_t)used_on_disk>>10, | ||
(u_longlong_t)est_inflight>>10, | ||
(u_longlong_t)quota>>10, (u_longlong_t)asize>>10, retval); | ||
(u_longlong_t)quota>>10, (u_longlong_t)asize>>10); | ||
mutex_exit(&dd->dd_lock); | ||
DMU_TX_STAT_BUMP(dmu_tx_quota); | ||
return (retval); | ||
return (SET_ERROR(ERESTART)); | ||
} | ||
|
||
/* We need to up our estimated delta before dropping dd_lock */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters