From: Boris Burkov <boris@bur.io>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com,
linux-fscrypt@vger.kernel.org,
'Eric Biggers ' <ebiggers@kernel.org>
Subject: [PATCH v2 4/5] btrfs: fallback to buffered io for verity files
Date: Fri, 5 Mar 2021 11:26:32 -0800 [thread overview]
Message-ID: <518322d5993f6eea18d5c4ee0cdaaa97fed9a405.1614971203.git.boris@bur.io> (raw)
In-Reply-To: <cover.1614971203.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 75f1406021e5..c948c30e132c 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -3623,6 +3623,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-03-05 19:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 19:26 [PATCH v2 0/5] btrfs: support fsverity Boris Burkov
2021-03-05 19:26 ` [PATCH v2 1/5] btrfs: add compat_flags to btrfs_inode_item Boris Burkov
2021-03-15 23:07 ` Eric Biggers
2021-03-15 23:29 ` Boris Burkov
2021-03-05 19:26 ` [PATCH v2 2/5] btrfs: initial fsverity support Boris Burkov
2021-03-07 7:13 ` kernel test robot
2021-03-15 23:17 ` Eric Biggers
2021-03-16 0:42 ` Boris Burkov
2021-03-16 0:57 ` Eric Biggers
2021-03-16 18:44 ` Eric Biggers
2021-03-05 19:26 ` [PATCH v2 3/5] btrfs: check verity for reads of inline extents and holes Boris Burkov
2021-03-05 19:26 ` Boris Burkov [this message]
2021-03-05 19:26 ` [PATCH v2 5/5] btrfs: verity metadata orphan items Boris Burkov
2021-03-15 23:09 ` [PATCH v2 0/5] btrfs: support fsverity Eric Biggers
2021-03-15 23:47 ` 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=518322d5993f6eea18d5c4ee0cdaaa97fed9a405.1614971203.git.boris@bur.io \
--to=boris@bur.io \
--cc=ebiggers@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fscrypt@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).