diff options
Diffstat (limited to 'drivers/md/dm-ioctl.c')
-rw-r--r-- | drivers/md/dm-ioctl.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 6a6d475f8e80..feb64d65fbfb 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -274,6 +274,10 @@ retry: | |||
274 | up_write(&_hash_lock); | 274 | up_write(&_hash_lock); |
275 | 275 | ||
276 | dm_put(md); | 276 | dm_put(md); |
277 | if (likely(keep_open_devices)) | ||
278 | dm_destroy(md); | ||
279 | else | ||
280 | dm_destroy_immediate(md); | ||
277 | 281 | ||
278 | /* | 282 | /* |
279 | * Some mapped devices may be using other mapped | 283 | * Some mapped devices may be using other mapped |
@@ -644,17 +648,19 @@ static int dev_create(struct dm_ioctl *param, size_t param_size) | |||
644 | return r; | 648 | return r; |
645 | 649 | ||
646 | r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); | 650 | r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); |
647 | if (r) | 651 | if (r) { |
648 | goto out; | 652 | dm_put(md); |
653 | dm_destroy(md); | ||
654 | return r; | ||
655 | } | ||
649 | 656 | ||
650 | param->flags &= ~DM_INACTIVE_PRESENT_FLAG; | 657 | param->flags &= ~DM_INACTIVE_PRESENT_FLAG; |
651 | 658 | ||
652 | __dev_status(md, param); | 659 | __dev_status(md, param); |
653 | 660 | ||
654 | out: | ||
655 | dm_put(md); | 661 | dm_put(md); |
656 | 662 | ||
657 | return r; | 663 | return 0; |
658 | } | 664 | } |
659 | 665 | ||
660 | /* | 666 | /* |
@@ -748,6 +754,7 @@ static int dev_remove(struct dm_ioctl *param, size_t param_size) | |||
748 | param->flags |= DM_UEVENT_GENERATED_FLAG; | 754 | param->flags |= DM_UEVENT_GENERATED_FLAG; |
749 | 755 | ||
750 | dm_put(md); | 756 | dm_put(md); |
757 | dm_destroy(md); | ||
751 | return 0; | 758 | return 0; |
752 | } | 759 | } |
753 | 760 | ||