From: Boris Burkov <boris@bur.io>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com,
Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 4/5] btrfs: fallback to buffered io for verity files
Date: Thu, 4 Feb 2021 15:21:40 -0800 [thread overview]
Message-ID: <f98c66cb463b336adf6f9f6aff9fa7282a488052.1612475783.git.boris@bur.io> (raw)
In-Reply-To: <cover.1612475783.git.boris@bur.io>
Reading the contents with direct IO would circumvent verity checks, so
fallback to buffered reads. For what it's worth, this is how ext4
handles it as well.
Signed-off-by: Boris Burkov <boris@bur.io>
---
fs/btrfs/file.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 6c08bca09d62..a4a2c9c9fcf0 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -3621,6 +3621,9 @@ static ssize_t btrfs_direct_read(struct kiocb *iocb, struct iov_iter *to)
struct inode *inode = file_inode(iocb->ki_filp);
ssize_t ret;
+ if (fsverity_active(inode))
+ return 0;
+
if (check_direct_read(btrfs_sb(inode->i_sb), to, iocb->ki_pos))
return 0;
--
2.24.1
next prev parent reply other threads:[~2021-02-04 23:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-04 23:21 [PATCH 0/5] btrfs: support fsverity Boris Burkov
2021-02-04 23:21 ` [PATCH 1/5] btrfs: add compat_flags to btrfs_inode_item Boris Burkov
2021-02-04 23:21 ` [PATCH 2/5] btrfs: initial fsverity support Boris Burkov
2021-02-05 3:07 ` kernel test robot
2021-02-05 3:21 ` kernel test robot
2021-02-05 5:37 ` kernel test robot
2021-02-05 6:39 ` Eric Biggers
2021-02-05 18:14 ` Chris Mason
2021-02-05 8:06 ` Nikolay Borisov
2021-02-05 15:50 ` Chris Mason
2021-02-09 17:57 ` Boris Burkov
2021-02-04 23:21 ` [PATCH 3/5] btrfs: check verity for reads of inline extents and holes Boris Burkov
2021-02-04 23:21 ` Boris Burkov [this message]
2021-02-04 23:21 ` [PATCH 5/5] btrfs: add sysfs feature for fsverity Boris Burkov
2021-02-05 6:13 ` [PATCH 0/5] btrfs: support fsverity Eric Biggers
2021-02-05 6:58 ` Boris Burkov
2021-02-05 16:06 ` Chris Mason
2021-02-12 1:19 ` Zygo Blaxell
2021-02-12 17:43 ` Boris Burkov
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=f98c66cb463b336adf6f9f6aff9fa7282a488052.1612475783.git.boris@bur.io \
--to=boris@bur.io \
--cc=ebiggers@kernel.org \
--cc=kernel-team@fb.com \
--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).