diff options
author | Christoph Hellwig <hch@lst.de> | 2015-01-05 14:29:38 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2015-01-09 09:43:01 -0500 |
commit | 70a0f2c1898c6abf53670e55642b6e840b003892 (patch) | |
tree | 3b472f6f398cc774baf556fd592eb7b0acce262e /drivers/scsi | |
parent | 1018b8b90b1f5cf239d731fb792ddc2b4a2b4ef5 (diff) |
scsi: ->queue_rq can't sleep
The blk-mq ->queue_rq method is always called from process context,
but might have preemption disabled. This means we still always
have to use GFP_ATOMIC for memory allocations, and thus need to
revert part of commit 3c356bde1 ("scsi: stop passing a gfp_mask
argument down the command setup path").
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Tested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9ea95dd3e260..6d5c0b8cb0bb 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -591,7 +591,6 @@ static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq) | |||
591 | static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) | 591 | static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) |
592 | { | 592 | { |
593 | struct scatterlist *first_chunk = NULL; | 593 | struct scatterlist *first_chunk = NULL; |
594 | gfp_t gfp_mask = mq ? GFP_NOIO : GFP_ATOMIC; | ||
595 | int ret; | 594 | int ret; |
596 | 595 | ||
597 | BUG_ON(!nents); | 596 | BUG_ON(!nents); |
@@ -606,7 +605,7 @@ static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) | |||
606 | } | 605 | } |
607 | 606 | ||
608 | ret = __sg_alloc_table(&sdb->table, nents, SCSI_MAX_SG_SEGMENTS, | 607 | ret = __sg_alloc_table(&sdb->table, nents, SCSI_MAX_SG_SEGMENTS, |
609 | first_chunk, gfp_mask, scsi_sg_alloc); | 608 | first_chunk, GFP_ATOMIC, scsi_sg_alloc); |
610 | if (unlikely(ret)) | 609 | if (unlikely(ret)) |
611 | scsi_free_sgtable(sdb, mq); | 610 | scsi_free_sgtable(sdb, mq); |
612 | return ret; | 611 | return ret; |