diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-29 16:28:41 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-29 16:40:30 -0400 |
commit | 7b038b564b3e2a752d2211e7b0c3c29fd2f6e197 (patch) | |
tree | 9769d86414136e5aeccbad8006984b7930f900f6 | |
parent | 83208cbf2f08c270033003e10f3e7351de64a5c5 (diff) |
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 <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/fs-io-direct.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/fs-io-direct.c b/fs/bcachefs/fs-io-direct.c index 09d21aef879a..049b61bc9a5b 100644 --- a/fs/bcachefs/fs-io-direct.c +++ b/fs/bcachefs/fs-io-direct.c @@ -609,8 +609,10 @@ ssize_t bch2_direct_write(struct kiocb *req, struct iov_iter *iter) if (unlikely(ret)) goto err_put_write_ref; - if (unlikely((req->ki_pos|iter->count) & (block_bytes(c) - 1))) + if (unlikely((req->ki_pos|iter->count) & (block_bytes(c) - 1))) { + ret = -EINVAL; goto err_put_write_ref; + } inode_dio_begin(&inode->v); bch2_pagecache_block_get(inode); |