Skip to content

Commit 7229d54

Browse files
fdmananakdave
authored andcommitted
btrfs: qgroup: set quota enabled bit if quota disable fails flushing reservations
Before waiting for the rescan worker to finish and flushing reservations, we clear the BTRFS_FS_QUOTA_ENABLED flag from fs_info. If we fail flushing reservations we leave with the flag not set which is not correct since quotas are still enabled - we must set back the flag on error paths, such as when we fail to start a transaction, except for error paths that abort a transaction. The reservation flushing happens very early before we do any operation that actually disables quotas and before we start a transaction, so set back BTRFS_FS_QUOTA_ENABLED if it fails. Fixes: af0e2aa ("btrfs: qgroup: flush reservations during quota disable") Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent b9b7ddd commit 7229d54

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/btrfs/qgroup.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,11 +1334,14 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
13341334

13351335
/*
13361336
* We have nothing held here and no trans handle, just return the error
1337-
* if there is one.
1337+
* if there is one and set back the quota enabled bit since we didn't
1338+
* actually disable quotas.
13381339
*/
13391340
ret = flush_reservations(fs_info);
1340-
if (ret)
1341+
if (ret) {
1342+
set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
13411343
return ret;
1344+
}
13421345

13431346
/*
13441347
* 1 For the root item

0 commit comments

Comments
 (0)