[Devel] [PATCH RHEL7 COMMIT] ploop: Discard bios of size not aligned at 512 bytes
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Feb 27 15:34:12 MSK 2018
The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.45.4
------>
commit 50701fc25402b4aa585cb1dd8e7ac7423c57bf07
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Tue Feb 27 15:34:12 2018 +0300
ploop: Discard bios of size not aligned at 512 bytes
Currently, we have BUG_ON() on this place. But it's
easy to generate 511 bytes request from userspace,
as it was found by Andrey Vagin via iscsi tests:
sg_raw -r511 /dev/sda 28 0 0 0 0 0 0 0 9 0
This patch replaces BUG_ON() with bio discarding
like other drivers do when they see a size above
their logical block size.
https://jira.sw.ru/browse/PSBM-81576
Reported-by: Andrey Vagin <avagin at virtuozzo.com>
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Acked-by: Andrei Vagin <avagin at virtuozzo.com>
---
drivers/block/ploop/dev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 6c0b3c0252c0..82d986922b4b 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -846,7 +846,11 @@ static void ploop_make_request(struct request_queue *q, struct bio *bio)
plo->st.bio_in++;
BUG_ON(bio->bi_idx);
- BUG_ON(bio->bi_size & 511);
+ if (bio->bi_size & 511) {
+ pr_err_once("ploop%d: dropped bio: bi_size=%u\n", plo->index, bio->bi_size);
+ BIO_ENDIO(q, bio, -EIO);
+ return;
+ }
cpu = part_stat_lock();
part = disk_map_sector_rcu(plo->disk, bio->bi_sector);
More information about the Devel
mailing list