]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Ensure proper sector alignment for btrfs_free_reserved_data_space
authorJeff Mahoney <jeffm@suse.com>
Sat, 19 Nov 2016 02:52:40 +0000 (21:52 -0500)
committerDavid Sterba <dsterba@suse.com>
Wed, 30 Nov 2016 12:45:19 +0000 (13:45 +0100)
commit22d32eb1dac70ad5d60c792ae399650f2d74e0c4
tree542a26d81c7e1b7741825cffff3b1acaa32bc69e
parentf349dc9d9594612ac35a3e1177ee1115b69fc479
btrfs: Ensure proper sector alignment for btrfs_free_reserved_data_space

This fixes the WARN_ON on BTRFS_I(inode)->reserved_extents in
btrfs_destroy_inode and the WARN_ON on nonzero delalloc bytes on umount
with qgroups enabled.

I was able to reproduce this by setting up a small (~500kb) quota limit
and writing a file one byte at a time until I hit the limit.  The warnings
would all hit on umount.

The root cause is that we would reserve a block-sized range in both
the reservation and the quota in btrfs_check_data_free_space, but if we
encountered a problem (like e.g. EDQUOT), we would only release the single
byte in the qgroup reservation.  That caused an iotree state split, which
increased the number of outstanding extents, in turn disallowing releasing
the metadata reservation.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c