]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/md/dm-table.c
dm table: add always writeable feature
[karo-tx-linux.git] / drivers / md / dm-table.c
index 2ec3482e942a9f0b767f79cb45d5e857e225ec2e..9917141729ef4d3b0f2342f8e4cad4846a56a483 100644 (file)
@@ -774,6 +774,12 @@ int dm_table_add_target(struct dm_table *t, const char *type,
                t->singleton = 1;
        }
 
+       if (dm_target_always_writeable(tgt->type) && !(t->mode & FMODE_WRITE)) {
+               DMERR("%s: target type %s may not be included in read-only tables",
+                     dm_device_name(t->md), type);
+               return -EINVAL;
+       }
+
        tgt->table = t;
        tgt->begin = start;
        tgt->len = len;