aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-thin.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-thin.c')
-rw-r--r--drivers/md/dm-thin.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 301db0f45d3b..69a2d51ef4e1 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -1180,6 +1180,7 @@ static void no_space(struct cell *cell)
1180static void process_discard(struct thin_c *tc, struct bio *bio) 1180static void process_discard(struct thin_c *tc, struct bio *bio)
1181{ 1181{
1182 int r; 1182 int r;
1183 unsigned long flags;
1183 struct pool *pool = tc->pool; 1184 struct pool *pool = tc->pool;
1184 struct cell *cell, *cell2; 1185 struct cell *cell, *cell2;
1185 struct cell_key key, key2; 1186 struct cell_key key, key2;
@@ -1221,7 +1222,9 @@ static void process_discard(struct thin_c *tc, struct bio *bio)
1221 m->bio = bio; 1222 m->bio = bio;
1222 1223
1223 if (!ds_add_work(&pool->all_io_ds, &m->list)) { 1224 if (!ds_add_work(&pool->all_io_ds, &m->list)) {
1225 spin_lock_irqsave(&pool->lock, flags);
1224 list_add(&m->list, &pool->prepared_discards); 1226 list_add(&m->list, &pool->prepared_discards);
1227 spin_unlock_irqrestore(&pool->lock, flags);
1225 wake_worker(pool); 1228 wake_worker(pool);
1226 } 1229 }
1227 } else { 1230 } else {
@@ -2629,8 +2632,10 @@ static int thin_endio(struct dm_target *ti,
2629 if (h->all_io_entry) { 2632 if (h->all_io_entry) {
2630 INIT_LIST_HEAD(&work); 2633 INIT_LIST_HEAD(&work);
2631 ds_dec(h->all_io_entry, &work); 2634 ds_dec(h->all_io_entry, &work);
2635 spin_lock_irqsave(&pool->lock, flags);
2632 list_for_each_entry_safe(m, tmp, &work, list) 2636 list_for_each_entry_safe(m, tmp, &work, list)
2633 list_add(&m->list, &pool->prepared_discards); 2637 list_add(&m->list, &pool->prepared_discards);
2638 spin_unlock_irqrestore(&pool->lock, flags);
2634 } 2639 }
2635 2640
2636 mempool_free(h, pool->endio_hook_pool); 2641 mempool_free(h, pool->endio_hook_pool);