* [PATCH] btrfs: check/qgroup: fix two error messages used in qgroup verification
@ 2022-03-17 6:12 Qu Wenruo
2022-03-18 18:47 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2022-03-17 6:12 UTC (permalink / raw)
To: linux-btrfs; +Cc: Andrei Borzenkov
[BUG]
There is a weird error message when running btrfs check on a specific
immage:
[7/7] checking quota groups
ERROR: out of memory
ERROR: Loading qgroups from disk: -2
ERROR: failed to check quota groups
[CAUSE]
The "Out of memory" one is in load_quota_info(), which is output in two
cases:
- No memory can be allocated for btrfs_qgroup_list
AKA, real -ENOMEM.
- No qgroup can be found for either the child or the parent qgroup
This returnes -ENOENT.
Obvious the image has hit -ENOENT case, but the error message is fixed
to ENOMEM case.
[FIX]
Fix it by using %m to output the real reason of failure.
Reported-by: Andrei Borzenkov <arvidjaar@gmail.com>
Link: https://forums.opensuse.org/showthread.php/567851-btrfs-fails-to-load-qgroups-from-disk-with-error-2-(out-of-memory)
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
check/qgroup-verify.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/check/qgroup-verify.c b/check/qgroup-verify.c
index 0813b8412057..d1478a40fde3 100644
--- a/check/qgroup-verify.c
+++ b/check/qgroup-verify.c
@@ -977,7 +977,11 @@ loop:
ret = add_qgroup_relation(key.objectid,
key.offset);
if (ret) {
- error("out of memory");
+ errno = -ret;
+ error(
+ "failed to add qgroup relation, member=%llu parent=%llu: %m",
+ key.objectid,
+ key.offset);
goto out;
}
}
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: check/qgroup: fix two error messages used in qgroup verification
2022-03-17 6:12 [PATCH] btrfs: check/qgroup: fix two error messages used in qgroup verification Qu Wenruo
@ 2022-03-18 18:47 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2022-03-18 18:47 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs, Andrei Borzenkov
On Thu, Mar 17, 2022 at 02:12:50PM +0800, Qu Wenruo wrote:
> [BUG]
> There is a weird error message when running btrfs check on a specific
> immage:
>
> [7/7] checking quota groups
> ERROR: out of memory
> ERROR: Loading qgroups from disk: -2
> ERROR: failed to check quota groups
>
> [CAUSE]
> The "Out of memory" one is in load_quota_info(), which is output in two
> cases:
>
> - No memory can be allocated for btrfs_qgroup_list
> AKA, real -ENOMEM.
>
> - No qgroup can be found for either the child or the parent qgroup
> This returnes -ENOENT.
>
> Obvious the image has hit -ENOENT case, but the error message is fixed
> to ENOMEM case.
>
> [FIX]
> Fix it by using %m to output the real reason of failure.
>
> Reported-by: Andrei Borzenkov <arvidjaar@gmail.com>
> Link: https://forums.opensuse.org/showthread.php/567851-btrfs-fails-to-load-qgroups-from-disk-with-error-2-(out-of-memory)
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Added to devel, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-18 18:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17 6:12 [PATCH] btrfs: check/qgroup: fix two error messages used in qgroup verification Qu Wenruo
2022-03-18 18:47 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.