Skip to content

Commit

Permalink
Illumos 4951 - ZFS administrative commands (fix)
Browse files Browse the repository at this point in the history
4951 ZFS administrative commands should use reserved space, not fail with ENOSPC
Approved by: Christopher Siden <[email protected]>

References:
  https://www.illumos.org/issues/4951
  illumos/illumos-gate@c39f2c8

Ported by: Brian Behlendorf <[email protected]>
  • Loading branch information
Christopher Siden authored and behlendorf committed May 4, 2015
1 parent 3d45fdd commit 0c60cc3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions include/sys/spa.h
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ extern spa_load_state_t spa_load_state(spa_t *spa);
extern uint64_t spa_freeze_txg(spa_t *spa);
extern uint64_t spa_get_asize(spa_t *spa, uint64_t lsize);
extern uint64_t spa_get_dspace(spa_t *spa);
extern uint64_t spa_get_slop_space(spa_t *spa);
extern void spa_update_dspace(spa_t *spa);
extern uint64_t spa_version(spa_t *spa);
extern boolean_t spa_deflate(spa_t *spa);
Expand Down
7 changes: 1 addition & 6 deletions module/zfs/dsl_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,17 +612,12 @@ dsl_pool_adjustedsize(dsl_pool_t *dp, boolean_t netfree)
uint64_t space, resv;

/*
* Reserve about 1.6% (1/64), or at least 32MB, for allocation
* efficiency.
* XXX The intent log is not accounted for, so it must fit
* within this slop.
*
* If we're trying to assess whether it's OK to do a free,
* cut the reservation in half to allow forward progress
* (e.g. make it possible to rm(1) files from a full pool).
*/
space = spa_get_dspace(dp->dp_spa);
resv = MAX(space >> 6, SPA_MINDEVSIZE >> 1);
resv = spa_get_slop_space(dp->dp_spa);
if (netfree)
resv >>= 1;

Expand Down

2 comments on commit 0c60cc3

@fling-
Copy link
Contributor

@fling- fling- commented on 0c60cc3 Sep 2, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of increasing the reserved space size?

@behlendorf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fling- there have been cases in the past where due to unaccounted for space changes pools have been run completely out of space. Since ZFS is a copy-on-write filesystem when this happens you're unable to do even basic things like remove files. Increasing the reserved space protects against this.

Please sign in to comment.