Skip to content

Commit c9c8637

Browse files
adam900710kdave
authored andcommitted
btrfs: do not output error message if a qgroup has been already cleaned up
[BUG] There is a bug report that btrfs outputs the following error message: BTRFS info (device nvme0n1p2): qgroup scan completed (inconsistency flag cleared) BTRFS warning (device nvme0n1p2): failed to cleanup qgroup 0/1179: -2 [CAUSE] The error itself is pretty harmless, and the end user should ignore it. When a subvolume is fully dropped, btrfs will call btrfs_qgroup_cleanup_dropped_subvolume() to delete the qgroup. However if a qgroup rescan happened before a subvolume fully dropped, qgroup for that subvolume will not be re-created, as rescan will only create new qgroup if there is a BTRFS_ROOT_REF_KEY found. But before we drop a subvolume, the subvolume is unlinked thus there is no BTRFS_ROOT_REF_KEY. In that case, btrfs_remove_qgroup() will fail with -ENOENT and trigger the above error message. [FIX] Just ignore -ENOENT error from btrfs_remove_qgroup() inside btrfs_qgroup_cleanup_dropped_subvolume(). Reported-by: John Shand <jshand2013@gmail.com> Link: https://bugzilla.suse.com/show_bug.cgi?id=1236056 Fixes: 839d6ea ("btrfs: automatically remove the subvolume qgroup") Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 0d85f5c commit c9c8637

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/btrfs/qgroup.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1897,8 +1897,11 @@ int btrfs_qgroup_cleanup_dropped_subvolume(struct btrfs_fs_info *fs_info, u64 su
18971897
/*
18981898
* It's squota and the subvolume still has numbers needed for future
18991899
* accounting, in this case we can not delete it. Just skip it.
1900+
*
1901+
* Or the qgroup is already removed by a qgroup rescan. For both cases we're
1902+
* safe to ignore them.
19001903
*/
1901-
if (ret == -EBUSY)
1904+
if (ret == -EBUSY || ret == -ENOENT)
19021905
ret = 0;
19031906
return ret;
19041907
}

0 commit comments

Comments
 (0)