error returns from ->queue_rq
Hi Jens,
seems like with the SCSI work I introduced the first BLK_MQ_RQ_QUEUE_ERROR error return in the tree, and immediately ran into the first pitfall. The code as-is expects rq->errors set to an error value, which otherwise is an internal field used by the block layer and some drivers, but not part of the communication protocol between the two.
We can either make it part of the protocol for blk-mq, which would require documenting and praying driver writers get it right, or alternatively we could map BLK_MQ_RQ_QUEUE_ERROR to -EIO and if nessecary introduce other return values if we need to return other errors. The third option would be to remove BLK_MQ_RQ_QUEUE_ERROR entirely and require drivers to call blk_mq_end_io themselves from ->queue_rq, mirroring the ->queuecommand error handling. I'm undecided between options 2 and 3, but I'd rather avoid the current pitfall.
Quoted 9 lines · Christoph Hellwig
Hi Jens,
seems like with the SCSI work I introduced the first
BLK_MQ_RQ_QUEUE_ERRORerror return in the tree, and immediately ran into the first pitfall. The code as-is expectsrq->errorsset to an error value, which otherwise is an internal field used by the block layer and some drivers, but not part of the communication protocol between the two.
Quoted 8 lines
We can either make it part of the protocol for blk-mq, which would require documenting and praying driver writers get it right, or alternatively we could map
BLK_MQ_RQ_QUEUE_ERRORto-EIOand if nessecary introduce other return values if we need to return other errors. The third option would be to removeBLK_MQ_RQ_QUEUE_ERRORentirely and require drivers to callblk_mq_end_iothemselves from ->queue_rq, mirroring the ->queuecommand error handling. I'm undecided between options 2 and 3, but I'd rather avoid the current pitfall.
Lets go for option #2. I agree that we should not make this a new depedency, it's a lot more robust to just have it be -EIO and add other error returns as needed.
Signature · 1 line
Jens Axboe