Skip to content

Commit 7b038b5

Browse files
author
Kent Overstreet
committed
bcachefs: Fix failure to return error on misaligned dio write
This was reported as an error when running coreutils shred. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 83208cb commit 7b038b5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/bcachefs/fs-io-direct.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,10 @@ ssize_t bch2_direct_write(struct kiocb *req, struct iov_iter *iter)
609609
if (unlikely(ret))
610610
goto err_put_write_ref;
611611

612-
if (unlikely((req->ki_pos|iter->count) & (block_bytes(c) - 1)))
612+
if (unlikely((req->ki_pos|iter->count) & (block_bytes(c) - 1))) {
613+
ret = -EINVAL;
613614
goto err_put_write_ref;
615+
}
614616

615617
inode_dio_begin(&inode->v);
616618
bch2_pagecache_block_get(inode);

0 commit comments

Comments
 (0)