]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm: mark request_queue dead before destroying the DM device
authorBart Van Assche <bart.vanassche@sandisk.com>
Wed, 31 Aug 2016 22:17:49 +0000 (15:17 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 23 Feb 2017 03:54:00 +0000 (03:54 +0000)
commit 3b785fbcf81c3533772c52b717f77293099498d3 upstream.

This avoids that new requests are queued while __dm_destroy() is in
progress.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[js: use md->queue instead of non-present helper]
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/md/dm.c

index f62d4c8bd9f947fab4522f6e392c9e9161fcd874..35caa4c17c3dbd1b73efb0bfc936c818b70167ad 100644 (file)
@@ -2407,6 +2407,7 @@ EXPORT_SYMBOL_GPL(dm_device_name);
 
 static void __dm_destroy(struct mapped_device *md, bool wait)
 {
+       struct request_queue *q = md->queue;
        struct dm_table *map;
        int srcu_idx;
 
@@ -2417,6 +2418,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);
+
        /*
         * Take suspend_lock so that presuspend and postsuspend methods
         * do not race with internal suspend.