OSDN Git Service

nvmet_fc: prevent new io rqsts in possible isr completions
authorJames Smart <jsmart2021@gmail.com>
Wed, 28 Feb 2018 22:49:11 +0000 (14:49 -0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Mar 2018 14:53:43 +0000 (08:53 -0600)
commit9d625f7792875e8119ac3f364f3fd71b8bfc1294
treee130978c0a61fc3042c3d7e7064e73392f3a3b1f
parent0cdd5fca876b1e9c56ca01186ba650b680248b35
nvmet_fc: prevent new io rqsts in possible isr completions

When a bio completion calls back into the transport for a
back-end io device, the request completion path can free
the transport io job structure allowing it to be reused for
other operations. The transport has a defer_rcv queue which
holds temporary cmd rcv ops while waitng for io job structures.
when the job frees, if there's a cmd waiting, it is picked up
and submitted for processing, which can call back out to the
bio path if it's a read.  Unfortunately, what is unknown is the
context of the original bio done call, and it may be in a state
(softirq) that is not compatible with submitting the new bio in
the same calling sequence. This is especially true when using
scsi back-end devices as scsi is in softirq when it makes the
done call.

Correct by scheduling the io to be started via workq rather
than calling the start new io path inline to the original bio
done path.

Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/target/fc.c