dm-ioctl.c (1d0f3ce83200edc5d43723c77c62b09ad6560294) dm-ioctl.c (042d2a9bcd80fe12d4b0871706aa9dd2231e8238)
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"

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

850}
851
852static int do_resume(struct dm_ioctl *param)
853{
854 int r = 0;
855 unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG;
856 struct hash_cell *hc;
857 struct mapped_device *md;
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"

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

850}
851
852static int do_resume(struct dm_ioctl *param)
853{
854 int r = 0;
855 unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG;
856 struct hash_cell *hc;
857 struct mapped_device *md;
858 struct dm_table *new_map;
858 struct dm_table *new_map, *old_map = NULL;
859
860 down_write(&_hash_lock);
861
862 hc = __find_device_hash_cell(param);
863 if (!hc) {
864 DMWARN("device doesn't appear to be in the dev hash table.");
865 up_write(&_hash_lock);
866 return -ENXIO;

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

879 /* Suspend if it isn't already suspended */
880 if (param->flags & DM_SKIP_LOCKFS_FLAG)
881 suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
882 if (param->flags & DM_NOFLUSH_FLAG)
883 suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG;
884 if (!dm_suspended(md))
885 dm_suspend(md, suspend_flags);
886
859
860 down_write(&_hash_lock);
861
862 hc = __find_device_hash_cell(param);
863 if (!hc) {
864 DMWARN("device doesn't appear to be in the dev hash table.");
865 up_write(&_hash_lock);
866 return -ENXIO;

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

879 /* Suspend if it isn't already suspended */
880 if (param->flags & DM_SKIP_LOCKFS_FLAG)
881 suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
882 if (param->flags & DM_NOFLUSH_FLAG)
883 suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG;
884 if (!dm_suspended(md))
885 dm_suspend(md, suspend_flags);
886
887 r = dm_swap_table(md, new_map);
888 if (r) {
887 old_map = dm_swap_table(md, new_map);
888 if (IS_ERR(old_map)) {
889 dm_table_destroy(new_map);
890 dm_put(md);
889 dm_table_destroy(new_map);
890 dm_put(md);
891 return r;
891 return PTR_ERR(old_map);
892 }
893
894 if (dm_table_get_mode(new_map) & FMODE_WRITE)
895 set_disk_ro(dm_disk(md), 0);
896 else
897 set_disk_ro(dm_disk(md), 1);
898 }
899
900 if (dm_suspended(md))
901 r = dm_resume(md);
902
892 }
893
894 if (dm_table_get_mode(new_map) & FMODE_WRITE)
895 set_disk_ro(dm_disk(md), 0);
896 else
897 set_disk_ro(dm_disk(md), 1);
898 }
899
900 if (dm_suspended(md))
901 r = dm_resume(md);
902
903 if (old_map)
904 dm_table_destroy(old_map);
903
904 if (!r) {
905 dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr);
906 r = __dev_status(md, param);
907 }
908
909 dm_put(md);
910 return r;

--- 752 unchanged lines hidden ---
905
906 if (!r) {
907 dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr);
908 r = __dev_status(md, param);
909 }
910
911 dm_put(md);
912 return r;

--- 752 unchanged lines hidden ---