drivers: block,scsi: fixup blk_get_request dead queue scenarios
authorRajath Shetty <rshetty@nvidia.com>
Thu, 3 Mar 2016 01:29:31 +0000 (17:29 -0800)
committermobile promotions <svcmobile_promotions@nvidia.com>
Fri, 8 Apr 2016 09:55:04 +0000 (02:55 -0700)
commit0798352a0634bc3ededcc257d560088b1a6216b8
tree85b9f49aaf207b70aabffb82d54944fc1851b470
parent787b8b78babe9309149197df27f09d0d8982fb9b
drivers: block,scsi: fixup blk_get_request dead queue scenarios

The blk_get_request function may fail in low-memory conditions or during
device removal (even if __GFP_WAIT is set). To distinguish between these
errors, modify the blk_get_request call stack to return the appropriate
ERR_PTR. Verify that all callers check the return status and consider
IS_ERR instead of a simple NULL pointer check.

For consistency, make a similar change to the blk_mq_alloc_request leg
of blk_get_request.  It may fail if the queue is dead, or the caller was
unwilling to wait.

This Change is part of the upstream patch:
a492f075450f3ba87de36e5ffe92a9d0c7af9723

Orignal author: Joe Lawrence <joe.lawrence@stratus.com>

Change-Id: I1da5bc8419f43704e87625dac00c8fc4b88db743
Signed-off-by: Rajath Shetty <rshetty@nvidia.com>
Reviewed-on: http://git-master/r/1022949
(cherry picked from commit 65b9bcfff6278e5f05285185a0155017879c4332)
Reviewed-on: http://git-master/r/1122041
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
18 files changed:
block/blk-core.c
block/bsg.c
block/scsi_ioctl.c
drivers/block/paride/pd.c
drivers/block/pktcdvd.c
drivers/block/sx8.c
drivers/cdrom/cdrom.c
drivers/ide/ide-park.c
drivers/scsi/device_handler/scsi_dh_alua.c
drivers/scsi/device_handler/scsi_dh_emc.c
drivers/scsi/device_handler/scsi_dh_hp_sw.c
drivers/scsi/device_handler/scsi_dh_rdac.c
drivers/scsi/osd/osd_initiator.c
drivers/scsi/osst.c
drivers/scsi/scsi_error.c
drivers/scsi/sg.c
drivers/scsi/st.c
drivers/target/target_core_pscsi.c