[RH7] ploop: Inherit stacking limits for ext4 over io_kaio

Submitted by Kirill Tkhai on June 22, 2020, 1:54 p.m.

Details

Message ID 159283405130.399119.7626127610009182628.stgit@localhost.localdomain
State New
Series "ploop: Inherit stacking limits for ext4 over io_kaio"
Headers show

Commit Message

Kirill Tkhai June 22, 2020, 1:54 p.m.
Otherwise, a bio that bigger then the underlining blockdev,
may be submitted:

    bio too big device dm-0 (2048 > 512)
    EXT4-fs warning (device ploop26646p1): ext4_end_bio:302: I/O error -5
    writing to inode 137338 (offset 0 size 0 starting block 233984)
    Buffer I/O error on device ploop26646p1, logical block 233728

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 38b807b9253a..6d6517dcf2e5 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -1122,6 +1122,16 @@  static void kaio_unplug(struct ploop_io * io)
 
 static void kaio_queue_settings(struct ploop_io * io, struct request_queue * q)
 {
+	struct file  *file  = io->files.file;
+	struct inode *inode = file->f_mapping->host;
+
+	if (inode->i_sb->s_magic == EXT4_SUPER_MAGIC) {
+		WARN_ON(!kaio_backed_ext4);
+		blk_queue_stack_limits(q, bdev_get_queue(io->files.bdev));
+		ploop_set_discard_limits(io->plo);
+		return;
+	}
+
 	blk_set_stacking_limits(&q->limits);
 	/*
 	 * Maintaince mode based discard splits a big bio itself,