From: Andrey Albershteyn <aalbersh@kernel.org>
To: "fsdevel" <linux-fsdevel@vger.kernel.org>,
"fsverity" <fsverity@lists.linux.dev>,
"linux-ext4" <linux-ext4@vger.kernel.org>,
"linux-btrfs" <linux-btrfs@vger.kernel.org>,
"linux-f2fs" <linux-f2fs-devel@lists.sourceforge.net>,
"linux-xfs" <linux-xfs@vger.kernel.org>,
dsterba@suse.com, "Eric Biggers" <ebiggers@kernel.org>,
"Christian Brauner" <brauner@kernel.org>
Cc: Andrey Albershteyn <aalbersh@kernel.org>,
tytso@mit.edu, chao@kernel.org, jaegeuk@kernel.org,
viro@zeniv.linux.org.uk, Christoph Hellwig <hch@lst.de>
Subject: [PATCH v3 5/7] btrfs: use I_VERITY_BUILDING instead of private flags
Date: Fri, 20 Nov 2026 16:50:27 +0100 [thread overview]
Message-ID: <20261120155032.187246-6-aalbersh@kernel.org> (raw)
In-Reply-To: <20261120155032.187246-1-aalbersh@kernel.org>
Now that the VFS tracks an inode whose Merkle tree is under construction
via I_VERITY_BUILDING and handles the concurrent-enable guard in the
generic fs-verity enable path, drop the inode runtime flags that
duplicated this.
btrfs only used BTRFS_INODE_VERITY_IN_PROGRESS internally, so remove it
outright.
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/btrfs/btrfs_inode.h | 7 -------
fs/btrfs/verity.c | 12 ++----------
2 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 0782f917fccc..5c752b947b56 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -78,13 +78,6 @@ enum {
* the file range, inode's io_tree).
*/
BTRFS_INODE_NO_DELALLOC_FLUSH,
- /*
- * Set when we are working on enabling verity for a file. Computing and
- * writing the whole Merkle tree can take a while so we want to prevent
- * races where two separate tasks attempt to simultaneously start verity
- * on the same file.
- */
- BTRFS_INODE_VERITY_IN_PROGRESS,
/* Set when this inode is a free space inode. */
BTRFS_INODE_FREE_SPACE_INODE,
/* Set when there are no capabilities in XATTs for the inode. */
diff --git a/fs/btrfs/verity.c b/fs/btrfs/verity.c
index 79ace98714ad..c7eec8886e49 100644
--- a/fs/btrfs/verity.c
+++ b/fs/btrfs/verity.c
@@ -461,7 +461,6 @@ static int rollback_verity(struct btrfs_inode *inode)
btrfs_assert_inode_locked(inode);
truncate_inode_pages(inode->vfs_inode.i_mapping, inode->vfs_inode.i_size);
- clear_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags);
ret = btrfs_drop_verity_items(inode);
if (ret) {
btrfs_handle_fs_error(root->fs_info, ret,
@@ -513,7 +512,6 @@ static int rollback_verity(struct btrfs_inode *inode)
* - mark the inode with the verity flag
* - delete the orphan item
* - mark the ro compat bit
- * - clear the in progress bit
*
* Returns 0 on success, negative error code on failure.
*/
@@ -555,7 +553,6 @@ static int finish_verity(struct btrfs_inode *inode, const void *desc,
goto end_trans;
/* Now that rollback is no longer possible, set S_VERITY. */
btrfs_sync_inode_flags_to_i_flags(inode);
- clear_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags);
btrfs_set_fs_compat_ro(root->fs_info, VERITY);
end_trans:
if (ret)
@@ -570,8 +567,8 @@ static int finish_verity(struct btrfs_inode *inode, const void *desc,
*
* @filp: file to enable verity on
*
- * Begin enabling fsverity for the file. We drop any existing verity items, add
- * an orphan and set the in progress bit.
+ * Begin enabling fsverity for the file. We drop any existing verity items and
+ * add an orphan.
*
* Returns 0 on success, negative error code on failure.
*/
@@ -587,9 +584,6 @@ static int btrfs_begin_enable_verity(struct file *filp)
if (IS_ENCRYPTED(&inode->vfs_inode))
return -EOPNOTSUPP;
- if (test_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags))
- return -EBUSY;
-
/*
* This should almost never do anything, but theoretically, it's
* possible that we failed to enable verity on a file, then were
@@ -606,8 +600,6 @@ static int btrfs_begin_enable_verity(struct file *filp)
return PTR_ERR(trans);
ret = btrfs_orphan_add(trans, inode);
- if (!ret)
- set_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags);
btrfs_end_transaction(trans);
return ret;
--
2.54.0
WARNING: multiple messages have this Message-ID (diff)
From: Andrey Albershteyn via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: "fsdevel" <linux-fsdevel@vger.kernel.org>,
"fsverity" <fsverity@lists.linux.dev>,
"linux-ext4" <linux-ext4@vger.kernel.org>,
"linux-btrfs" <linux-btrfs@vger.kernel.org>,
"linux-f2fs" <linux-f2fs-devel@lists.sourceforge.net>,
"linux-xfs" <linux-xfs@vger.kernel.org>,
dsterba@suse.com, "Eric Biggers" <ebiggers@kernel.org>,
"Christian Brauner" <brauner@kernel.org>
Cc: tytso@mit.edu, viro@zeniv.linux.org.uk, jaegeuk@kernel.org,
Andrey Albershteyn <aalbersh@kernel.org>,
Christoph Hellwig <hch@lst.de>
Subject: [f2fs-dev] [PATCH v3 5/7] btrfs: use I_VERITY_BUILDING instead of private flags
Date: Fri, 20 Nov 2026 16:50:27 +0100 [thread overview]
Message-ID: <20261120155032.187246-6-aalbersh@kernel.org> (raw)
In-Reply-To: <20261120155032.187246-1-aalbersh@kernel.org>
Now that the VFS tracks an inode whose Merkle tree is under construction
via I_VERITY_BUILDING and handles the concurrent-enable guard in the
generic fs-verity enable path, drop the inode runtime flags that
duplicated this.
btrfs only used BTRFS_INODE_VERITY_IN_PROGRESS internally, so remove it
outright.
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/btrfs/btrfs_inode.h | 7 -------
fs/btrfs/verity.c | 12 ++----------
2 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 0782f917fccc..5c752b947b56 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -78,13 +78,6 @@ enum {
* the file range, inode's io_tree).
*/
BTRFS_INODE_NO_DELALLOC_FLUSH,
- /*
- * Set when we are working on enabling verity for a file. Computing and
- * writing the whole Merkle tree can take a while so we want to prevent
- * races where two separate tasks attempt to simultaneously start verity
- * on the same file.
- */
- BTRFS_INODE_VERITY_IN_PROGRESS,
/* Set when this inode is a free space inode. */
BTRFS_INODE_FREE_SPACE_INODE,
/* Set when there are no capabilities in XATTs for the inode. */
diff --git a/fs/btrfs/verity.c b/fs/btrfs/verity.c
index 79ace98714ad..c7eec8886e49 100644
--- a/fs/btrfs/verity.c
+++ b/fs/btrfs/verity.c
@@ -461,7 +461,6 @@ static int rollback_verity(struct btrfs_inode *inode)
btrfs_assert_inode_locked(inode);
truncate_inode_pages(inode->vfs_inode.i_mapping, inode->vfs_inode.i_size);
- clear_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags);
ret = btrfs_drop_verity_items(inode);
if (ret) {
btrfs_handle_fs_error(root->fs_info, ret,
@@ -513,7 +512,6 @@ static int rollback_verity(struct btrfs_inode *inode)
* - mark the inode with the verity flag
* - delete the orphan item
* - mark the ro compat bit
- * - clear the in progress bit
*
* Returns 0 on success, negative error code on failure.
*/
@@ -555,7 +553,6 @@ static int finish_verity(struct btrfs_inode *inode, const void *desc,
goto end_trans;
/* Now that rollback is no longer possible, set S_VERITY. */
btrfs_sync_inode_flags_to_i_flags(inode);
- clear_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags);
btrfs_set_fs_compat_ro(root->fs_info, VERITY);
end_trans:
if (ret)
@@ -570,8 +567,8 @@ static int finish_verity(struct btrfs_inode *inode, const void *desc,
*
* @filp: file to enable verity on
*
- * Begin enabling fsverity for the file. We drop any existing verity items, add
- * an orphan and set the in progress bit.
+ * Begin enabling fsverity for the file. We drop any existing verity items and
+ * add an orphan.
*
* Returns 0 on success, negative error code on failure.
*/
@@ -587,9 +584,6 @@ static int btrfs_begin_enable_verity(struct file *filp)
if (IS_ENCRYPTED(&inode->vfs_inode))
return -EOPNOTSUPP;
- if (test_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags))
- return -EBUSY;
-
/*
* This should almost never do anything, but theoretically, it's
* possible that we failed to enable verity on a file, then were
@@ -606,8 +600,6 @@ static int btrfs_begin_enable_verity(struct file *filp)
return PTR_ERR(trans);
ret = btrfs_orphan_add(trans, inode);
- if (!ret)
- set_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags);
btrfs_end_transaction(trans);
return ret;
--
2.54.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2026-11-20 15:54 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 15:50 [PATCH v3 0/7] fsverity: lift ioctl() input masking and runtime inode flag to VFS Andrey Albershteyn
2026-11-20 15:50 ` [f2fs-dev] " Andrey Albershteyn via Linux-f2fs-devel
2026-11-20 15:50 ` [PATCH v3 1/7] fs: constify inode argument of inode_state_read_once() Andrey Albershteyn
2026-11-20 15:50 ` [f2fs-dev] " Andrey Albershteyn via Linux-f2fs-devel
2026-11-20 15:58 ` sashiko-bot
2026-11-20 15:58 ` sashiko-bot
2026-11-20 15:50 ` [PATCH v3 2/7] fs: strip FS_VERITY_FL from FS_IOC_SETFLAGS Andrey Albershteyn
2026-11-20 15:50 ` [f2fs-dev] " Andrey Albershteyn via Linux-f2fs-devel
2026-11-20 16:00 ` sashiko-bot
2026-11-20 16:02 ` sashiko-bot
2026-11-20 15:50 ` [PATCH v3 3/7] fs,fsverity: add I_VERITY_BUILDING inode state flag Andrey Albershteyn
2026-11-20 15:50 ` [f2fs-dev] [PATCH v3 3/7] fs, fsverity: " Andrey Albershteyn via Linux-f2fs-devel
2026-11-20 16:01 ` [PATCH v3 3/7] fs,fsverity: " sashiko-bot
2026-11-20 16:01 ` sashiko-bot
2026-11-20 15:50 ` [PATCH v3 4/7] iomap: use fsverity_is_building() to check for fsverity IO Andrey Albershteyn
2026-11-20 15:50 ` [f2fs-dev] " Andrey Albershteyn via Linux-f2fs-devel
2026-11-20 16:13 ` sashiko-bot
2026-11-20 16:21 ` sashiko-bot
2026-11-20 16:42 ` Andrey Albershteyn
2026-11-20 15:50 ` Andrey Albershteyn [this message]
2026-11-20 15:50 ` [f2fs-dev] [PATCH v3 5/7] btrfs: use I_VERITY_BUILDING instead of private flags Andrey Albershteyn via Linux-f2fs-devel
2026-11-20 15:58 ` sashiko-bot
2026-11-20 15:59 ` sashiko-bot
2026-11-20 15:50 ` [PATCH v3 6/7] ext4: " Andrey Albershteyn
2026-11-20 15:50 ` [f2fs-dev] " Andrey Albershteyn via Linux-f2fs-devel
2026-11-20 16:00 ` sashiko-bot
2026-11-20 16:01 ` sashiko-bot
2026-11-20 15:50 ` [PATCH v3 7/7] f2fs: " Andrey Albershteyn
2026-11-20 15:50 ` [f2fs-dev] " Andrey Albershteyn via Linux-f2fs-devel
2026-11-20 15:58 ` sashiko-bot
2026-11-20 16:01 ` sashiko-bot
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=20261120155032.187246-6-aalbersh@kernel.org \
--to=aalbersh@kernel.org \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=dsterba@suse.com \
--cc=ebiggers@kernel.org \
--cc=fsverity@lists.linux.dev \
--cc=hch@lst.de \
--cc=jaegeuk@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.