1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

If _create_and_load_v4 fails part way through, revert the creation.

This commit is contained in:
Alasdair Kergon 2006-03-30 15:15:47 +00:00
parent d648832a2d
commit c01a800a6b
2 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.04 - Version 1.02.04 -
============================ ============================
If _create_and_load_v4 fails part way through, revert the creation.
dmeventd thread/fifo fixes. dmeventd thread/fifo fixes.
Add file & line to dm_strdup_aux(). Add file & line to dm_strdup_aux().
Add setgeometry. Add setgeometry.

View File

@ -1383,7 +1383,7 @@ static int _create_and_load_v4(struct dm_task *dmt)
task->tail = NULL; task->tail = NULL;
dm_task_destroy(task); dm_task_destroy(task);
if (!r) if (!r)
return r; goto revert;
/* Use the original structure last so the info will be correct */ /* Use the original structure last so the info will be correct */
dmt->type = DM_DEVICE_RESUME; dmt->type = DM_DEVICE_RESUME;
@ -1392,6 +1392,17 @@ static int _create_and_load_v4(struct dm_task *dmt)
r = dm_task_run(dmt); r = dm_task_run(dmt);
if (r)
return r;
revert:
dmt->type = DM_DEVICE_REMOVE;
dm_free(dmt->uuid);
dmt->uuid = NULL;
if (!dm_task_run(dmt))
log_error("Failed to revert device creation.");
return r; return r;
} }