* [PATCH] btrfs: show correct warning if can't read data reloc tree
@ 2025-12-19 18:15 Mark Harmstone
2025-12-20 0:00 ` Qu Wenruo
2025-12-20 0:24 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Mark Harmstone @ 2025-12-19 18:15 UTC (permalink / raw)
To: linux-btrfs; +Cc: Mark Harmstone
If a filesystem is missing its data reloc tree, we get something like
this in dmesg:
BTRFS warning (device loop11): failed to read root (objectid=4): -2
BTRFS error (device loop11): open_ctree failed: -2
objectid is BTRFS_DEV_TREE_OBJECTID, but this should actually be the
value of BTRFS_DATA_RELOC_TREE_OBJECTID.
btrfs_read_roots() prints location.objectid on failure, but this isn't
set when reading the data reloc tree. Set location.objectid to the
correct value on failure, so that the error message makes sense.
Signed-off-by: Mark Harmstone <mark@harmstone.com>
---
fs/btrfs/disk-io.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index e5535bdc5b0c..f1e58c1d6c38 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2221,6 +2221,7 @@ static int btrfs_read_roots(struct btrfs_fs_info *fs_info)
BTRFS_DATA_RELOC_TREE_OBJECTID, true);
if (IS_ERR(root)) {
if (!btrfs_test_opt(fs_info, IGNOREBADROOTS)) {
+ location.objectid = BTRFS_DATA_RELOC_TREE_OBJECTID;
ret = PTR_ERR(root);
goto out;
}
--
2.51.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: show correct warning if can't read data reloc tree
2025-12-19 18:15 [PATCH] btrfs: show correct warning if can't read data reloc tree Mark Harmstone
@ 2025-12-20 0:00 ` Qu Wenruo
2025-12-20 0:24 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2025-12-20 0:00 UTC (permalink / raw)
To: Mark Harmstone, linux-btrfs
在 2025/12/20 04:45, Mark Harmstone 写道:
> If a filesystem is missing its data reloc tree, we get something like
> this in dmesg:
>
> BTRFS warning (device loop11): failed to read root (objectid=4): -2
> BTRFS error (device loop11): open_ctree failed: -2
>
> objectid is BTRFS_DEV_TREE_OBJECTID, but this should actually be the
> value of BTRFS_DATA_RELOC_TREE_OBJECTID.
>
> btrfs_read_roots() prints location.objectid on failure, but this isn't
> set when reading the data reloc tree. Set location.objectid to the
> correct value on failure, so that the error message makes sense.
>
> Signed-off-by: Mark Harmstone <mark@harmstone.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/disk-io.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index e5535bdc5b0c..f1e58c1d6c38 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -2221,6 +2221,7 @@ static int btrfs_read_roots(struct btrfs_fs_info *fs_info)
> BTRFS_DATA_RELOC_TREE_OBJECTID, true);
> if (IS_ERR(root)) {
> if (!btrfs_test_opt(fs_info, IGNOREBADROOTS)) {
> + location.objectid = BTRFS_DATA_RELOC_TREE_OBJECTID;
> ret = PTR_ERR(root);
> goto out;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: show correct warning if can't read data reloc tree
2025-12-19 18:15 [PATCH] btrfs: show correct warning if can't read data reloc tree Mark Harmstone
2025-12-20 0:00 ` Qu Wenruo
@ 2025-12-20 0:24 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2025-12-20 0:24 UTC (permalink / raw)
To: Mark Harmstone; +Cc: linux-btrfs
On Fri, Dec 19, 2025 at 06:15:28PM +0000, Mark Harmstone wrote:
> If a filesystem is missing its data reloc tree, we get something like
> this in dmesg:
>
> BTRFS warning (device loop11): failed to read root (objectid=4): -2
> BTRFS error (device loop11): open_ctree failed: -2
>
> objectid is BTRFS_DEV_TREE_OBJECTID, but this should actually be the
> value of BTRFS_DATA_RELOC_TREE_OBJECTID.
>
> btrfs_read_roots() prints location.objectid on failure, but this isn't
> set when reading the data reloc tree. Set location.objectid to the
> correct value on failure, so that the error message makes sense.
>
> Signed-off-by: Mark Harmstone <mark@harmstone.com>
Added to for-next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-20 0:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-19 18:15 [PATCH] btrfs: show correct warning if can't read data reloc tree Mark Harmstone
2025-12-20 0:00 ` Qu Wenruo
2025-12-20 0:24 ` 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.