[Devel] [PATCH rh7] ploop: Add debug for PSBM-101842

Kirill Tkhai ktkhai at virtuozzo.com
Tue Mar 3 14:23:29 MSK 2020


This check is to ensure we never send discards into header,
and there should be checked userspace.

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 1fa7bfd6a2bb..ffa18c5779d0 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