ploop: Prohibit discard in case of multi-delta case

Submitted by Kirill Tkhai on March 18, 2019, 11:34 a.m.

Details

Message ID 155290885023.23394.15894146897056953191.stgit@localhost.localdomain
State New
Series "ploop: Prohibit discard in case of multi-delta case"
Headers show

Commit Message

Kirill Tkhai March 18, 2019, 11:34 a.m.
We can't send discard in case of there are more than
on delta. Otherewise it is considered as REQ_WRITE
request and forces block allocation, which leads
to crash since bio list is NULL on discard.

Strange thing, crash dis -l shows me, that problem
address is on the bottoms branch of this function,
but really we go thru
delta && delta != top_delta && whole_block() branch.

https://jira.sw.ru/browse/PSBM-92785

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/dev.c |    3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 6349f0d556be..26745d9fc81f 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2548,6 +2548,9 @@  static bool ploop_can_issue_discard(struct ploop_device *plo,
 	if (test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state))
 		return false;
 
+	if (!list_is_singular(&plo->map.delta_list))
+		return false;
+
 	return whole_block(plo, preq);
 }