* [PATCH] btrfs-progs: check: initialize qgroup_item_count in earlier stage
@ 2019-07-23 9:19 Naohiro Aota
2019-07-23 9:27 ` Qu Wenruo
2019-07-24 11:01 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Naohiro Aota @ 2019-07-23 9:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Naohiro Aota
"btrfsck -Q" segfaults because it does not call qgroup_set_item_count_ptr()
properly:
# btrfsck -Q /dev/sdk
Opening filesystem to check...
Checking filesystem on /dev/sdk
UUID: 34a35bbc-43f8-40f0-8043-65ed33f2e6c3
Print quota groups for /dev/sdk
UUID: 34a35bbc-43f8-40f0-8043-65ed33f2e6c3
Segmentation fault (core dumped)
Since "struct task_ctx ctx" is global, we can just move
qgroup_set_item_count_ptr() much earlier stage in the check process to
avoid to forget initializing it.
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
check/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/check/main.c b/check/main.c
index bb57933b83fc..7248a8209532 100644
--- a/check/main.c
+++ b/check/main.c
@@ -9965,6 +9965,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
radix_tree_init();
cache_tree_init(&root_cache);
+ qgroup_set_item_count_ptr(&ctx.item_count);
ret = check_mounted(argv[optind]);
if (!force) {
@@ -10291,7 +10292,6 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
}
if (info->quota_enabled) {
- qgroup_set_item_count_ptr(&ctx.item_count);
if (!ctx.progress_enabled) {
fprintf(stderr, "[7/7] checking quota groups\n");
} else {
--
2.22.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: check: initialize qgroup_item_count in earlier stage
2019-07-23 9:19 [PATCH] btrfs-progs: check: initialize qgroup_item_count in earlier stage Naohiro Aota
@ 2019-07-23 9:27 ` Qu Wenruo
2019-07-24 11:01 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2019-07-23 9:27 UTC (permalink / raw)
To: Naohiro Aota, linux-btrfs
[-- Attachment #1.1: Type: text/plain, Size: 1506 bytes --]
On 2019/7/23 下午5:19, Naohiro Aota wrote:
> "btrfsck -Q" segfaults because it does not call qgroup_set_item_count_ptr()
> properly:
>
> # btrfsck -Q /dev/sdk
> Opening filesystem to check...
> Checking filesystem on /dev/sdk
> UUID: 34a35bbc-43f8-40f0-8043-65ed33f2e6c3
> Print quota groups for /dev/sdk
> UUID: 34a35bbc-43f8-40f0-8043-65ed33f2e6c3
> Segmentation fault (core dumped)
>
> Since "struct task_ctx ctx" is global, we can just move
> qgroup_set_item_count_ptr() much earlier stage in the check process to
> avoid to forget initializing it.
>
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> check/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/check/main.c b/check/main.c
> index bb57933b83fc..7248a8209532 100644
> --- a/check/main.c
> +++ b/check/main.c
> @@ -9965,6 +9965,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
>
> radix_tree_init();
> cache_tree_init(&root_cache);
> + qgroup_set_item_count_ptr(&ctx.item_count);
>
> ret = check_mounted(argv[optind]);
> if (!force) {
> @@ -10291,7 +10292,6 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
> }
>
> if (info->quota_enabled) {
> - qgroup_set_item_count_ptr(&ctx.item_count);
> if (!ctx.progress_enabled) {
> fprintf(stderr, "[7/7] checking quota groups\n");
> } else {
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: check: initialize qgroup_item_count in earlier stage
2019-07-23 9:19 [PATCH] btrfs-progs: check: initialize qgroup_item_count in earlier stage Naohiro Aota
2019-07-23 9:27 ` Qu Wenruo
@ 2019-07-24 11:01 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2019-07-24 11:01 UTC (permalink / raw)
To: Naohiro Aota; +Cc: linux-btrfs
On Tue, Jul 23, 2019 at 06:19:11PM +0900, Naohiro Aota wrote:
> "btrfsck -Q" segfaults because it does not call qgroup_set_item_count_ptr()
> properly:
>
> # btrfsck -Q /dev/sdk
> Opening filesystem to check...
> Checking filesystem on /dev/sdk
> UUID: 34a35bbc-43f8-40f0-8043-65ed33f2e6c3
> Print quota groups for /dev/sdk
> UUID: 34a35bbc-43f8-40f0-8043-65ed33f2e6c3
> Segmentation fault (core dumped)
>
> Since "struct task_ctx ctx" is global, we can just move
> qgroup_set_item_count_ptr() much earlier stage in the check process to
> avoid to forget initializing it.
>
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-24 11:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 9:19 [PATCH] btrfs-progs: check: initialize qgroup_item_count in earlier stage Naohiro Aota
2019-07-23 9:27 ` Qu Wenruo
2019-07-24 11:01 ` 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.