OSDN Git Service

f2fs: update multi-dev metadata in resize_fs
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / fs / buffer.c
index 14ce7b2..8ee4169 100644 (file)
@@ -3034,6 +3034,13 @@ void guard_bio_eod(int rw, struct bio *bio)
        /* Uhhuh. We've got a bio that straddles the device size! */
        truncated_bytes = bio->bi_iter.bi_size - (maxsector << 9);
 
+       /*
+        * The bio contains more than one segment which spans EOD, just return
+        * and let IO layer turn it into an EIO
+        */
+       if (truncated_bytes > bvec->bv_len)
+               return;
+
        /* Truncate the bio.. */
        bio->bi_iter.bi_size -= truncated_bytes;
        bvec->bv_len -= truncated_bytes;