]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: allow unlink to exceed subvolume quota
authorJeff Mahoney <jeffm@suse.com>
Wed, 25 Jan 2017 14:50:33 +0000 (09:50 -0500)
committerDavid Sterba <dsterba@suse.com>
Tue, 14 Feb 2017 14:50:59 +0000 (15:50 +0100)
commit551cdd4d8143de06d6ad89330e0441a2a8e1dd89
tree5e3f48d58117b4c784c403a4751b3c76cb836180
parentcbf353fa807396b8075b7de9b9c06076da972edf
btrfs: allow unlink to exceed subvolume quota

Once a qgroup limit is exceeded, it's impossible to restore normal
operation to the subvolume without modifying the limit or removing
the subvolume.  This is a surprising situation for many users used
to the typical workflow with quotas on other file systems where it's
possible to remove files until the used space is back under the limit.

When we go to unlink a file and start the transaction, we'll hit
the qgroup limit while trying to reserve space for the items we'll
modify while removing the file.  We discussed last month how best
to handle this situation and agreed that there is no perfect solution.
The best principle-of-least-surprise solution is to handle it similarly
to how we already handle ENOSPC when unlinking, which is to allow
the operation to succeed with the expectation that it will ultimately
release space under most circumstances.

This patch modifies the transaction start path to select whether to
honor the qgroups limits.  btrfs_start_transaction_fallback_global_rsv
is the only caller that skips enforcement.  The reservation and tracking
still happens normally -- it just skips the enforcement step.

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
fs/btrfs/qgroup.c
fs/btrfs/qgroup.h
fs/btrfs/transaction.c