btrfs: Add WARN_ON for qgroup reserved underflow
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Thu, 20 Oct 2016 02:28:41 +0000 (10:28 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 14 Feb 2017 14:50:49 +0000 (15:50 +0100)
commit18dc22c19bef520cca11ce4c0807ac9dec48d31f
tree8a8209911a18127a872f61e51bb75c79c024ec58
parent7089db84e356562f8ba737c29e472cc42d530dbc
btrfs: Add WARN_ON for qgroup reserved underflow

Goldwyn Rodrigues has exposed and fixed a bug which underflows btrfs
qgroup reserved space, and leads to non-writable fs.

This reminds us that we don't have enough underflow check for qgroup
reserved space.

For underflow case, we should not really underflow the numbers but warn
and keeps qgroup still work.

So add more check on qgroup reserved space and add WARN_ON() and
btrfs_warn() for any underflow case.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/qgroup.c