diff options
| author | haad <haad@NetBSD.org> | 2009-02-19 23:07:32 +0000 |
|---|---|---|
| committer | haad <haad@NetBSD.org> | 2009-02-19 23:07:32 +0000 |
| commit | 17599f37f30989c9b5031c73f1c170f363299b72 (patch) | |
| tree | 843308771fc90d128f9a43d513d8eb17cbb296e2 /sys/dev/dm/dm_ioctl.c | |
| parent | 7184d23274d3c615121a34f168cf65f51157e9c5 (diff) | |
Add support for autoloading of device-mapper targets modules. Add
dm_target_autoload function which tries to load target module. Fix two
deadlocks in dm_table_load_ioctl error path(I forgot to call dm_dev_unbusy).
Diffstat (limited to 'sys/dev/dm/dm_ioctl.c')
| -rw-r--r-- | sys/dev/dm/dm_ioctl.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/dev/dm/dm_ioctl.c b/sys/dev/dm/dm_ioctl.c index 3973c1bd03c..3b73c68293e 100644 --- a/sys/dev/dm/dm_ioctl.c +++ b/sys/dev/dm/dm_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm_ioctl.c,v 1.6 2009/01/16 00:46:12 haad Exp $ */ +/* $NetBSD: dm_ioctl.c,v 1.7 2009/02/19 23:07:33 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -719,7 +719,8 @@ dm_table_load_ioctl(prop_dictionary_t dm_dict) return ENOENT; } - aprint_debug("Loading table to device: %s--%d\n",name,dmv->table_head.cur_active_table); + aprint_debug("Loading table to device: %s--%d\n", name, + dmv->table_head.cur_active_table); /* * I have to check if this table slot is not used by another table list. @@ -739,17 +740,21 @@ dm_table_load_ioctl(prop_dictionary_t dm_dict) prop_dictionary_get_cstring_nocopy(target_dict, DM_TABLE_TYPE, &type); - /* * If we want to deny table with 2 or more different * target we should do it here */ - if ((target = dm_target_lookup(type)) == NULL) + if (((target = dm_target_lookup(type)) == NULL) && + ((target = dm_target_autoload(type)) == NULL)) { + dm_dev_unbusy(dmv); return ENOENT; + } if ((table_en = kmem_alloc(sizeof(dm_table_entry_t), - KM_NOSLEEP)) == NULL) + KM_NOSLEEP)) == NULL) { + dm_dev_unbusy(dmv); return ENOMEM; + } prop_dictionary_get_uint64(target_dict, DM_TABLE_START, &table_en->start); @@ -792,9 +797,7 @@ dm_table_load_ioctl(prop_dictionary_t dm_dict) dm_dev_unbusy(dmv); return ret; } - last_table = table_en; - free(str, M_TEMP); } prop_object_iterator_release(iter); |
