Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273317
b: refs/heads/master
c: cc6cbe1
h: refs/heads/master
i:
  273315: c867056
v: v3
  • Loading branch information
Alasdair G Kergon committed Oct 31, 2011
1 parent 4562079 commit 4297d27
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3791e2fc0e4b40d4188e79b0a99bfa6bce714a10
refs/heads/master: cc6cbe141a20f6d876b161b60af38d93935bfa85
6 changes: 6 additions & 0 deletions trunk/drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/device-mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ struct target_type {
#define DM_TARGET_SINGLETON 0x00000001
#define dm_target_needs_singleton(type) ((type)->features & DM_TARGET_SINGLETON)

/*
* Indicates that a target does not support read-only devices.
*/
#define DM_TARGET_ALWAYS_WRITEABLE 0x00000002
#define dm_target_always_writeable(type) \
((type)->features & DM_TARGET_ALWAYS_WRITEABLE)

struct dm_target {
struct dm_table *table;
struct target_type *type;
Expand Down

0 comments on commit 4297d27

Please sign in to comment.