summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2009-12-10 23:52:23 +0000
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 23:52:23 +0000
commita794015597a2d9b437470c7692aac77e5fc08cd2 (patch)
treed25dd56edd53f8f1890ed005b5531ccfa07c28ee /drivers/md/dm-table.c
parent1d0f3ce83200edc5d43723c77c62b09ad6560294 (diff)
downloadop-kernel-dev-a794015597a2d9b437470c7692aac77e5fc08cd2.zip
op-kernel-dev-a794015597a2d9b437470c7692aac77e5fc08cd2.tar.gz
dm: bind new table before destroying old
When replacing a mapped device's table during a 'resume', delay the destruction of the old table until the new one is successfully in place. This will make it easier for a later patch to transfer internal state information from the old table to the new one (something we do not currently support) while giving us more options for reversion if a later part of the operation fails. Devices are always in the suspended state during dm_swap_table(). This patch reinforces the requirement that all I/O must have been flushed from the table targets while in this state (including any in workqueues). In the case of 'noflush' suspending, unprocessed I/O should have been 'pushed back' to the dm core prior to this point, for resubmission after the new table is in place. Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 1a6cb3c..3162b9c 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -237,6 +237,9 @@ void dm_table_destroy(struct dm_table *t)
{
unsigned int i;
+ if (!t)
+ return;
+
while (atomic_read(&t->holders))
msleep(1);
smp_mb();
OpenPOWER on IntegriCloud