From b98a0fce2835a41acb75358c580e29747d5e778c Mon Sep 17 00:00:00 2001 From: loli10K Date: Sun, 26 Jan 2020 16:49:18 +0100 Subject: [PATCH] zfs destroy may be unable to free space in full pools Typically destroy operations result in a net free of space and should always be allowed to prevent situations where not even the storage administrator can restore a full ZFS pool to a functioning state. Signed-off-by: loli10K --- module/zfs/dsl_synctask.c | 2 +- module/zfs/zcp_synctask.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/zfs/dsl_synctask.c b/module/zfs/dsl_synctask.c index 2d6ca8549e..d05fcf55cc 100644 --- a/module/zfs/dsl_synctask.c +++ b/module/zfs/dsl_synctask.c @@ -235,7 +235,7 @@ dsl_sync_task_sync(dsl_sync_task_t *dst, dmu_tx_t *tx) uint64_t used = dsl_dir_phys(dp->dp_root_dir)->dd_used_bytes; /* MOS space is triple-dittoed, so we multiply by 3. */ - if (used + dst->dst_space * 3 > quota) { + if (dst->dst_space > 0 && used + dst->dst_space * 3 > quota) { dst->dst_error = SET_ERROR(ENOSPC); if (dst->dst_nowaiter) kmem_free(dst, sizeof (*dst)); diff --git a/module/zfs/zcp_synctask.c b/module/zfs/zcp_synctask.c index 3b6015f24e..57167d9736 100644 --- a/module/zfs/zcp_synctask.c +++ b/module/zfs/zcp_synctask.c @@ -394,7 +394,7 @@ zcp_synctask_wrapper(lua_State *state) uint64_t used = dsl_dir_phys(dp->dp_root_dir)->dd_used_bytes + ri->zri_space_used; - if (used + funcspace > quota) { + if (funcspace > 0 && used + funcspace > quota) { err = SET_ERROR(ENOSPC); } }