dm-ioctl.c (98f332855effef02aeb738e4d62e9a5b903c52fd) dm-ioctl.c (3f77316de0ec0fd208467fbee8d9edc70e2c73b2)
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"

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

269 continue;
270 }
271
272 __hash_remove(hc);
273
274 up_write(&_hash_lock);
275
276 dm_put(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"

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

269 continue;
270 }
271
272 __hash_remove(hc);
273
274 up_write(&_hash_lock);
275
276 dm_put(md);
277 if (likely(keep_open_devices))
278 dm_destroy(md);
279 else
280 dm_destroy_immediate(md);
277
278 /*
279 * Some mapped devices may be using other mapped
280 * devices, so repeat until we make no further
281 * progress. If a new mapped device is created
282 * here it will also get removed.
283 */
284 goto retry;

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

639 if (param->flags & DM_PERSISTENT_DEV_FLAG)
640 m = MINOR(huge_decode_dev(param->dev));
641
642 r = dm_create(m, &md);
643 if (r)
644 return r;
645
646 r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md);
281
282 /*
283 * Some mapped devices may be using other mapped
284 * devices, so repeat until we make no further
285 * progress. If a new mapped device is created
286 * here it will also get removed.
287 */
288 goto retry;

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

643 if (param->flags & DM_PERSISTENT_DEV_FLAG)
644 m = MINOR(huge_decode_dev(param->dev));
645
646 r = dm_create(m, &md);
647 if (r)
648 return r;
649
650 r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md);
647 if (r)
648 goto out;
651 if (r) {
652 dm_put(md);
653 dm_destroy(md);
654 return r;
655 }
649
650 param->flags &= ~DM_INACTIVE_PRESENT_FLAG;
651
652 __dev_status(md, param);
653
656
657 param->flags &= ~DM_INACTIVE_PRESENT_FLAG;
658
659 __dev_status(md, param);
660
654out:
655 dm_put(md);
656
661 dm_put(md);
662
657 return r;
663 return 0;
658}
659
660/*
661 * Always use UUID for lookups if it's present, otherwise use name or dev.
662 */
663static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
664{
665 struct mapped_device *md;

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

743
744 __hash_remove(hc);
745 up_write(&_hash_lock);
746
747 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr))
748 param->flags |= DM_UEVENT_GENERATED_FLAG;
749
750 dm_put(md);
664}
665
666/*
667 * Always use UUID for lookups if it's present, otherwise use name or dev.
668 */
669static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
670{
671 struct mapped_device *md;

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

749
750 __hash_remove(hc);
751 up_write(&_hash_lock);
752
753 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr))
754 param->flags |= DM_UEVENT_GENERATED_FLAG;
755
756 dm_put(md);
757 dm_destroy(md);
751 return 0;
752}
753
754/*
755 * Check a string doesn't overrun the chunk of
756 * memory we copied from userland.
757 */
758static int invalid_str(char *str, void *end)

--- 914 unchanged lines hidden ---
758 return 0;
759}
760
761/*
762 * Check a string doesn't overrun the chunk of
763 * memory we copied from userland.
764 */
765static int invalid_str(char *str, void *end)

--- 914 unchanged lines hidden ---