summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-01-16 17:38:04 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-21 19:27:10 +0100
commit00fff4dd58661944af9cb4fe8fe61b4105931776 (patch)
treed16b3409cd300ba8e0685351171491b300991367 /fs
parentbcachefs: remove redundant variable tmp (diff)
downloadlinux-00fff4dd58661944af9cb4fe8fe61b4105931776.tar.xz
linux-00fff4dd58661944af9cb4fe8fe61b4105931776.zip
bcachefs: bios must be 512 byte algined
Fixes: 023f9ac9f70f bcachefs: Delete dio read alignment check Reported-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r--fs/bcachefs/fs-io-direct.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/bcachefs/fs-io-direct.c b/fs/bcachefs/fs-io-direct.c
index fdd57c5785c9..e3b219e19e10 100644
--- a/fs/bcachefs/fs-io-direct.c
+++ b/fs/bcachefs/fs-io-direct.c
@@ -77,6 +77,10 @@ static int bch2_direct_IO_read(struct kiocb *req, struct iov_iter *iter)
bch2_inode_opts_get(&opts, c, &inode->ei_inode);
+ /* bios must be 512 byte aligned: */
+ if ((offset|iter->count) & (SECTOR_SIZE - 1))
+ return -EINVAL;
+
ret = min_t(loff_t, iter->count,
max_t(loff_t, 0, i_size_read(&inode->v) - offset));