mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: guolingxing <guolingxing@tju.edu.cn>,
	David Sterba <dsterba@suse.com>, Chris Mason <clm@fb.com>,
	Boris Burkov <boris@bur.io>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: verity: propagate orphan insertion errors when enabling verity
Date: Thu, 15 Oct 2026 21:04:26 +1030	[thread overview]
Message-ID: <0928487d-bde6-45e3-868d-8bdf9d22b6c8@suse.com> (raw)
In-Reply-To: <20261015095901.4140409-1-guolingxing@tju.edu.cn>



在 2026/10/15 20:29, guolingxing 写道:
> btrfs_begin_enable_verity() ignores the return value of
> btrfs_orphan_add() and unconditionally returns 0. If orphan insertion
> fails, btrfs_orphan_add() aborts the transaction, but the generic
> fs-verity code still proceeds with Merkle tree construction because
> the begin_enable_verity callback reported success.
> 
> Return the error so that fs-verity stops immediately instead of
> continuing after the initialization failure.
> 
> The transaction is already aborted by btrfs_orphan_add() and the
> handle is released by btrfs_end_transaction(), so no additional
> cleanup is needed.
> 
> Fixes: 705242538ff3 ("btrfs: verity metadata orphan items")
> Signed-off-by: guolingxing <guolingxing@tju.edu.cn>

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

Will push to for-next branch soon.

> ---
> Hi Qu, you are right. The claim about leaving the on-disk state
> inconsistent was incorrect.
> 
> btrfs_orphan_add() aborts the transaction on failure, so I do not
> have evidence that ignoring its return value can cause on-disk
> inconsistency. The real issue is that btrfs_begin_enable_verity()
> reports success despite the initialization failure, letting the
> generic fs-verity code proceed with Merkle tree construction only to
> encounter an error later, instead of returning the original error
> immediately. This revision removes the on-disk inconsistency claim and
> describes the error propagation issue instead.
> 
> Thanks for pointing this out.
> 
> Changes in v2:
> - Remove the incorrect claim about on-disk inconsistency.
> - Clarify that the fix propagates the initialization error immediately.
> 
>   fs/btrfs/verity.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/verity.c b/fs/btrfs/verity.c
> index 600337a84fbe..d92c9dab0293 100644
> --- a/fs/btrfs/verity.c
> +++ b/fs/btrfs/verity.c
> @@ -615,7 +615,7 @@ static int btrfs_begin_enable_verity(struct file *filp)
>   		set_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags);
>   	btrfs_end_transaction(trans);
>   
> -	return 0;
> +	return ret;
>   }
>   
>   /*


      reply	other threads:[~2026-10-15 10:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  7:11 [PATCH] btrfs: verity: return error from btrfs_orphan_add in begin_enable_verity guolingxing
2026-10-15  9:02 ` Qu Wenruo
2026-10-15  9:59   ` [PATCH v2] btrfs: verity: propagate orphan insertion errors when enabling verity guolingxing
2026-10-15 10:34     ` Qu Wenruo [this message]

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=0928487d-bde6-45e3-868d-8bdf9d22b6c8@suse.com \
    --to=wqu@suse.com \
    --cc=boris@bur.io \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=guolingxing@tju.edu.cn \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®