[Devel] [PATCH RHEL7 COMMIT] ploop: Debug check that we never send discards to header

Konstantin Khorenko khorenko at virtuozzo.com
Wed Mar 4 19:31:50 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1062.12.1.vz7.131.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.12.1.vz7.131.6
------>
commit 5918bbd57ba3aba0b829efd88ef2bc7a88b0a254
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Mar 4 19:31:49 2020 +0300

    ploop: Debug check that we never send discards to header
    
    This check is to ensure we never send discards into header,
    and there should be checked userspace.
    
    Debug patch for https://jira.sw.ru/browse/PSBM-101842
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/io_direct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index f4bc099c05e99..75edf5583e8e5 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -91,7 +91,7 @@ static int dio_discard(struct ploop_io *io, struct ploop_request *preq, sector_t
 	struct file *file = io->files.file;
 	int err;
 
-	if (!dio_may_fallocate(io)) {
+	if (!dio_may_fallocate(io) || WARN_ON(!sec)) {
 		preq->eng_state = PLOOP_E_COMPLETE;
 		preq->error = -EOPNOTSUPP;
 		return 0;


More information about the Devel mailing list