• Omar Sandoval's avatar
    Btrfs: fix ENOSPC caused by orphan items reservations · 27919067
    Omar Sandoval authored
    Currently, we keep space reserved for all inode orphan items until the
    inode is evicted (i.e., all references to it are dropped). We hit an
    issue where an application would keep a bunch of deleted files open (by
    design) and thus keep a large amount of space reserved, causing ENOSPC
    errors when other operations tried to reserve space. This long-standing
    reservation isn't absolutely necessary for a couple of reasons:
    
    - We can almost always make the reservation we need or steal from the
      global reserve for the orphan item
    - If we can't, it's not the end of the world if we drop the orphan item
      on the floor and let the next mount clean it up
    
    So, get rid of persistent reservation and just reserve space in
    btrfs_evict_inode().
    Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
    Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    27919067
inode.c 285 KB