[RHEL7,COMMIT] ploop: Do not try to update index after REQ_DISCARD in raw format

Submitted by Konstantin Khorenko on Dec. 31, 2019, 1:02 p.m.

Details

Message ID 201912311302.xBVD2X6w001494@finist-ce7.sw.ru
State New
Series "ploop: Do not try to update index after REQ_DISCARD in raw format"
Headers show

Commit Message

Konstantin Khorenko Dec. 31, 2019, 1:02 p.m.
The commit is pushed to "branch-rh7-3.10.0-1062.7.1.vz7.130.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.7.1.vz7.130.8
------>
commit 5a9ed090245645a5f75bbc2bb6d178d8c5f7d50e
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Tue Dec 31 16:02:32 2019 +0300

    ploop: Do not try to update index after REQ_DISCARD in raw format
    
    Otherwise panic may occur (unexisting .allocate_complete method will be called):
    
    BUG: unable to handle kernel NULL pointer dereference at           (null)
    IP: [<          (null)>]           (null)
    PGD 0
    Oops: 0010 [#1] SMP
    task: ffff8e6641402000 ti: ffff8e6766b38000 task.ti: ffff8e6766b38000
    RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null)
    RSP: 0018:ffff8e6766b3bda0  EFLAGS: 00010297
    RAX: 0000000000000000 RBX: ffff8e6760fd7000 RCX: ffff8e6760fd70d0
    RDX: ffff8e664108aa00 RSI: ffff8e6760fd7000 RDI: ffff8e664108aa00
    RBP: ffff8e6766b3be20 R08: ffff8e6760fd7000 R09: ffffffffc036352a
    R10: ffff8e677fdb07e0 R11: ffffdeee48dc74c0 R12: ffff8e66e5fda1d8
    R13: ffffffffa638c400 R14: 0000000000000000 R15: 0000000000000000
    FS:  0000000000000000(0000) GS:ffff8e677fd80000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 00000000bafac000 CR4: 00000000007626e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    PKRU: 55555554
    Call Trace:
    ? ploop_req_state_process+0x888/0xe10 [ploop]
    ? ploop_wait+0x155/0x1b0 [ploop]
    ? ploop_bio_queue+0x17b/0x6a0 [ploop]
    ploop_thread+0x23d/0x4f0 [ploop]
    ? ploop_req_state_process+0xe10/0xe10 [ploop]
    kthread+0xd1/0xe0
    ? create_kthread+0x60/0x60
    ret_from_fork_nospec_begin+0x7/0x21
    ? create_kthread+0x60/0x60
    Code:  Bad RIP value
    RIP  [<          (null)>]           (null)
     RSP <ffff8e6766b3bda0>
    CR2: 0000000000000000
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index b2675388ae03f..2029703020e4b 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2474,7 +2474,8 @@  ploop_entry_request(struct ploop_request * preq)
 					spin_unlock_irq(&plo->lock);
 				}
 				preq->iblock = iblk;
-				if (!(preq->req_rw & REQ_DISCARD))
+				if (!(preq->req_rw & REQ_DISCARD) ||
+				    (delta->ops->capability & PLOOP_FMT_CAP_IDENTICAL))
 					preq->eng_state = PLOOP_E_COMPLETE;
 				else
 					preq->eng_state = PLOOP_E_DATA_WBI;