aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-mq.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 06614ce0f475..59fa23935a0f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -77,7 +77,7 @@ static void blk_mq_hctx_clear_pending(struct blk_mq_hw_ctx *hctx,
77 clear_bit(CTX_TO_BIT(hctx, ctx), &bm->word); 77 clear_bit(CTX_TO_BIT(hctx, ctx), &bm->word);
78} 78}
79 79
80static int blk_mq_queue_enter(struct request_queue *q) 80static int blk_mq_queue_enter(struct request_queue *q, gfp_t gfp)
81{ 81{
82 while (true) { 82 while (true) {
83 int ret; 83 int ret;
@@ -85,6 +85,9 @@ static int blk_mq_queue_enter(struct request_queue *q)
85 if (percpu_ref_tryget_live(&q->mq_usage_counter)) 85 if (percpu_ref_tryget_live(&q->mq_usage_counter))
86 return 0; 86 return 0;
87 87
88 if (!(gfp & __GFP_WAIT))
89 return -EBUSY;
90
88 ret = wait_event_interruptible(q->mq_freeze_wq, 91 ret = wait_event_interruptible(q->mq_freeze_wq,
89 !q->mq_freeze_depth || blk_queue_dying(q)); 92 !q->mq_freeze_depth || blk_queue_dying(q));
90 if (blk_queue_dying(q)) 93 if (blk_queue_dying(q))
@@ -256,7 +259,7 @@ struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp,
256 struct blk_mq_alloc_data alloc_data; 259 struct blk_mq_alloc_data alloc_data;
257 int ret; 260 int ret;
258 261
259 ret = blk_mq_queue_enter(q); 262 ret = blk_mq_queue_enter(q, gfp);
260 if (ret) 263 if (ret)
261 return ERR_PTR(ret); 264 return ERR_PTR(ret);
262 265
@@ -1186,7 +1189,7 @@ static struct request *blk_mq_map_request(struct request_queue *q,
1186 int rw = bio_data_dir(bio); 1189 int rw = bio_data_dir(bio);
1187 struct blk_mq_alloc_data alloc_data; 1190 struct blk_mq_alloc_data alloc_data;
1188 1191
1189 if (unlikely(blk_mq_queue_enter(q))) { 1192 if (unlikely(blk_mq_queue_enter(q, GFP_KERNEL))) {
1190 bio_endio(bio, -EIO); 1193 bio_endio(bio, -EIO);
1191 return NULL; 1194 return NULL;
1192 } 1195 }