dm: requeue IO if mapping table not yet available
[linux-2.6-microblaze.git] / drivers / md / dm-rq.c
index 6948d5d..3dd040a 100644 (file)
@@ -491,8 +491,13 @@ static blk_status_t dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
 
        if (unlikely(!ti)) {
                int srcu_idx;
-               struct dm_table *map = dm_get_live_table(md, &srcu_idx);
+               struct dm_table *map;
 
+               map = dm_get_live_table(md, &srcu_idx);
+               if (unlikely(!map)) {
+                       dm_put_live_table(md, srcu_idx);
+                       return BLK_STS_RESOURCE;
+               }
                ti = dm_table_find_target(map, 0);
                dm_put_live_table(md, srcu_idx);
        }