On Tue, Jan 16, 2024 at 12:03:09PM -0500, Kent Overstreet wrote:
> On Tue, Jan 16, 2024 at 10:33:08AM -0500, Brian Foster wrote:
> > Hi Kent,
> >
> > JFYI, I'm seeing the following splat pretty reliably via generic/361 on
> > an 80xcpu test box. The CI doesn't seem to produce this failure for
> > whatever reason. This bisects down to commit 023f9ac9f70f ("bcachefs:
> > Delete dio read alignment check"), before which the test still fails but
> > the kernel doesn't explode.
> >
> > Brian
> >
>
> Can you test the following?
>
Still blows up... repeated a couple times to be sure.
Brian
> --- 8< ---
> Subject: [PATCH] bcachefs: bios must be 512 byte algined
>
> Fixes: 023f9ac9f70f bcachefs: Delete dio read alignment check
> Reported-by: Brian Foster <[email protected]>
> Signed-off-by: Kent Overstreet <[email protected]>
>
> 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));
>
>