dm-ioctl.c (23d39f63aa87e812fd879b8bc32ee6ccfe733de3) dm-ioctl.c (d58168763f74d1edbc296d7038c60efe6493fdd4)
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 - 2006 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"

--- 219 unchanged lines hidden (view full) ---

228
229 table = dm_get_table(hc->md);
230 if (table) {
231 dm_table_event(table);
232 dm_table_put(table);
233 }
234
235 if (hc->new_map)
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 - 2006 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"

--- 219 unchanged lines hidden (view full) ---

228
229 table = dm_get_table(hc->md);
230 if (table) {
231 dm_table_event(table);
232 dm_table_put(table);
233 }
234
235 if (hc->new_map)
236 dm_table_put(hc->new_map);
236 dm_table_destroy(hc->new_map);
237 dm_put(hc->md);
238 free_cell(hc);
239}
240
241static void dm_hash_remove_all(int keep_open_devices)
242{
243 int i, dev_skipped, dev_removed;
244 struct hash_cell *hc;

--- 577 unchanged lines hidden (view full) ---

822 suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
823 if (param->flags & DM_NOFLUSH_FLAG)
824 suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG;
825 if (!dm_suspended(md))
826 dm_suspend(md, suspend_flags);
827
828 r = dm_swap_table(md, new_map);
829 if (r) {
237 dm_put(hc->md);
238 free_cell(hc);
239}
240
241static void dm_hash_remove_all(int keep_open_devices)
242{
243 int i, dev_skipped, dev_removed;
244 struct hash_cell *hc;

--- 577 unchanged lines hidden (view full) ---

822 suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
823 if (param->flags & DM_NOFLUSH_FLAG)
824 suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG;
825 if (!dm_suspended(md))
826 dm_suspend(md, suspend_flags);
827
828 r = dm_swap_table(md, new_map);
829 if (r) {
830 dm_table_destroy(new_map);
830 dm_put(md);
831 dm_put(md);
831 dm_table_put(new_map);
832 return r;
833 }
834
835 if (dm_table_get_mode(new_map) & FMODE_WRITE)
836 set_disk_ro(dm_disk(md), 0);
837 else
838 set_disk_ro(dm_disk(md), 1);
832 return r;
833 }
834
835 if (dm_table_get_mode(new_map) & FMODE_WRITE)
836 set_disk_ro(dm_disk(md), 0);
837 else
838 set_disk_ro(dm_disk(md), 1);
839
840 dm_table_put(new_map);
841 }
842
843 if (dm_suspended(md))
844 r = dm_resume(md);
845
846 if (!r)
847 r = __dev_status(md, param);
848

--- 226 unchanged lines hidden (view full) ---

1075 DMWARN("device has been removed from the dev hash table.");
1076 dm_table_put(t);
1077 up_write(&_hash_lock);
1078 r = -ENXIO;
1079 goto out;
1080 }
1081
1082 if (hc->new_map)
839 }
840
841 if (dm_suspended(md))
842 r = dm_resume(md);
843
844 if (!r)
845 r = __dev_status(md, param);
846

--- 226 unchanged lines hidden (view full) ---

1073 DMWARN("device has been removed from the dev hash table.");
1074 dm_table_put(t);
1075 up_write(&_hash_lock);
1076 r = -ENXIO;
1077 goto out;
1078 }
1079
1080 if (hc->new_map)
1083 dm_table_put(hc->new_map);
1081 dm_table_destroy(hc->new_map);
1084 hc->new_map = t;
1085 up_write(&_hash_lock);
1086
1087 param->flags |= DM_INACTIVE_PRESENT_FLAG;
1088 r = __dev_status(md, param);
1089
1090out:
1091 dm_put(md);

--- 12 unchanged lines hidden (view full) ---

1104 hc = __find_device_hash_cell(param);
1105 if (!hc) {
1106 DMWARN("device doesn't appear to be in the dev hash table.");
1107 up_write(&_hash_lock);
1108 return -ENXIO;
1109 }
1110
1111 if (hc->new_map) {
1082 hc->new_map = t;
1083 up_write(&_hash_lock);
1084
1085 param->flags |= DM_INACTIVE_PRESENT_FLAG;
1086 r = __dev_status(md, param);
1087
1088out:
1089 dm_put(md);

--- 12 unchanged lines hidden (view full) ---

1102 hc = __find_device_hash_cell(param);
1103 if (!hc) {
1104 DMWARN("device doesn't appear to be in the dev hash table.");
1105 up_write(&_hash_lock);
1106 return -ENXIO;
1107 }
1108
1109 if (hc->new_map) {
1112 dm_table_put(hc->new_map);
1110 dm_table_destroy(hc->new_map);
1113 hc->new_map = NULL;
1114 }
1115
1116 param->flags &= ~DM_INACTIVE_PRESENT_FLAG;
1117
1118 r = __dev_status(hc->md, param);
1119 md = hc->md;
1120 up_write(&_hash_lock);

--- 443 unchanged lines hidden ---
1111 hc->new_map = NULL;
1112 }
1113
1114 param->flags &= ~DM_INACTIVE_PRESENT_FLAG;
1115
1116 r = __dev_status(hc->md, param);
1117 md = hc->md;
1118 up_write(&_hash_lock);

--- 443 unchanged lines hidden ---