diff options
author | Dave Wysochanski <dwysocha@redhat.com> | 2009-09-15 01:38:59 +0000 |
---|---|---|
committer | Dave Wysochanski <dwysocha@redhat.com> | 2009-09-15 01:38:59 +0000 |
commit | 266214db845d24f010d9c40e4cf5c4ac606d9d21 (patch) | |
tree | e9abdd9ba4f848ab72fabd9984c4f46f80886546 | |
parent | 90c8088760d5fd46ad9f5edb58482a491be53f26 (diff) | |
download | lvm2-266214db845d24f010d9c40e4cf5c4ac606d9d21.tar.gz |
Fix process_each_vg / _process_one_vg when vg_read() returns FAILED_LOCKING.
Remove the checks for vg_read_error() in most of the tools callback
functions and instead make the check in _process_one_vg() more general.
In all but vgcfgbackup, we do not want to proceed if we get any error
from vg_read(). In vgcfgbackup's case, we may proceed if the backup
is to proceed with inconsistent VGs. This is a special case though,
and we mark it with the READ_ALLOW_INCONSISTENT flag passed to
process_each_vg (and subsequently to _process_one_vg).
NOTE: More cleanup is needed in the vg_read_error() path cases.
This patch is a start.
-rw-r--r-- | WHATS_NEW | 2 | ||||
-rw-r--r-- | tools/polldaemon.c | 5 | ||||
-rw-r--r-- | tools/reporter.c | 5 | ||||
-rw-r--r-- | tools/toollib.c | 13 | ||||
-rw-r--r-- | tools/vgcfgbackup.c | 2 | ||||
-rw-r--r-- | tools/vgchange.c | 5 | ||||
-rw-r--r-- | tools/vgck.c | 5 | ||||
-rw-r--r-- | tools/vgconvert.c | 5 | ||||
-rw-r--r-- | tools/vgdisplay.c | 5 | ||||
-rw-r--r-- | tools/vgexport.c | 3 | ||||
-rw-r--r-- | tools/vgimport.c | 3 | ||||
-rw-r--r-- | tools/vgremove.c | 5 | ||||
-rw-r--r-- | tools/vgscan.c | 5 |
13 files changed, 12 insertions, 51 deletions
@@ -1,8 +1,10 @@ Version 2.02.52 - ================================= + Update _process_one_vg to cleanup properly after vg_read_error. Add lots of missing stack debug messages to tools. Make readonly locking available as locking type 4. Fix readonly locking to permit writeable global locks (for vgscan). (2.02.49) + Add lvm_vg_is_clustered, lvm_vg_is_exported, and lvm_vg_is_partial. Add manpage entry for dmsetup's udevcomplete_all and udevcookies commands. Add DM_UDEV_RULES_VSN udev enviroment variable. Check that udev is running and set internal state appropriately. diff --git a/tools/polldaemon.c b/tools/polldaemon.c index bd2ac20fb..6b7cd5bd0 100644 --- a/tools/polldaemon.c +++ b/tools/polldaemon.c @@ -185,11 +185,6 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname, const char *name; int finished; - if (vg_read_error(vg)) { - stack; - return ECMD_FAILED; - } - dm_list_iterate_items(lvl, &vg->lvs) { lv_mirr = lvl->lv; if (!(lv_mirr->status & parms->lv_type)) diff --git a/tools/reporter.c b/tools/reporter.c index b200a9647..1e936896e 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -20,11 +20,6 @@ static int _vgs_single(struct cmd_context *cmd __attribute((unused)), const char *vg_name, struct volume_group *vg, void *handle) { - if (vg_read_error(vg)) { - stack; - return ECMD_FAILED; - } - if (!report_object(handle, vg, NULL, NULL, NULL, NULL)) { stack; return ECMD_FAILED; diff --git a/tools/toollib.c b/tools/toollib.c index d45e3a01c..cb1ebf619 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -433,10 +433,11 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, vg = vg_read(cmd, vg_name, vgid, flags); /* Allow FAILED_INCONSISTENT through only for vgcfgrestore */ - if (vg_read_error(vg) && (vg_read_error(vg) != FAILED_INCONSISTENT)) { - vg_release(vg); + if (vg_read_error(vg) && + !((vg_read_error(vg) == FAILED_INCONSISTENT)&&(flags & READ_ALLOW_INCONSISTENT))) { + ret_max = ECMD_FAILED; stack; - return ECMD_FAILED; + goto out; } if (!dm_list_empty(tags)) { @@ -451,7 +452,11 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, ret_max = ret; out: - unlock_and_release_vg(cmd, vg, vg_name); + if ((vg_read_error(vg) == FAILED_ALLOCATION)|| + (vg_read_error(vg) == FAILED_LOCKING)) + vg_release(vg); + else + unlock_and_release_vg(cmd, vg, vg_name); return ret_max; } diff --git a/tools/vgcfgbackup.c b/tools/vgcfgbackup.c index 4c61714e3..2be394936 100644 --- a/tools/vgcfgbackup.c +++ b/tools/vgcfgbackup.c @@ -92,7 +92,7 @@ int vgcfgbackup(struct cmd_context *cmd, int argc, char **argv) init_pvmove(1); - ret = process_each_vg(cmd, argc, argv, 0, + ret = process_each_vg(cmd, argc, argv, READ_ALLOW_INCONSISTENT, &last_filename, &vg_backup_single); dm_free(last_filename); diff --git a/tools/vgchange.c b/tools/vgchange.c index 8a3c2031e..c74116caf 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -496,11 +496,6 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name, { int r = ECMD_FAILED; - if (vg_read_error(vg)) { - stack; - return ECMD_FAILED; - } - if (vg_is_exported(vg)) { log_error("Volume group \"%s\" is exported", vg_name); return ECMD_FAILED; diff --git a/tools/vgck.c b/tools/vgck.c index 690e48d61..c8cad45b9 100644 --- a/tools/vgck.c +++ b/tools/vgck.c @@ -21,11 +21,6 @@ static int vgck_single(struct cmd_context *cmd __attribute((unused)), struct volume_group *vg, void *handle __attribute((unused))) { - if (vg_read_error(vg)) { - stack; - return ECMD_FAILED; - } - if (!vg_check_status(vg, EXPORTED_VG)) { stack; return ECMD_FAILED; diff --git a/tools/vgconvert.c b/tools/vgconvert.c index 2263baa44..2c41402ed 100644 --- a/tools/vgconvert.c +++ b/tools/vgconvert.c @@ -32,11 +32,6 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name, struct lvinfo info; int active = 0; - if (vg_read_error(vg)) { - stack; - return ECMD_FAILED; - } - if (!vg_check_status(vg, LVM_WRITE | EXPORTED_VG)) { stack; return ECMD_FAILED; diff --git a/tools/vgdisplay.c b/tools/vgdisplay.c index 3876d3511..06965bf56 100644 --- a/tools/vgdisplay.c +++ b/tools/vgdisplay.c @@ -20,11 +20,6 @@ static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name, void *handle __attribute((unused))) { /* FIXME Do the active check here if activevolumegroups_ARG ? */ - if (vg_read_error(vg)) { - stack; - return ECMD_FAILED; - } - vg_check_status(vg, EXPORTED_VG); if (arg_count(cmd, colon_ARG)) { diff --git a/tools/vgexport.c b/tools/vgexport.c index e3b1890eb..df7f23771 100644 --- a/tools/vgexport.c +++ b/tools/vgexport.c @@ -23,9 +23,6 @@ static int vgexport_single(struct cmd_context *cmd __attribute((unused)), struct pv_list *pvl; struct physical_volume *pv; - if (vg_read_error(vg)) - goto_bad; - if (lvs_in_vg_activated(vg)) { log_error("Volume group \"%s\" has active logical volumes", vg_name); diff --git a/tools/vgimport.c b/tools/vgimport.c index 7eeb5db3f..ee8e40a3d 100644 --- a/tools/vgimport.c +++ b/tools/vgimport.c @@ -23,9 +23,6 @@ static int vgimport_single(struct cmd_context *cmd __attribute((unused)), struct pv_list *pvl; struct physical_volume *pv; - if (vg_read_error(vg)) - goto_bad; - if (!vg_is_exported(vg)) { log_error("Volume group \"%s\" is not exported", vg_name); goto bad; diff --git a/tools/vgremove.c b/tools/vgremove.c index c5b5dcfe9..bc29d9992 100644 --- a/tools/vgremove.c +++ b/tools/vgremove.c @@ -22,11 +22,6 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name, unsigned lv_count; force_t force; - if (vg_read_error(vg)) { - stack; - return ECMD_FAILED; - } - if (!vg_check_status(vg, EXPORTED_VG)) { stack; return ECMD_FAILED; diff --git a/tools/vgscan.c b/tools/vgscan.c index c0f079082..b8971adc1 100644 --- a/tools/vgscan.c +++ b/tools/vgscan.c @@ -19,11 +19,6 @@ static int vgscan_single(struct cmd_context *cmd, const char *vg_name, struct volume_group *vg, void *handle __attribute((unused))) { - if (vg_read_error(vg)) { - stack; - return ECMD_FAILED; - } - log_print("Found %svolume group \"%s\" using metadata type %s", vg_is_exported(vg) ? "exported " : "", vg_name, vg->fid->fmt->name); |