Skip to content

Commit

Permalink
dm ioctl: forbid messages to devices being deleted
Browse files Browse the repository at this point in the history
Once we begin deleting a device, prevent any further messages being sent
to targets of its table (to avoid races).

Signed-off-by: Mike Anderson <andmike@linux.vnet.ibm.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Mike Anderson authored and Alasdair G Kergon committed Dec 10, 2009
1 parent 432a212 commit c50abeb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/md/dm-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,11 @@ static int target_message(struct dm_ioctl *param, size_t param_size)
if (!table)
goto out_argv;

if (dm_deleting_md(md)) {
r = -ENXIO;
goto out_table;
}

ti = dm_table_find_target(table, tmsg->sector);
if (!dm_target_is_valid(ti)) {
DMWARN("Target message sector outside device.");
Expand All @@ -1314,6 +1319,7 @@ static int target_message(struct dm_ioctl *param, size_t param_size)
r = -EINVAL;
}

out_table:
dm_table_put(table);
out_argv:
kfree(argv);
Expand Down

0 comments on commit c50abeb

Please sign in to comment.