From: Keith Busch <[email protected]>

A failed integrity mapping holds a dio reference, so we need to go
through the full bio ending in case there were previously submitted
bio's in the sequence.

Fixes: 2729a60bbfb92 ("block: don't silently ignore metadata for sync 
read/write")
Signed-off-by: Keith Busch <[email protected]>
---
 block/fops.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/fops.c b/block/fops.c
index f237d6cab8975..b5c320da28123 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -238,8 +238,10 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, 
struct iov_iter *iter,
                }
                if (iocb->ki_flags & IOCB_HAS_METADATA) {
                        ret = bio_integrity_map_iter(bio, iocb->private);
-                       if (unlikely(ret))
-                               goto fail;
+                       if (unlikely(ret)) {
+                               bio_endio_errno(bio, ret);
+                               break;
+                       }
                }
 
                if (is_read) {
-- 
2.52.0


Reply via email to