dm.c (44cc6c08da0b6c8321c6740bbb6a0c6feb45b2c2) | dm.c (2a708cff93f1845b9239bc7d6310aef54e716c6a) |
---|---|
1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 2823 unchanged lines hidden (view full) --- 2832 2833static void __dm_destroy(struct mapped_device *md, bool wait) 2834{ 2835 struct dm_table *map; 2836 int srcu_idx; 2837 2838 might_sleep(); 2839 | 1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 2823 unchanged lines hidden (view full) --- 2832 2833static void __dm_destroy(struct mapped_device *md, bool wait) 2834{ 2835 struct dm_table *map; 2836 int srcu_idx; 2837 2838 might_sleep(); 2839 |
2840 map = dm_get_live_table(md, &srcu_idx); 2841 | |
2842 spin_lock(&_minor_lock); 2843 idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md)))); 2844 set_bit(DMF_FREEING, &md->flags); 2845 spin_unlock(&_minor_lock); 2846 2847 if (dm_request_based(md) && md->kworker_task) 2848 flush_kthread_worker(&md->kworker); 2849 2850 /* 2851 * Take suspend_lock so that presuspend and postsuspend methods 2852 * do not race with internal suspend. 2853 */ 2854 mutex_lock(&md->suspend_lock); | 2840 spin_lock(&_minor_lock); 2841 idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md)))); 2842 set_bit(DMF_FREEING, &md->flags); 2843 spin_unlock(&_minor_lock); 2844 2845 if (dm_request_based(md) && md->kworker_task) 2846 flush_kthread_worker(&md->kworker); 2847 2848 /* 2849 * Take suspend_lock so that presuspend and postsuspend methods 2850 * do not race with internal suspend. 2851 */ 2852 mutex_lock(&md->suspend_lock); |
2853 map = dm_get_live_table(md, &srcu_idx); |
|
2855 if (!dm_suspended_md(md)) { 2856 dm_table_presuspend_targets(map); 2857 dm_table_postsuspend_targets(map); 2858 } | 2854 if (!dm_suspended_md(md)) { 2855 dm_table_presuspend_targets(map); 2856 dm_table_postsuspend_targets(map); 2857 } |
2859 mutex_unlock(&md->suspend_lock); 2860 | |
2861 /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ 2862 dm_put_live_table(md, srcu_idx); | 2858 /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ 2859 dm_put_live_table(md, srcu_idx); |
2860 mutex_unlock(&md->suspend_lock); |
|
2863 2864 /* 2865 * Rare, but there may be I/O requests still going to complete, 2866 * for example. Wait for all references to disappear. 2867 * No one should increment the reference count of the mapped_device, 2868 * after the mapped_device state becomes DMF_FREEING. 2869 */ 2870 if (wait) --- 681 unchanged lines hidden --- | 2861 2862 /* 2863 * Rare, but there may be I/O requests still going to complete, 2864 * for example. Wait for all references to disappear. 2865 * No one should increment the reference count of the mapped_device, 2866 * after the mapped_device state becomes DMF_FREEING. 2867 */ 2868 if (wait) --- 681 unchanged lines hidden --- |