Skip to content

Commit

Permalink
scsi: ->queue_rq can't sleep
Browse files Browse the repository at this point in the history
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 3c356bd ("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>
  • Loading branch information
Christoph Hellwig committed Jan 9, 2015
1 parent 1018b8b commit 70a0f2c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq)
static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq)
{
struct scatterlist *first_chunk = NULL;
gfp_t gfp_mask = mq ? GFP_NOIO : GFP_ATOMIC;
int ret;

BUG_ON(!nents);
Expand All @@ -606,7 +605,7 @@ static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq)
}

ret = __sg_alloc_table(&sdb->table, nents, SCSI_MAX_SG_SEGMENTS,
first_chunk, gfp_mask, scsi_sg_alloc);
first_chunk, GFP_ATOMIC, scsi_sg_alloc);
if (unlikely(ret))
scsi_free_sgtable(sdb, mq);
return ret;
Expand Down

0 comments on commit 70a0f2c

Please sign in to comment.