From: Bart Van Assche Date: Wed, 31 Aug 2016 22:17:49 +0000 (-0700) Subject: dm: mark request_queue dead before destroying the DM device X-Git-Tag: v4.9-rc1~70^2~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b785fbcf81c3533772c52b717f77293099498d3;p=platform%2Fkernel%2Flinux-exynos.git dm: mark request_queue dead before destroying the DM device This avoids that new requests are queued while __dm_destroy() is in progress. Signed-off-by: Bart Van Assche Signed-off-by: Mike Snitzer Cc: stable@vger.kernel.org --- diff --git a/drivers/md/dm.c b/drivers/md/dm.c index c074212..0f2928b 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1873,6 +1873,7 @@ EXPORT_SYMBOL_GPL(dm_device_name); static void __dm_destroy(struct mapped_device *md, bool wait) { + struct request_queue *q = dm_get_md_queue(md); struct dm_table *map; int srcu_idx; @@ -1883,6 +1884,10 @@ static void __dm_destroy(struct mapped_device *md, bool wait) set_bit(DMF_FREEING, &md->flags); spin_unlock(&_minor_lock); + spin_lock_irq(q->queue_lock); + queue_flag_set(QUEUE_FLAG_DYING, q); + spin_unlock_irq(q->queue_lock); + if (dm_request_based(md) && md->kworker_task) flush_kthread_worker(&md->kworker);