block: Disable preemption during IPI consideration

The function `__blk_complete_request` attempts to acquire the current
CPU. It determines where the demanding request should be processed. In
doing so, it checks if the current CPU and the previously requested CPU
share the same cache, and if so, to place the request on the local CPU.

The issue with acquiring the current CPU with using `smp_processor_id`
is that the current task might be preempted mid-request completion.
This will either delay block requests from being executed, or fail to
execute entirely. Use `get_cpu` and `put_cpu` to prevent this oops from
occurring. See `blk-mq.c` for more details.

Change-Id: I4b97c1eb91f4194920baaafbb6e488dfc38e07ab
Signed-off-by: Tyler Nijmeh <tylernij@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Tyler Nijmeh 2019-06-14 15:04:57 -07:00 committed by Richard Raya
parent 06c6147719
commit cbec1294e6

View File

@ -105,7 +105,7 @@ void __blk_complete_request(struct request *req)
BUG_ON(!q->softirq_done_fn);
local_irq_save(flags);
cpu = smp_processor_id();
cpu = get_cpu();
/*
* Select completion CPU
@ -147,6 +147,7 @@ do_local:
} else if (raise_blk_irq(ccpu, req))
goto do_local;
put_cpu();
local_irq_restore(flags);
}