From cc6cbe141a20f6d876b161b60af38d93935bfa85 Mon Sep 17 00:00:00 2001 From: Alasdair G Kergon Date: Mon, 31 Oct 2011 20:19:02 +0000 Subject: dm table: add always writeable feature Add a target feature flag DM_TARGET_ALWAYS_WRITEABLE to indicate that a target does not support read-only mode. The initial implementation of the thin provisioning target uses this. Signed-off-by: Alasdair G Kergon --- drivers/md/dm-table.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/md/dm-table.c') diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 2ec3482e942a..9917141729ef 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -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; -- cgit v1.2.3