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

Submitted by Konstantin Khorenko on March 4, 2020, 4:31 p.m.

Details

Message ID 202003041631.024GVolR014146@finist-ce7.sw.ru
State New
Series "ploop: Add debug for PSBM-101842"
Headers show

Commit Message

Konstantin Khorenko March 4, 2020, 4:31 p.m.
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@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@virtuozzo.com>
---
 drivers/block/ploop/io_direct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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;