public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 2/2] btrfs: don't silently ignore unexpected extent type when replaying log
Date: Tue, 3 Jun 2025 15:22:50 -0700	[thread overview]
Message-ID: <20250603222155.GA403413@zen.localdomain> (raw)
In-Reply-To: <7a4820f91854e3e0e52ec39a4dd89ce9878193d6.1748985387.git.fdmanana@suse.com>

On Tue, Jun 03, 2025 at 10:19:58PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> If there's an unexpected (invalid) extent type, we just silently ignore
> it. This means a corruption or some bug somewhere, so instead return
> -EUCLEAN to the caller, making log replay fail, and print an error message
> with relevant information.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Boris Burkov <boris@bur.io>

> ---
>  fs/btrfs/tree-log.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index c8dcc7d3f4b0..3f5593fe1215 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -668,7 +668,10 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
>  		extent_end = ALIGN(start + size,
>  				   fs_info->sectorsize);
>  	} else {
> -		return 0;
> +		btrfs_err(fs_info,
> +		  "unexpected extent type=%d root=%llu inode=%llu offset=%llu",
> +			  found_type, btrfs_root_id(root), key->objectid, key->offset);
> +		return -EUCLEAN;
>  	}
>  
>  	inode = read_one_inode(root, key->objectid);
> -- 
> 2.47.2
> 

  reply	other threads:[~2025-06-03 22:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-03 21:19 [PATCH v2 0/2] btrfs: a couple bug fixes for log replay fdmanana
2025-06-03 21:19 ` [PATCH v2 1/2] btrfs: fix invalid inode pointer dereferences during " fdmanana
2025-06-03 21:19 ` [PATCH v2 2/2] btrfs: don't silently ignore unexpected extent type when replaying log fdmanana
2025-06-03 22:22   ` Boris Burkov [this message]
2025-06-04 12:24   ` David Sterba

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=20250603222155.GA403413@zen.localdomain \
    --to=boris@bur.io \
    --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