Re: [PATCH] btrfs: qgroup: Avoid calling qgroup functions if qgroup is not enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 09, 2018 at 02:36:45PM +0800, Qu Wenruo wrote:
> Some qgroup trace events like btrfs_qgroup_release_data() and
> btrfs_qgroup_free_delayed_ref() can still be triggered even qgroup is
> not enabled.
> 
> This is caused by the lack of qgroup status check before really calling
> qgroup functions.
> Thankfully related functions can handle quota disabled case well and just
> do nothing for qgroup disabled case.
> 
> This patch will do earlier check before triggering related trace events.
> 
> And for enabled <-> disabled race case:
> 1) For enabled->disabled case
>    Disable will wipe out all qgroups data including reservation and
>    excl/rfer. Even we leaks some reserveration or numbers, it will
>    still be wiped, so nothing can go wrong.
> 
> 2) For disabled -> enabled case
>    Current btrfs_qgroup_release_data() will use extent_io tree to ensure
>    we won't underflow reservation. And for delayed_ref we use
>    head->qgroup_reserved to record reserved space, so in that case
>    head->qgroup_reserved should be 0 and we won't underflow.
> 
> Reported-by: Chris Murphy <lists@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>

Reviewed-by: David Sterba <dsterba@xxxxxxxx>

I've added the link to the report.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux