summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-thin.c
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2014-04-08 06:08:41 -0400
committerMike Snitzer <snitzer@redhat.com>2014-04-08 10:10:51 -0400
commit5e3283e2920a0bd8a806964d80274b8756e0dd7f (patch)
tree3472cec2ea93f35e013a1c1997b231e16c32f264 /drivers/md/dm-thin.c
parent0596661f0a16d9d69bf1033320e70b6ff52b5e81 (diff)
dm thin: irqsave must always be used with the pool->lock spinlock
Commit c140e1c4e23 ("dm thin: use per thin device deferred bio lists") incorrectly stopped disabling irqs when taking the pool's spinlock. Irqs must be disabled when taking the pool's spinlock otherwise a thread could spin_lock(), then get interrupted to service thin_endio() in interrupt context, which would then deadlock in spin_lock_irqsave(). Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-thin.c')
-rw-r--r--drivers/md/dm-thin.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 53728be84dee..ae5fd0b9c75c 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -3101,6 +3101,7 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv)
3101 struct thin_c *tc; 3101 struct thin_c *tc;
3102 struct dm_dev *pool_dev, *origin_dev; 3102 struct dm_dev *pool_dev, *origin_dev;
3103 struct mapped_device *pool_md; 3103 struct mapped_device *pool_md;
3104 unsigned long flags;
3104 3105
3105 mutex_lock(&dm_thin_pool_table.mutex); 3106 mutex_lock(&dm_thin_pool_table.mutex);
3106 3107
@@ -3191,9 +3192,9 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv)
3191 3192
3192 mutex_unlock(&dm_thin_pool_table.mutex); 3193 mutex_unlock(&dm_thin_pool_table.mutex);
3193 3194
3194 spin_lock(&tc->pool->lock); 3195 spin_lock_irqsave(&tc->pool->lock, flags);
3195 list_add_tail_rcu(&tc->list, &tc->pool->active_thins); 3196 list_add_tail_rcu(&tc->list, &tc->pool->active_thins);
3196 spin_unlock(&tc->pool->lock); 3197 spin_unlock_irqrestore(&tc->pool->lock, flags);
3197 /* 3198 /*
3198 * This synchronize_rcu() call is needed here otherwise we risk a 3199 * This synchronize_rcu() call is needed here otherwise we risk a
3199 * wake_worker() call finding no bios to process (because the newly 3200 * wake_worker() call finding no bios to process (because the newly