public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs: cleanup messages and error handling during mount
@ 2026-02-09 17:11 fdmanana
  2026-02-09 17:11 ` [PATCH 1/3] btrfs: change warning messages to error level in open_ctree() fdmanana
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fdmanana @ 2026-02-09 17:11 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

Short and trivial patches, details in the change logs.

Filipe Manana (3):
  btrfs: change warning messages to error level in open_ctree()
  btrfs: remove redundant warning message in btrfs_check_uuid_tree()
  btrfs: remove btrfs_handle_fs_error() after failure to recover log trees

 fs/btrfs/disk-io.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

-- 
2.47.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] btrfs: change warning messages to error level in open_ctree()
  2026-02-09 17:11 [PATCH 0/3] btrfs: cleanup messages and error handling during mount fdmanana
@ 2026-02-09 17:11 ` fdmanana
  2026-02-09 17:11 ` [PATCH 2/3] btrfs: remove redundant warning message in btrfs_check_uuid_tree() fdmanana
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: fdmanana @ 2026-02-09 17:11 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

Failure to read the fs root results in a mount error, but we log a warning
message. Same goes for checking the uuid tree, an error results in a mount
failure but we log a warning message. Change the level of the logged
messages from warning to error.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/disk-io.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 597d78d2dfe1..040c9577e737 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3632,7 +3632,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
 	fs_info->fs_root = btrfs_get_fs_root(fs_info, BTRFS_FS_TREE_OBJECTID, true);
 	if (IS_ERR(fs_info->fs_root)) {
 		ret = PTR_ERR(fs_info->fs_root);
-		btrfs_warn(fs_info, "failed to read fs tree: %d", ret);
+		btrfs_err(fs_info, "failed to read fs tree: %d", ret);
 		fs_info->fs_root = NULL;
 		goto fail_qgroup;
 	}
@@ -3653,8 +3653,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
 		btrfs_info(fs_info, "checking UUID tree");
 		ret = btrfs_check_uuid_tree(fs_info);
 		if (ret) {
-			btrfs_warn(fs_info,
-				"failed to check the UUID tree: %d", ret);
+			btrfs_err(fs_info, "failed to check the UUID tree: %d", ret);
 			close_ctree(fs_info);
 			return ret;
 		}
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] btrfs: remove redundant warning message in btrfs_check_uuid_tree()
  2026-02-09 17:11 [PATCH 0/3] btrfs: cleanup messages and error handling during mount fdmanana
  2026-02-09 17:11 ` [PATCH 1/3] btrfs: change warning messages to error level in open_ctree() fdmanana
@ 2026-02-09 17:11 ` fdmanana
  2026-02-09 17:11 ` [PATCH 3/3] btrfs: remove btrfs_handle_fs_error() after failure to recover log trees fdmanana
  2026-02-09 23:21 ` [PATCH 0/3] btrfs: cleanup messages and error handling during mount Qu Wenruo
  3 siblings, 0 replies; 5+ messages in thread
From: fdmanana @ 2026-02-09 17:11 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

If we fail to start the uuid rescan kthread, btrfs_check_uuid_tree() logs
an error message and returns the error to the single caller, open_ctree().

This however is redundant since the caller already logs an error message,
which is also more informative since it logs the error code. Some remove
the warning message from btrfs_check_uuid_tree() as it doesn't add any
value.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/disk-io.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 040c9577e737..cb0bca3f6a05 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2962,7 +2962,6 @@ static int btrfs_check_uuid_tree(struct btrfs_fs_info *fs_info)
 	task = kthread_run(btrfs_uuid_rescan_kthread, fs_info, "btrfs-uuid");
 	if (IS_ERR(task)) {
 		/* fs_info->update_uuid_tree_gen remains 0 in all error case */
-		btrfs_warn(fs_info, "failed to start uuid_rescan task");
 		up(&fs_info->uuid_tree_rescan_sem);
 		return PTR_ERR(task);
 	}
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] btrfs: remove btrfs_handle_fs_error() after failure to recover log trees
  2026-02-09 17:11 [PATCH 0/3] btrfs: cleanup messages and error handling during mount fdmanana
  2026-02-09 17:11 ` [PATCH 1/3] btrfs: change warning messages to error level in open_ctree() fdmanana
  2026-02-09 17:11 ` [PATCH 2/3] btrfs: remove redundant warning message in btrfs_check_uuid_tree() fdmanana
@ 2026-02-09 17:11 ` fdmanana
  2026-02-09 23:21 ` [PATCH 0/3] btrfs: cleanup messages and error handling during mount Qu Wenruo
  3 siblings, 0 replies; 5+ messages in thread
From: fdmanana @ 2026-02-09 17:11 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

There is no need to call btrfs_handle_fs_error() (which we are trying to
deprecate) if we fail to recover log trees:

1) Such a failure results in failing the mount immediately;

2) If the recovery started a transaction before failing, it has already
   aborted the transaction down in the call chain.

So remove the btrfs_handle_fs_error() call, replace it with an error
message and assert that the FS is in error state (so that no partial
updates are committed due to a transaction that was not aborted).

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/disk-io.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index cb0bca3f6a05..99ce7c1ca53a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2028,9 +2028,9 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
 	/* returns with log_tree_root freed on success */
 	ret = btrfs_recover_log_trees(log_tree_root);
 	btrfs_put_root(log_tree_root);
-	if (ret) {
-		btrfs_handle_fs_error(fs_info, ret,
-				      "Failed to recover log tree");
+	if (unlikely(ret)) {
+		ASSERT(BTRFS_FS_ERROR(fs_info) != 0);
+		btrfs_err(fs_info, "failed to recover log trees with error: %d", ret);
 		return ret;
 	}
 
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] btrfs: cleanup messages and error handling during mount
  2026-02-09 17:11 [PATCH 0/3] btrfs: cleanup messages and error handling during mount fdmanana
                   ` (2 preceding siblings ...)
  2026-02-09 17:11 ` [PATCH 3/3] btrfs: remove btrfs_handle_fs_error() after failure to recover log trees fdmanana
@ 2026-02-09 23:21 ` Qu Wenruo
  3 siblings, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2026-02-09 23:21 UTC (permalink / raw)
  To: fdmanana, linux-btrfs



在 2026/2/10 03:41, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Short and trivial patches, details in the change logs.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> 
> Filipe Manana (3):
>    btrfs: change warning messages to error level in open_ctree()
>    btrfs: remove redundant warning message in btrfs_check_uuid_tree()
>    btrfs: remove btrfs_handle_fs_error() after failure to recover log trees
> 
>   fs/btrfs/disk-io.c | 12 +++++-------
>   1 file changed, 5 insertions(+), 7 deletions(-)
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-09 23:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-09 17:11 [PATCH 0/3] btrfs: cleanup messages and error handling during mount fdmanana
2026-02-09 17:11 ` [PATCH 1/3] btrfs: change warning messages to error level in open_ctree() fdmanana
2026-02-09 17:11 ` [PATCH 2/3] btrfs: remove redundant warning message in btrfs_check_uuid_tree() fdmanana
2026-02-09 17:11 ` [PATCH 3/3] btrfs: remove btrfs_handle_fs_error() after failure to recover log trees fdmanana
2026-02-09 23:21 ` [PATCH 0/3] btrfs: cleanup messages and error handling during mount Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox