blk-mq: drain I/O when all CPUs in a hctx are offline
[linux-2.6-microblaze.git] / block / blk-mq-tag.c
index 762198b..96a39d0 100644 (file)
@@ -180,6 +180,14 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data)
        sbitmap_finish_wait(bt, ws, &wait);
 
 found_tag:
+       /*
+        * Give up this allocation if the hctx is inactive.  The caller will
+        * retry on an active hctx.
+        */
+       if (unlikely(test_bit(BLK_MQ_S_INACTIVE, &data->hctx->state))) {
+               blk_mq_put_tag(tags, data->ctx, tag + tag_offset);
+               return BLK_MQ_NO_TAG;
+       }
        return tag + tag_offset;
 }