Merge tag 'xfs-4.13-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[muen/linux.git] / fs / xfs / xfs_buf.c
index 89b586f688b0b6b0e17d9ee45af538e84eabef22..72f038492ba8cdb2bd609fd19949d96b95c8ede0 100644 (file)
@@ -1227,8 +1227,11 @@ xfs_buf_bio_end_io(
         * don't overwrite existing errors - otherwise we can lose errors on
         * buffers that require multiple bios to complete.
         */
-       if (bio->bi_error)
-               cmpxchg(&bp->b_io_error, 0, bio->bi_error);
+       if (bio->bi_status) {
+               int error = blk_status_to_errno(bio->bi_status);
+
+               cmpxchg(&bp->b_io_error, 0, error);
+       }
 
        if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ))
                invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp));