From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: "fdmanana@kernel.org" <fdmanana@kernel.org>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 01/12] btrfs: fix missing error handling when searching for inode refs during log replay
Date: Wed, 25 Jun 2025 09:45:06 +0000 [thread overview]
Message-ID: <4c76858f-ee2d-4462-9668-d788950ca795@wdc.com> (raw)
In-Reply-To: <78786d6de8f9d4564abaee440ed6260d5c9afd8e.1750709410.git.fdmanana@suse.com>
On 24.06.25 16:56, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> During log replay, at __add_inode_ref(), when we are searching for inode
> ref keys we totally ignore if btrfs_search_slot() returns an error. This
> may make a log replay succeed when there was an actual error and leave
> some metadata inconsistency in a subvolume tree. Fix this by checking if
> an error was returned from btrfs_search_slot() and if so, return it to
> the caller.
>
> Fixes: e02119d5a7b4 ("Btrfs: Add a write ahead tree log to optimize synchronous operations")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
> fs/btrfs/tree-log.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 839252881138..08948803c857 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -1073,7 +1073,9 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
> search_key.type = BTRFS_INODE_REF_KEY;
> search_key.offset = parent_objectid;
> ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
> - if (ret == 0) {
> + if (ret < 0) {
> + return ret;
> + } else if (ret == 0) {
Technically the else is not needed after the return.
Otherwise:
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
next prev parent reply other threads:[~2025-06-25 9:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 14:42 [PATCH 00/12] btrfs: log tree fixes and cleanups fdmanana
2025-06-24 14:42 ` [PATCH 01/12] btrfs: fix missing error handling when searching for inode refs during log replay fdmanana
2025-06-25 9:45 ` Johannes Thumshirn [this message]
2025-06-25 10:58 ` Filipe Manana
2025-06-24 14:42 ` [PATCH 02/12] btrfs: fix iteration of extrefs " fdmanana
2025-06-25 10:30 ` Johannes Thumshirn
2025-06-27 10:51 ` Qu Wenruo
2025-06-27 12:09 ` Filipe Manana
2025-06-24 14:42 ` [PATCH 03/12] btrfs: fix inode lookup error handling " fdmanana
2025-06-25 10:34 ` Johannes Thumshirn
2025-06-24 14:42 ` [PATCH 04/12] btrfs: record new subvolume in parent dir earlier to avoid dir logging races fdmanana
2025-06-25 10:39 ` Johannes Thumshirn
2025-06-24 14:42 ` [PATCH 05/12] btrfs: propagate last_unlink_trans earlier when doing a rmdir fdmanana
2025-06-25 10:46 ` Johannes Thumshirn
2025-06-24 14:42 ` [PATCH 06/12] btrfs: use btrfs_record_snapshot_destroy() during rmdir fdmanana
2025-06-25 10:47 ` Johannes Thumshirn
2025-06-25 10:55 ` Filipe Manana
2025-06-27 10:11 ` Johannes Thumshirn
2025-06-24 14:42 ` [PATCH 07/12] btrfs: use inode already stored in local variable at btrfs_rmdir() fdmanana
2025-06-25 10:52 ` Johannes Thumshirn
2025-06-25 10:54 ` Filipe Manana
2025-06-27 10:10 ` Johannes Thumshirn
2025-06-24 14:42 ` [PATCH 08/12] btrfs: use btrfs inodes in btrfs_rmdir() to avoid so much usage of BTRFS_I() fdmanana
2025-06-25 10:54 ` Johannes Thumshirn
2025-06-24 14:42 ` [PATCH 09/12] btrfs: split inode ref processing from __add_inode_ref() into a helper fdmanana
2025-06-25 11:07 ` Johannes Thumshirn
2025-06-24 14:42 ` [PATCH 10/12] btrfs: split inode rextef " fdmanana
2025-06-25 11:35 ` Johannes Thumshirn
2025-06-27 10:09 ` David Sterba
2025-06-24 14:42 ` [PATCH 11/12] btrfs: add btrfs prefix to is_fsstree() and make it return bool fdmanana
2025-06-25 11:35 ` Johannes Thumshirn
2025-06-24 14:42 ` [PATCH 12/12] btrfs: split btrfs_is_fsstree() into multiple if statements for readability fdmanana
2025-06-25 11:37 ` Johannes Thumshirn
2025-06-27 11:04 ` [PATCH 00/12] btrfs: log tree fixes and cleanups Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c76858f-ee2d-4462-9668-d788950ca795@wdc.com \
--to=johannes.thumshirn@wdc.com \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).