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 <mason@kernel.org>,
	Boris Burkov <boris@bur.io>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] btrfs: verity: return error from btrfs_orphan_add in begin_enable_verity
Date: Thu, 15 Oct 2026 19:32:06 +1030	[thread overview]
Message-ID: <e3321d2d-d8dc-43e5-8501-31b2d5ae1146@suse.com> (raw)
In-Reply-To: <20261015071128.3319350-1-guolingxing@tju.edu.cn>



在 2026/10/15 17:41, guolingxing 写道:
> btrfs_begin_enable_verity() ignores the return value of
> btrfs_orphan_add() and unconditionally returns 0. When inserting the
> orphan item fails (e.g. -ENOMEM), the error is swallowed and the
> caller continues to build the Merkle tree even though the orphan item
> was never written and BTRFS_INODE_VERITY_IN_PROGRESS was not set,
> leaving the on-disk state inconsistent.

This conflicts with your statement just lines below:

"The transaction is already aborted inside btrfs_orphan_add() on failure"

So why the on-disk state can still be inconsistent?

> 
> Propagate the error to the caller so that fsverity_ioctl_enable()
> aborts before building the Merkle tree. The transaction is already
> aborted inside btrfs_orphan_add() on failure and released by the
> unconditional btrfs_end_transaction(), so only the return value needs
> to change.
> 
> Fixes: 705242538ff3 ("btrfs: verity metadata orphan items")
> Cc: stable@vger.kernel.org
> Signed-off-by: guolingxing <guolingxing@tju.edu.cn>
> ---
>   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  9:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  7:11 guolingxing
2026-10-15  9:02 ` Qu Wenruo [this message]
2026-10-15  9:59   ` [PATCH v2] btrfs: verity: propagate orphan insertion errors when enabling verity guolingxing
2026-10-15 10:34     ` 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=e3321d2d-d8dc-43e5-8501-31b2d5ae1146@suse.com \
    --to=wqu@suse.com \
    --cc=boris@bur.io \
    --cc=dsterba@suse.com \
    --cc=guolingxing@tju.edu.cn \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@kernel.org \
    --cc=stable@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®