• Josef Bacik's avatar
    Btrfs: deal with enospc from dirtying inodes properly · 22c44fe6
    Josef Bacik authored
    Now that we're properly keeping track of delayed inode space we've been getting
    a lot of warnings out of btrfs_dirty_inode() when running xfstest 83.  This is
    because a bunch of people call mark_inode_dirty, which is void so we can't
    return ENOSPC.  This needs to be fixed in a few areas
    
    1) file_update_time - this updates the mtime and such when writing to a file,
    which will call mark_inode_dirty.  So copy file_update_time into btrfs so we can
    call btrfs_dirty_inode directly and return an error if we get one appropriately.
    
    2) fix symlinks to use btrfs_setattr for ->setattr.  For some reason we weren't
    setting ->setattr for symlinks, even though we should have been.  This catches
    one of the cases where we were getting errors in mark_inode_dirty.
    
    3) Fix btrfs_setattr and btrfs_setsize to call btrfs_dirty_inode directly
    instead of mark_inode_dirty.  This lets us return errors properly for truncate
    and chown/anything related to setattr.
    
    4) Add a new btrfs_fs_dirty_inode which will just call btrfs_dirty_inode and
    print an error if we have one.  The only remaining user we can't control for
    this is touch_atime(), but we don't really want to keep people from walking
    down the tree if we don't have space to save the atime update, so just complain
    but don't worry about it.
    
    With this patch xfstests 83 complains a handful of times instead of hundreds of
    times.  Thanks,
    Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
    22c44fe6
ctree.h 90.6 KB