Bug #4950

files sometimes can't be removed from a full filesystem

Added by Matthew Ahrens over 6 years ago. Updated over 6 years ago.

zfs - Zettabyte File System
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:


In some full filesystems, "rm" of even small files works just fine. But in
other full filesystems, "rm" even of large files can fail with ENOSPC.

The problem occurs when the unlinked ZAP object (which contains the list of
files which have a link count of zero but which haven't been removed from disk
yet, e.g. because the file is still open) is a fat ZAP (because at some point
it had more than ~2000 entries). In this case, our space estimation
(dmu_tx_hold_zap()) doesn't determine exactly which blocks of the fat zap will
be modified, so it has to assume that those blocks might be part of a snapshot,
and therefore won't be freed.

The space estimation code is fairly fragile, so a robust solution is to
explicitly mark file removal transactions as "presumed to result in a net free
of space". This would let them ignore refquotas, and use half of the pool
space overhead (dsl_pool_adjustedsize()).

The problem can be seen when the estimated space to "alloc" is more than the
estimated space to "free", as shown by the following dtrace command:

dtrace -n 'dsl_dir_tempreserve_space:entry{printf("alloc=%uK free=%uK",
args2>>10, args3>>10)}' -c 'rm f'

Related issues

Related to illumos gate - Bug #6334: Cannot unlink files when over quotaClosed2015-10-14


Updated by Electric Monk over 6 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 4bb73804952172060c9efb163b89c17f56804fe8

commit  4bb73804952172060c9efb163b89c17f56804fe8
Author: Matthew Ahrens <>
Date:   2014-07-07T19:49:36.000Z

    4950 files sometimes can't be removed from a full filesystem
    Reviewed by: Adam Leventhal <>
    Reviewed by: George Wilson <>
    Reviewed by: Sebastien Roy <>
    Reviewed by: Boris Protopopov <>
    Approved by: Dan McDonald <>


Updated by Simon K over 5 years ago

  • Related to Bug #6334: Cannot unlink files when over quota added

Also available in: Atom PDF