]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/md/dm-ioctl.c
Merge ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
[linux-2.6-omap-h63xx.git] / drivers / md / dm-ioctl.c
index 54ec737195e00f9043a8db9dbc04aff0df09e40f..561bda5011e00e07f2d0a80e8aa5d147f81cd023 100644 (file)
@@ -270,6 +270,7 @@ static int dm_hash_rename(const char *old, const char *new)
 {
        char *new_name, *old_name;
        struct hash_cell *hc;
+       struct dm_table *table;
 
        /*
         * duplicate new.
@@ -317,6 +318,15 @@ static int dm_hash_rename(const char *old, const char *new)
        /* rename the device node in devfs */
        register_with_devfs(hc);
 
+       /*
+        * Wake up any dm event waiters.
+        */
+       table = dm_get_table(hc->md);
+       if (table) {
+               dm_table_event(table);
+               dm_table_put(table);
+       }
+
        up_write(&_hash_lock);
        kfree(old_name);
        return 0;
@@ -425,8 +435,8 @@ static void list_version_get_needed(struct target_type *tt, void *needed_param)
 {
     size_t *needed = needed_param;
 
+    *needed += sizeof(struct dm_target_versions);
     *needed += strlen(tt->name);
-    *needed += sizeof(tt->version);
     *needed += ALIGN_MASK;
 }
 
@@ -683,14 +693,18 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size)
 static int do_suspend(struct dm_ioctl *param)
 {
        int r = 0;
+       int do_lockfs = 1;
        struct mapped_device *md;
 
        md = find_device(param);
        if (!md)
                return -ENXIO;
 
+       if (param->flags & DM_SKIP_LOCKFS_FLAG)
+               do_lockfs = 0;
+
        if (!dm_suspended(md))
-               r = dm_suspend(md);
+               r = dm_suspend(md, do_lockfs);
 
        if (!r)
                r = __dev_status(md, param);
@@ -702,6 +716,7 @@ static int do_suspend(struct dm_ioctl *param)
 static int do_resume(struct dm_ioctl *param)
 {
        int r = 0;
+       int do_lockfs = 1;
        struct hash_cell *hc;
        struct mapped_device *md;
        struct dm_table *new_map;
@@ -727,8 +742,10 @@ static int do_resume(struct dm_ioctl *param)
        /* Do we need to load a new map ? */
        if (new_map) {
                /* Suspend if it isn't already suspended */
+               if (param->flags & DM_SKIP_LOCKFS_FLAG)
+                       do_lockfs = 0;
                if (!dm_suspended(md))
-                       dm_suspend(md);
+                       dm_suspend(md, do_lockfs);
 
                r = dm_swap_table(md, new_map);
                if (r) {
@@ -974,6 +991,7 @@ static int table_load(struct dm_ioctl *param, size_t param_size)
        if (!hc) {
                DMWARN("device doesn't appear to be in the dev hash table.");
                up_write(&_hash_lock);
+               dm_table_put(t);
                return -ENXIO;
        }