[rh7] ploop: Add debug for PSBM-101842

Submitted by Kirill Tkhai on March 3, 2020, 11:23 a.m.

Details

Message ID 158323459887.930434.5536692540339631415.stgit@localhost.localdomain
State New
Series "ploop: Add debug for PSBM-101842"
Headers show

Commit Message

Kirill Tkhai March 3, 2020, 11:23 a.m.
This check is to ensure we never send discards into header,
and there should be checked userspace.

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 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;