]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq: start request gstate with gen 1
authorJianchao Wang <jianchao.w.wang@oracle.com>
Tue, 17 Apr 2018 03:46:20 +0000 (11:46 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 17 Apr 2018 03:56:41 +0000 (21:56 -0600)
commit7f19c5f02f162808b927cb9aa0bd5c61b6b8028f
tree99f63bfa99798a198838f49306e5fe0fbbbcf86c
parent758cd0766b324237d31646fc693ab3658567e6e2
blk-mq: start request gstate with gen 1

rq->gstate and rq->aborted_gstate both are zero before rqs are
allocated. If we have a small timeout, when the timer fires,
there could be rqs that are never allocated, and also there could
be rq that has been allocated but not initialized and started. At
the moment, the rq->gstate and rq->aborted_gstate both are 0, thus
the blk_mq_terminate_expired will identify the rq is timed out and
invoke .timeout early.

For scsi, this will cause scsi_times_out to be invoked before the
scsi_cmnd is not initialized, scsi_cmnd->device is still NULL at
the moment, then we will get crash.

Cc: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Martin Steigerwald <Martin@Lichtvoll.de>
Cc: stable@vger.kernel.org
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c
block/blk-mq.c