From agk@sourceware.org Thu Mar 8 19:22:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 08 Mar 2007 19:22:00 -0000 Subject: LVM2 ./WHATS_NEW lib/config/config.c Message-ID: <20070308192253.25516.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-08 19:22:52 Modified files: . : WHATS_NEW lib/config : config.c Log message: Fix two more segfaults if an empty config file section encountered. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.577&r2=1.578 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.53&r2=1.54 --- LVM2/WHATS_NEW 2007/02/28 18:27:11 1.577 +++ LVM2/WHATS_NEW 2007/03/08 19:22:52 1.578 @@ -1,5 +1,6 @@ Version 2.02.23 - ==================================== + Fix two more segfaults if an empty config file section encountered. Move .cache file into a new /etc/lvm/cache directory by default. Add devices/cache_dir & devices/cache_file_prefix, deprecating devices/cache. Create directory in fcntl_lock_file() if required. --- LVM2/lib/config/config.c 2007/01/25 14:37:47 1.53 +++ LVM2/lib/config/config.c 2007/03/08 19:22:52 1.54 @@ -878,7 +878,7 @@ { const struct config_node *n = _find_first_config_node(cn1, cn2, path); - if (n && n->v->type == CFG_INT) { + if (n && n->v && n->v->type == CFG_INT) { log_very_verbose("Setting %s to %d", path, n->v->v.i); return n->v->v.i; } @@ -899,7 +899,7 @@ { const struct config_node *n = _find_first_config_node(cn1, cn2, path); - if (n && n->v->type == CFG_FLOAT) { + if (n && n->v && n->v->type == CFG_FLOAT) { log_very_verbose("Setting %s to %f", path, n->v->v.r); return n->v->v.r; } From agk@sourceware.org Thu Mar 8 19:58:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 08 Mar 2007 19:58:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/dev_manager.c Message-ID: <20070308195805.9948.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-08 19:58:04 Modified files: . : WHATS_NEW lib/activate : dev_manager.c Log message: Remove no-longer-used uuid_out parameter from activation info functions. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.578&r2=1.579 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.120&r2=1.121 --- LVM2/WHATS_NEW 2007/03/08 19:22:52 1.578 +++ LVM2/WHATS_NEW 2007/03/08 19:58:04 1.579 @@ -1,5 +1,6 @@ Version 2.02.23 - ==================================== + Remove no-longer-used uuid_out parameter from activation info functions. Fix two more segfaults if an empty config file section encountered. Move .cache file into a new /etc/lvm/cache directory by default. Add devices/cache_dir & devices/cache_file_prefix, deprecating devices/cache. --- LVM2/lib/activate/dev_manager.c 2007/01/25 23:03:47 1.120 +++ LVM2/lib/activate/dev_manager.c 2007/03/08 19:58:04 1.121 @@ -118,12 +118,10 @@ } static int _info_run(const char *name, const char *dlid, struct dm_info *info, - int mknodes, int with_open_count, struct dm_pool *mem, - char **uuid_out) + int mknodes, int with_open_count) { int r = 0; struct dm_task *dmt; - const char *u; int dmtask; dmtask = mknodes ? DM_DEVICE_MKNODES : DM_DEVICE_INFO; @@ -143,11 +141,6 @@ if (!dm_task_get_info(dmt, info)) goto_out; - if (info->exists && uuid_out) { - if (!(u = dm_task_get_uuid(dmt))) - goto_out; - *uuid_out = dm_pool_strdup(mem, u); - } r = 1; out: @@ -208,23 +201,20 @@ } static int _info(const char *name, const char *dlid, int mknodes, - int with_open_count, struct dm_info *info, - struct dm_pool *mem, char **uuid_out) + int with_open_count, struct dm_info *info) { if (!mknodes && dlid && *dlid) { - if (_info_run(NULL, dlid, info, 0, with_open_count, mem, - uuid_out) && + if (_info_run(NULL, dlid, info, 0, with_open_count) && info->exists) return 1; else if (_info_run(NULL, dlid + sizeof(UUID_PREFIX) - 1, info, - 0, with_open_count, mem, uuid_out) && + 0, with_open_count) && info->exists) return 1; } if (name) - return _info_run(name, NULL, info, mknodes, with_open_count, - mem, uuid_out); + return _info_run(name, NULL, info, mknodes, with_open_count); return 0; } @@ -240,8 +230,7 @@ return 0; } - return _info(name, dlid, with_mknodes, with_open_count, info, - NULL, NULL); + return _info(name, dlid, with_mknodes, with_open_count, info); } /* FIXME Interface must cope with multiple targets */ @@ -646,7 +635,7 @@ return_0; log_debug("Getting device info for %s [%s]", name, dlid); - if (!_info(name, dlid, 0, 1, &info, dm->mem, NULL)) { + if (!_info(name, dlid, 0, 1, &info)) { log_error("Failed to get info for %s [%s].", name, dlid); return 0; } From agk@sourceware.org Thu Mar 8 21:08:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 08 Mar 2007 21:08:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/a ... Message-ID: <20070308210826.22625.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-08 21:08:25 Modified files: . : WHATS_NEW lib/activate : activate.c activate.h tools : vgrename.c Log message: Fix vgrename active LV check to ignore differing vgids. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.579&r2=1.580 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.120&r2=1.121 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.54&r2=1.55 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42 --- LVM2/WHATS_NEW 2007/03/08 19:58:04 1.579 +++ LVM2/WHATS_NEW 2007/03/08 21:08:25 1.580 @@ -1,5 +1,6 @@ Version 2.02.23 - ==================================== + Fix vgrename active LV check to ignore differing vgids. Remove no-longer-used uuid_out parameter from activation info functions. Fix two more segfaults if an empty config file section encountered. Move .cache file into a new /etc/lvm/cache directory by default. --- LVM2/lib/activate/activate.c 2007/01/24 23:43:27 1.120 +++ LVM2/lib/activate/activate.c 2007/03/08 21:08:25 1.121 @@ -168,6 +168,10 @@ { return 0; } +int lvs_in_vg_activated_by_uuid_only(struct volume_group *vg); +{ + return 0; +} int lvs_in_vg_opened(struct volume_group *vg) { return 0; @@ -421,21 +425,23 @@ * Returns 1 if info structure populated, else 0 on failure. */ static int _lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int with_mknodes, - struct lvinfo *info, int with_open_count) + struct lvinfo *info, int with_open_count, unsigned by_uuid_only) { struct dm_info dminfo; - char *name; + char *name = NULL; if (!activation()) return 0; - if (!(name = build_dm_name(cmd->mem, lv->vg->name, lv->name, NULL))) + if (!by_uuid_only && + !(name = build_dm_name(cmd->mem, lv->vg->name, lv->name, NULL))) return_0; log_debug("Getting device info for %s", name); if (!dev_manager_info(lv->vg->cmd->mem, name, lv, with_mknodes, with_open_count, &dminfo)) { - dm_pool_free(cmd->mem, name); + if (name) + dm_pool_free(cmd->mem, name); return_0; } @@ -448,14 +454,16 @@ info->live_table = dminfo.live_table; info->inactive_table = dminfo.inactive_table; - dm_pool_free(cmd->mem, name); + if (name) + dm_pool_free(cmd->mem, name); + return 1; } int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, struct lvinfo *info, int with_open_count) { - return _lv_info(cmd, lv, 0, info, with_open_count); + return _lv_info(cmd, lv, 0, info, with_open_count, 0); } int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, @@ -466,7 +474,7 @@ if (!(lv = lv_from_lvid(cmd, lvid_s, 0))) return 0; - return _lv_info(cmd, lv, 0, info, with_open_count); + return _lv_info(cmd, lv, 0, info, with_open_count, 0); } /* @@ -519,11 +527,12 @@ return r; } -static int _lv_active(struct cmd_context *cmd, struct logical_volume *lv) +static int _lv_active(struct cmd_context *cmd, struct logical_volume *lv, + unsigned by_uuid_only) { struct lvinfo info; - if (!lv_info(cmd, lv, &info, 0)) { + if (!_lv_info(cmd, lv, 0, &info, 0, by_uuid_only)) { stack; return -1; } @@ -607,7 +616,7 @@ * These two functions return the number of visible LVs in the state, * or -1 on error. */ -int lvs_in_vg_activated(struct volume_group *vg) +static int _lvs_in_vg_activated(struct volume_group *vg, unsigned by_uuid_only) { struct lv_list *lvl; int count = 0; @@ -617,12 +626,22 @@ list_iterate_items(lvl, &vg->lvs) { if (lvl->lv->status & VISIBLE_LV) - count += (_lv_active(vg->cmd, lvl->lv) == 1); + count += (_lv_active(vg->cmd, lvl->lv, by_uuid_only) == 1); } return count; } +int lvs_in_vg_activated_by_uuid_only(struct volume_group *vg) +{ + return _lvs_in_vg_activated(vg, 1); +} + +int lvs_in_vg_activated(struct volume_group *vg) +{ + return _lvs_in_vg_activated(vg, 0); +} + int lvs_in_vg_opened(struct volume_group *vg) { struct lv_list *lvl; @@ -973,7 +992,7 @@ return r; } - if (!_lv_info(cmd, lv, 1, &info, 0)) + if (!_lv_info(cmd, lv, 1, &info, 0, 0)) return_0; if (info.exists) --- LVM2/lib/activate/activate.h 2007/01/25 21:22:30 1.54 +++ LVM2/lib/activate/activate.h 2007/03/08 21:08:25 1.55 @@ -83,6 +83,7 @@ * Return number of LVs in the VG that are active. */ int lvs_in_vg_activated(struct volume_group *vg); +int lvs_in_vg_activated_by_uuid_only(struct volume_group *vg); int lvs_in_vg_opened(struct volume_group *vg); --- LVM2/tools/vgrename.c 2006/09/02 01:18:17 1.41 +++ LVM2/tools/vgrename.c 2007/03/08 21:08:25 1.42 @@ -118,7 +118,7 @@ return ECMD_FAILED; } - if (lvs_in_vg_activated(vg_old)) { + if (lvs_in_vg_activated_by_uuid_only(vg_old)) { unlock_vg(cmd, vg_name_old); log_error("Volume group \"%s\" still has active LVs", vg_name_old); From agk@sourceware.org Thu Mar 8 21:28:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 08 Mar 2007 21:28:00 -0000 Subject: LVM2 VERSION WHATS_NEW Message-ID: <20070308212814.32176.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-08 21:28:13 Modified files: . : VERSION WHATS_NEW Log message: pre-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.146&r2=1.147 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.580&r2=1.581 --- LVM2/VERSION 2007/02/13 16:10:14 1.146 +++ LVM2/VERSION 2007/03/08 21:28:13 1.147 @@ -1 +1 @@ -2.02.23-cvs (2007-02-13) +2.02.23-cvs (2007-03-08) --- LVM2/WHATS_NEW 2007/03/08 21:08:25 1.580 +++ LVM2/WHATS_NEW 2007/03/08 21:28:13 1.581 @@ -1,4 +1,4 @@ -Version 2.02.23 - +Version 2.02.23 - 8th March 2008 ==================================== Fix vgrename active LV check to ignore differing vgids. Remove no-longer-used uuid_out parameter from activation info functions. From agk@sourceware.org Thu Mar 8 21:37:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 08 Mar 2007 21:37:00 -0000 Subject: LVM2 VERSION WHATS_NEW Message-ID: <20070308213749.2985.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-08 21:37:48 Modified files: . : VERSION WHATS_NEW Log message: post-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.147&r2=1.148 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.581&r2=1.582 --- LVM2/VERSION 2007/03/08 21:28:13 1.147 +++ LVM2/VERSION 2007/03/08 21:37:48 1.148 @@ -1 +1 @@ -2.02.23-cvs (2007-03-08) +2.02.24-cvs (2007-03-08) --- LVM2/WHATS_NEW 2007/03/08 21:28:13 1.581 +++ LVM2/WHATS_NEW 2007/03/08 21:37:48 1.582 @@ -1,5 +1,8 @@ -Version 2.02.23 - 8th March 2008 +Version 2.02.24 - ==================================== + +Version 2.02.23 - 8th March 2007 +================================ Fix vgrename active LV check to ignore differing vgids. Remove no-longer-used uuid_out parameter from activation info functions. Fix two more segfaults if an empty config file section encountered. From agk@sourceware.org Fri Mar 9 20:47:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 09 Mar 2007 20:47:00 -0000 Subject: LVM2 ./WHATS_NEW tools/lvcreate.c tools/lvrena ... Message-ID: <20070309204742.19653.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-09 20:47:41 Modified files: . : WHATS_NEW tools : lvcreate.c lvrename.c pvmove.c toollib.c toollib.h vgcfgrestore.c vgcreate.c vgextend.c vgmerge.c vgreduce.c vgrename.c Log message: Support the /dev/mapper prefix on most command lines. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.582&r2=1.583 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.132&r2=1.133 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvrename.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.96&r2=1.97 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.44&r2=1.45 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcfgrestore.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43 --- LVM2/WHATS_NEW 2007/03/08 21:37:48 1.582 +++ LVM2/WHATS_NEW 2007/03/09 20:47:41 1.583 @@ -1,5 +1,6 @@ Version 2.02.24 - ==================================== + Support the /dev/mapper prefix on most command lines. Version 2.02.23 - 8th March 2007 ================================ --- LVM2/tools/lvcreate.c 2007/01/10 14:13:46 1.132 +++ LVM2/tools/lvcreate.c 2007/03/09 20:47:41 1.133 @@ -95,7 +95,7 @@ } } else { - vg_name = skip_dev_dir(cmd, argv[0]); + vg_name = skip_dev_dir(cmd, argv[0], NULL); if (strrchr(vg_name, '/')) { log_error("Volume group name expected " "(no slash)"); --- LVM2/tools/lvrename.c 2007/01/12 20:38:30 1.41 +++ LVM2/tools/lvrename.c 2007/03/09 20:47:41 1.42 @@ -29,7 +29,7 @@ struct lv_list *lvl; if (argc == 3) { - vg_name = skip_dev_dir(cmd, argv[0]); + vg_name = skip_dev_dir(cmd, argv[0], NULL); lv_name_old = argv[1]; lv_name_new = argv[2]; if (strchr(lv_name_old, '/') && --- LVM2/tools/pvmove.c 2006/09/02 01:18:17 1.32 +++ LVM2/tools/pvmove.c 2007/03/09 20:47:41 1.33 @@ -27,7 +27,7 @@ if (!strchr(arg, '/')) return arg; - lvname = skip_dev_dir(cmd, arg); + lvname = skip_dev_dir(cmd, arg, NULL); while (*lvname == '/') lvname++; if (!strchr(lvname, '/')) { --- LVM2/tools/toollib.c 2007/01/15 21:55:11 1.96 +++ LVM2/tools/toollib.c 2007/03/09 20:47:41 1.97 @@ -88,21 +88,53 @@ /* * Strip dev_dir if present */ -char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name) +char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name, + unsigned *dev_dir_found) { - /* FIXME Do this properly */ + const char *dmdir = dm_dir(); + size_t dmdir_len = strlen(dmdir), vglv_sz; + char *vgname, *lvname, *layer, *vglv; + /* FIXME Do this properly */ if (*vg_name == '/') { while (*vg_name == '/') vg_name++; vg_name--; } + /* Reformat string if /dev/mapper found */ + if (!strncmp(vg_name, dmdir, dmdir_len) && vg_name[dmdir_len] == '/') { + if (dev_dir_found) + *dev_dir_found = 1; + vg_name += dmdir_len; + while (*vg_name == '/') + vg_name++; + + if (!dm_split_lvm_name(cmd->mem, vg_name, &vgname, &lvname, &layer) || + *layer) { + log_error("skip_dev_dir: Couldn't split up device name %s", + vg_name); + return (char *) vg_name; + } + vglv_sz = strlen(vgname) + strlen(lvname) + 2; + if (!(vglv = dm_pool_alloc(cmd->mem, vglv_sz)) || + dm_snprintf(vglv, vglv_sz, "%s%s%s", vgname, + *lvname ? "/" : "", + lvname) < 0) { + log_error("vg/lv string alloc failed"); + return (char *) vg_name; + } + return vglv; + } + if (!strncmp(vg_name, cmd->dev_dir, strlen(cmd->dev_dir))) { + if (dev_dir_found) + *dev_dir_found = 1; vg_name += strlen(cmd->dev_dir); while (*vg_name == '/') vg_name++; - } + } else if (dev_dir_found) + *dev_dir_found = 0; return (char *) vg_name; } @@ -222,7 +254,7 @@ for (; opt < argc; opt++) { const char *lv_name = argv[opt]; char *vgname_def; - int dev_dir_found = 0; + unsigned dev_dir_found = 0; /* Do we have a tag or vgname or lvname? */ vgname = lv_name; @@ -243,18 +275,8 @@ } /* FIXME Jumbled parsing */ - if (*vgname == '/') { - while (*vgname == '/') - vgname++; - vgname--; - } - if (!strncmp(vgname, cmd->dev_dir, - strlen(cmd->dev_dir))) { - vgname += strlen(cmd->dev_dir); - dev_dir_found = 1; - while (*vgname == '/') - vgname++; - } + vgname = skip_dev_dir(cmd, vgname, &dev_dir_found); + if (*vgname == '/') { log_error("\"%s\": Invalid path for Logical " "Volume", argv[opt]); @@ -528,7 +550,7 @@ continue; } - vg_name = skip_dev_dir(cmd, vg_name); + vg_name = skip_dev_dir(cmd, vg_name, NULL); if (strchr(vg_name, '/')) { log_error("Invalid volume group name: %s", vg_name); @@ -830,7 +852,7 @@ if (!vg_path) return 0; - vg_path = skip_dev_dir(cmd, vg_path); + vg_path = skip_dev_dir(cmd, vg_path, NULL); if (strchr(vg_path, '/')) { log_error("Environment Volume Group in LVM_VG_NAME invalid: " --- LVM2/tools/toollib.h 2006/11/03 21:07:15 1.44 +++ LVM2/tools/toollib.h 2007/03/09 20:47:41 1.45 @@ -76,7 +76,8 @@ char *default_vgname(struct cmd_context *cmd); const char *extract_vgname(struct cmd_context *cmd, const char *lv_name); -char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name); +char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name, + unsigned *dev_dir_found); /* * Builds a list of pv's from the names in argv. Used in --- LVM2/tools/vgcfgrestore.c 2006/08/25 23:02:33 1.12 +++ LVM2/tools/vgcfgrestore.c 2007/03/09 20:47:41 1.13 @@ -24,7 +24,7 @@ return ECMD_FAILED; } - vg_name = skip_dev_dir(cmd, argv[0]); + vg_name = skip_dev_dir(cmd, argv[0], NULL); if (!validate_name(vg_name)) { log_error("Volume group name \"%s\" is invalid", vg_name); --- LVM2/tools/vgcreate.c 2006/08/25 23:02:33 1.47 +++ LVM2/tools/vgcreate.c 2007/03/09 20:47:41 1.48 @@ -38,7 +38,7 @@ return EINVALID_CMD_LINE; } - vg_name = skip_dev_dir(cmd, argv[0]); + vg_name = skip_dev_dir(cmd, argv[0], NULL); max_lv = arg_uint_value(cmd, maxlogicalvolumes_ARG, 0); max_pv = arg_uint_value(cmd, maxphysicalvolumes_ARG, 0); alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_NORMAL); --- LVM2/tools/vgextend.c 2006/09/02 01:18:17 1.27 +++ LVM2/tools/vgextend.c 2007/03/09 20:47:41 1.28 @@ -32,7 +32,7 @@ return EINVALID_CMD_LINE; } - vg_name = skip_dev_dir(cmd, argv[0]); + vg_name = skip_dev_dir(cmd, argv[0], NULL); argc--; argv++; --- LVM2/tools/vgmerge.c 2006/11/30 23:11:42 1.35 +++ LVM2/tools/vgmerge.c 2007/03/09 20:47:41 1.36 @@ -253,12 +253,12 @@ return EINVALID_CMD_LINE; } - vg_name_to = skip_dev_dir(cmd, argv[0]); + vg_name_to = skip_dev_dir(cmd, argv[0], NULL); argc--; argv++; for (; opt < argc; opt++) { - vg_name_from = skip_dev_dir(cmd, argv[opt]); + vg_name_from = skip_dev_dir(cmd, argv[opt], NULL); ret = _vgmerge_single(cmd, vg_name_to, vg_name_from); if (ret > ret_max) --- LVM2/tools/vgreduce.c 2007/01/31 16:26:23 1.56 +++ LVM2/tools/vgreduce.c 2007/03/09 20:47:41 1.57 @@ -461,7 +461,7 @@ return EINVALID_CMD_LINE; } - vg_name = skip_dev_dir(cmd, argv[0]); + vg_name = skip_dev_dir(cmd, argv[0], NULL); argv++; argc--; --- LVM2/tools/vgrename.c 2007/03/08 21:08:25 1.42 +++ LVM2/tools/vgrename.c 2007/03/09 20:47:41 1.43 @@ -35,8 +35,8 @@ return EINVALID_CMD_LINE; } - vg_name_old = skip_dev_dir(cmd, argv[0]); - vg_name_new = skip_dev_dir(cmd, argv[1]); + vg_name_old = skip_dev_dir(cmd, argv[0], NULL); + vg_name_new = skip_dev_dir(cmd, argv[1], NULL); dev_dir = cmd->dev_dir; length = strlen(dev_dir); From agk@sourceware.org Fri Mar 9 21:25:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 09 Mar 2007 21:25:00 -0000 Subject: LVM2 ./WHATS_NEW tools/vgextend.c tools/vgredu ... Message-ID: <20070309212534.1579.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-09 21:25:33 Modified files: . : WHATS_NEW tools : vgextend.c vgreduce.c vgsplit.c Log message: Add a few missing pieces of vgname command line validation. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.583&r2=1.584 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.57&r2=1.58 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.22&r2=1.23 --- LVM2/WHATS_NEW 2007/03/09 20:47:41 1.583 +++ LVM2/WHATS_NEW 2007/03/09 21:25:33 1.584 @@ -1,5 +1,6 @@ Version 2.02.24 - ==================================== + Add a few missing pieces of vgname command line validation. Support the /dev/mapper prefix on most command lines. Version 2.02.23 - 8th March 2007 --- LVM2/tools/vgextend.c 2007/03/09 20:47:41 1.28 +++ LVM2/tools/vgextend.c 2007/03/09 21:25:33 1.29 @@ -41,6 +41,12 @@ return ECMD_FAILED; } + if (!validate_name(vg_name)) { + log_error("Volume group name \"%s\" is invalid", + vg_name); + return ECMD_FAILED; + } + log_verbose("Checking for volume group \"%s\"", vg_name); if (!lock_vol(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) { unlock_vg(cmd, ORPHAN); --- LVM2/tools/vgreduce.c 2007/03/09 20:47:41 1.57 +++ LVM2/tools/vgreduce.c 2007/03/09 21:25:33 1.58 @@ -465,6 +465,12 @@ argv++; argc--; + if (!validate_name(vg_name)) { + log_error("Volume group name \"%s\" is invalid", + vg_name); + return ECMD_FAILED; + } + log_verbose("Finding volume group \"%s\"", vg_name); if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) { log_error("Can't get lock for %s", vg_name); --- LVM2/tools/vgsplit.c 2007/01/29 23:01:18 1.22 +++ LVM2/tools/vgsplit.c 2007/03/09 21:25:33 1.23 @@ -219,11 +219,17 @@ return EINVALID_CMD_LINE; } - vg_name_from = argv[0]; - vg_name_to = argv[1]; + vg_name_from = skip_dev_dir(cmd, argv[0], NULL); + vg_name_to = skip_dev_dir(cmd, argv[1], NULL); argc -= 2; argv += 2; + if (!validate_name(vg_name_from)) { + log_error("Volume group name \"%s\" is invalid", + vg_name_from); + return ECMD_FAILED; + } + if (!strcmp(vg_name_to, vg_name_from)) { log_error("Duplicate volume group name \"%s\"", vg_name_from); return ECMD_FAILED; From pcaulfield@sourceware.org Tue Mar 13 14:59:00 2007 From: pcaulfield@sourceware.org (pcaulfield@sourceware.org) Date: Tue, 13 Mar 2007 14:59:00 -0000 Subject: LVM2 ./WHATS_NEW lib/locking/no_locking.c Message-ID: <20070313145922.16499.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: pcaulfield@sourceware.org 2007-03-13 14:59:21 Modified files: . : WHATS_NEW lib/locking : no_locking.c Log message: Flag nolocking as a clustered locking module as we need to be able to look at clustered LVs at clvmd startup Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.584&r2=1.585 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/no_locking.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11 --- LVM2/WHATS_NEW 2007/03/09 21:25:33 1.584 +++ LVM2/WHATS_NEW 2007/03/13 14:59:21 1.585 @@ -2,6 +2,8 @@ ==================================== Add a few missing pieces of vgname command line validation. Support the /dev/mapper prefix on most command lines. + Flag nolocking as a clustered locking module as we need to be able + to look at clustered LVs at clvmd startup (2.02.10) Version 2.02.23 - 8th March 2007 ================================ --- LVM2/lib/locking/no_locking.c 2006/05/16 16:48:30 1.10 +++ LVM2/lib/locking/no_locking.c 2007/03/13 14:59:21 1.11 @@ -81,7 +81,7 @@ locking->lock_resource = _no_lock_resource; locking->reset_locking = _no_reset_locking; locking->fin_locking = _no_fin_locking; - locking->flags = 0; + locking->flags = LCK_CLUSTERED; return 1; } From agk@sourceware.org Thu Mar 15 13:38:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 15 Mar 2007 13:38:00 -0000 Subject: LVM2 ./WHATS_NEW lib/format1/import-extents.c Message-ID: <20070315133829.5607.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-15 13:38:28 Modified files: . : WHATS_NEW lib/format1 : import-extents.c Log message: Try to fix reading in of lvm1 striped LVs. There are two fixes other than improving variable names and updating code layout etc. The loop counter is incremented by area_len instead of area_len * stripes; the 3rd _check_stripe parameter is no longer multiplied by number of stripes. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.585&r2=1.586 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-extents.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32 --- LVM2/WHATS_NEW 2007/03/13 14:59:21 1.585 +++ LVM2/WHATS_NEW 2007/03/15 13:38:27 1.586 @@ -1,9 +1,9 @@ Version 2.02.24 - ==================================== + Fix reading of striped LVs in LVM1 format. + Flag nolocking as clustered so clvmd startup sees clustered LVs. (2.02.10) Add a few missing pieces of vgname command line validation. Support the /dev/mapper prefix on most command lines. - Flag nolocking as a clustered locking module as we need to be able - to look at clustered LVs at clvmd startup (2.02.10) Version 2.02.23 - 8th March 2007 ================================ --- LVM2/lib/format1/import-extents.c 2006/05/09 21:23:50 1.31 +++ LVM2/lib/format1/import-extents.c 2007/03/15 13:38:28 1.32 @@ -203,6 +203,19 @@ return 1; } +static uint32_t _area_length(struct lv_map *lvm, uint32_t le) +{ + uint32_t len = 0; + + do + len++; + while ((lvm->map[le + len].pv == lvm->map[le].pv) && + (lvm->map[le].pv && + lvm->map[le + len].pe == lvm->map[le].pe + len)); + + return len; +} + static int _read_linear(struct cmd_context *cmd, struct lv_map *lvm) { uint32_t le = 0, len; @@ -215,13 +228,7 @@ } while (le < lvm->lv->le_count) { - len = 0; - - do - len++; - while ((lvm->map[le + len].pv == lvm->map[le].pv) && - (lvm->map[le].pv && - lvm->map[le + len].pe == lvm->map[le].pe + len)); + len = _area_length(lvm, le); if (!(seg = alloc_lv_segment(cmd->mem, segtype, lvm->lv, le, len, 0, 0, NULL, 1, len, 0, 0, 0))) { @@ -230,10 +237,8 @@ } if (!set_lv_segment_area_pv(seg, 0, lvm->map[le].pv, - lvm->map[le].pe)) { - stack; - return 0; - } + lvm->map[le].pe)) + return_0; list_add(&lvm->lv->segments, &seg->list); @@ -244,7 +249,8 @@ } static int _check_stripe(struct lv_map *lvm, uint32_t area_count, - uint32_t seg_len, uint32_t base_le, uint32_t len) + uint32_t area_len, uint32_t base_le, + uint32_t total_area_len) { uint32_t st; @@ -252,11 +258,11 @@ * Is the next physical extent in every stripe adjacent to the last? */ for (st = 0; st < area_count; st++) - if ((lvm->map[base_le + st * len + seg_len].pv != - lvm->map[base_le + st * len].pv) || - (lvm->map[base_le + st * len].pv && - lvm->map[base_le + st * len + seg_len].pe != - lvm->map[base_le + st * len].pe + seg_len)) + if ((lvm->map[base_le + st * total_area_len + area_len].pv != + lvm->map[base_le + st * total_area_len].pv) || + (lvm->map[base_le + st * total_area_len].pv && + lvm->map[base_le + st * total_area_len + area_len].pe != + lvm->map[base_le + st * total_area_len].pe + area_len)) return 0; return 1; @@ -264,7 +270,7 @@ static int _read_stripes(struct cmd_context *cmd, struct lv_map *lvm) { - uint32_t st, le = 0, len; + uint32_t st, first_area_le = 0, total_area_len; uint32_t area_len; struct lv_segment *seg; struct segment_type *segtype; @@ -277,26 +283,25 @@ "with logical extent count (%u) for %s", lvm->stripes, lvm->lv->le_count, lvm->lv->name); } - len = lvm->lv->le_count / lvm->stripes; - if (!(segtype = get_segtype_from_string(cmd, "striped"))) { - stack; - return 0; - } + total_area_len = lvm->lv->le_count / lvm->stripes; + + if (!(segtype = get_segtype_from_string(cmd, "striped"))) + return_0; - while (le < len) { + while (first_area_le < total_area_len) { area_len = 1; /* - * Find how many blocks are contiguous in all stripes + * Find how many extents are contiguous in all stripes * and so can form part of this segment */ while (_check_stripe(lvm, lvm->stripes, - area_len * lvm->stripes, le, len)) + area_len, first_area_le, total_area_len)) area_len++; if (!(seg = alloc_lv_segment(cmd->mem, segtype, lvm->lv, - lvm->stripes * le, + lvm->stripes * first_area_le, lvm->stripes * area_len, 0, lvm->stripe_size, NULL, lvm->stripes, @@ -310,15 +315,13 @@ */ for (st = 0; st < seg->area_count; st++) if (!set_lv_segment_area_pv(seg, st, - lvm->map[le + st * len].pv, - lvm->map[le + st * len].pe)) { - stack; - return 0; - } + lvm->map[first_area_le + st * total_area_len].pv, + lvm->map[first_area_le + st * total_area_len].pe)) + return_0; list_add(&lvm->lv->segments, &seg->list); - le += seg->len; + first_area_le += area_len; } return 1; From mbroz@sourceware.org Thu Mar 15 14:00:00 2007 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Thu, 15 Mar 2007 14:00:00 -0000 Subject: LVM2 ./WHATS_NEW tools/vgremove.c Message-ID: <20070315140032.20347.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2007-03-15 14:00:31 Modified files: . : WHATS_NEW tools : vgremove.c Log message: Fix vgremove to require at least one vg argument. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.586&r2=1.587 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgremove.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38 --- LVM2/WHATS_NEW 2007/03/15 13:38:27 1.586 +++ LVM2/WHATS_NEW 2007/03/15 14:00:29 1.587 @@ -1,5 +1,6 @@ Version 2.02.24 - ==================================== + Fix vgremove to require at least one vg argument. Fix reading of striped LVs in LVM1 format. Flag nolocking as clustered so clvmd startup sees clustered LVs. (2.02.10) Add a few missing pieces of vgname command line validation. --- LVM2/tools/vgremove.c 2006/05/09 21:23:51 1.37 +++ LVM2/tools/vgremove.c 2007/03/15 14:00:30 1.38 @@ -87,6 +87,11 @@ { int ret; + if (!argc) { + log_error("Please enter one or more volume group paths"); + return EINVALID_CMD_LINE; + } + if (!lock_vol(cmd, ORPHAN, LCK_VG_WRITE)) { log_error("Can't get lock for orphan PVs"); return ECMD_FAILED; From mbroz@sourceware.org Fri Mar 16 17:15:00 2007 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Fri, 16 Mar 2007 17:15:00 -0000 Subject: LVM2 ./WHATS_NEW scripts/clvmd_init_rhel4 scri ... Message-ID: <20070316171536.30325.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2007-03-16 17:15:36 Modified files: . : WHATS_NEW scripts : clvmd_init_rhel4 lvm2_monitoring_init_rhel4 Log message: Fix processing of exit status in init scripts Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.587&r2=1.588 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/clvmd_init_rhel4.diff?cvsroot=lvm2&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/lvm2_monitoring_init_rhel4.diff?cvsroot=lvm2&r1=1.2&r2=1.3 --- LVM2/WHATS_NEW 2007/03/15 14:00:29 1.587 +++ LVM2/WHATS_NEW 2007/03/16 17:15:36 1.588 @@ -1,5 +1,6 @@ Version 2.02.24 - ==================================== + Fix processing of exit status in init scripts Fix vgremove to require at least one vg argument. Fix reading of striped LVs in LVM1 format. Flag nolocking as clustered so clvmd startup sees clustered LVs. (2.02.10) --- LVM2/scripts/clvmd_init_rhel4 2006/11/30 10:16:48 1.11 +++ LVM2/scripts/clvmd_init_rhel4 2007/03/16 17:15:36 1.12 @@ -43,16 +43,10 @@ then for vg in $LVM_VGS do - if ! action "Activating VG $vg:" $VGCHANGE -ayl $vg - then - rtrn=$? - fi + action "Activating VG $vg:" $VGCHANGE -ayl $vg || rtrn=$? done else - if ! action "Activating VGs:" $VGCHANGE -ayl - then - rtrn=$? - fi + action "Activating VGs:" $VGCHANGE -ayl || rtrn=$? fi done @@ -67,19 +61,13 @@ then for vg in $LVM_VGS do - if ! action "Deactivating VG $vg:" $VGCHANGE -anl $vg - then - rtrn=$? - fi + action "Deactivating VG $vg:" $VGCHANGE -anl $vg || rtrn=$? done else # Hack to only deactivate clustered volumes clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'` for vg in $clustervgs; do - if ! action "Deactivating VG $vg:" $VGCHANGE -anl $vg - then - rtrn=$? - fi + action "Deactivating VG $vg:" $VGCHANGE -anl $vg || rtrn=$? done fi --- LVM2/scripts/lvm2_monitoring_init_rhel4 2007/01/30 18:02:15 1.2 +++ LVM2/scripts/lvm2_monitoring_init_rhel4 2007/03/16 17:15:36 1.3 @@ -34,10 +34,7 @@ VGS=`vgs --noheadings -o name` for vg in $VGS do - if ! action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y $vg - then - ret=$? - fi + action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y $vg || ret=$? done return $ret @@ -55,10 +52,7 @@ VGS=`vgs --noheadings -o name` for vg in $VGS do - if ! action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n $vg - then - ret=$? - fi + action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n $vg || ret=$? done return $ret } From agk@sourceware.org Mon Mar 19 21:12:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 19 Mar 2007 21:12:00 -0000 Subject: LVM2 VERSION WHATS_NEW Message-ID: <20070319211254.16792.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-19 21:12:54 Modified files: . : VERSION WHATS_NEW Log message: pre-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.148&r2=1.149 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.588&r2=1.589 --- LVM2/VERSION 2007/03/08 21:37:48 1.148 +++ LVM2/VERSION 2007/03/19 21:12:54 1.149 @@ -1 +1 @@ -2.02.24-cvs (2007-03-08) +2.02.24-cvs (2007-03-19) --- LVM2/WHATS_NEW 2007/03/16 17:15:36 1.588 +++ LVM2/WHATS_NEW 2007/03/19 21:12:54 1.589 @@ -1,5 +1,5 @@ -Version 2.02.24 - -==================================== +Version 2.02.24 - 19th March 2007 +================================= Fix processing of exit status in init scripts Fix vgremove to require at least one vg argument. Fix reading of striped LVs in LVM1 format. From agk@sourceware.org Mon Mar 19 21:16:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 19 Mar 2007 21:16:00 -0000 Subject: LVM2 VERSION WHATS_NEW Message-ID: <20070319211650.19597.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-19 21:16:49 Modified files: . : VERSION WHATS_NEW Log message: post-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.149&r2=1.150 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.589&r2=1.590 --- LVM2/VERSION 2007/03/19 21:12:54 1.149 +++ LVM2/VERSION 2007/03/19 21:16:49 1.150 @@ -1 +1 @@ -2.02.24-cvs (2007-03-19) +2.02.25-cvs (2007-03-19) --- LVM2/WHATS_NEW 2007/03/19 21:12:54 1.589 +++ LVM2/WHATS_NEW 2007/03/19 21:16:49 1.590 @@ -1,3 +1,6 @@ +Version 2.02.25 - +================================= + Version 2.02.24 - 19th March 2007 ================================= Fix processing of exit status in init scripts From mbroz@sourceware.org Fri Mar 23 12:43:00 2007 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Fri, 23 Mar 2007 12:43:00 -0000 Subject: LVM2 ./WHATS_NEW lib/format_text/format-text.c ... Message-ID: <20070323124318.3616.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2007-03-23 12:43:17 Modified files: . : WHATS_NEW lib/format_text: format-text.c lib/metadata : metadata.c metadata.h tools : vgsplit.c Log message: Fix vgsplit for lvm1 format (set and validate VG name in PVs metadata). Split metadata areas in vgsplit properly. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.590&r2=1.591 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.103&r2=1.104 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.153&r2=1.154 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.23&r2=1.24 --- LVM2/WHATS_NEW 2007/03/19 21:16:49 1.590 +++ LVM2/WHATS_NEW 2007/03/23 12:43:17 1.591 @@ -1,5 +1,7 @@ Version 2.02.25 - ================================= + Fix vgsplit for lvm1 format (set and validate VG name in PVs metadata). + Split metadata areas in vgsplit properly. Version 2.02.24 - 19th March 2007 ================================= --- LVM2/lib/format_text/format-text.c 2007/01/25 14:37:48 1.72 +++ LVM2/lib/format_text/format-text.c 2007/03/23 12:43:17 1.73 @@ -80,6 +80,22 @@ return 1; } +/* + * Check if metadata area belongs to vg + */ +static int _mda_in_vg_raw(struct format_instance *fid __attribute((unused)), + struct volume_group *vg, struct metadata_area *mda) +{ + struct mda_context *mdac = (struct mda_context *) mda->metadata_locn; + struct pv_list *pvl; + + list_iterate_items(pvl, &vg->pvs) + if (pvl->pv->dev == mdac->area.dev) + return 1; + + return 0; +} + static int _text_lv_setup(struct format_instance *fid __attribute((unused)), struct logical_volume *lv) { @@ -1395,7 +1411,8 @@ .vg_remove = _vg_remove_raw, .vg_precommit = _vg_precommit_raw, .vg_commit = _vg_commit_raw, - .vg_revert = _vg_revert_raw + .vg_revert = _vg_revert_raw, + .mda_in_vg = _mda_in_vg_raw, }; /* pvmetadatasize in sectors */ --- LVM2/lib/metadata/metadata.c 2007/02/07 13:29:52 1.103 +++ LVM2/lib/metadata/metadata.c 2007/03/23 12:43:17 1.104 @@ -505,6 +505,34 @@ return 1; } +int vg_split_mdas(struct cmd_context *cmd, struct volume_group *vg_from, + struct volume_group *vg_to) +{ + struct metadata_area *mda, *mda2; + struct list *mdas_from, *mdas_to; + int common_mda = 0; + + mdas_from = &vg_from->fid->metadata_areas; + mdas_to = &vg_to->fid->metadata_areas; + + list_iterate_items_safe(mda, mda2, mdas_from) { + if (!mda->ops->mda_in_vg) { + common_mda = 1; + continue; + } + + if (!mda->ops->mda_in_vg(vg_from->fid, vg_from, mda)) { + list_del(&mda->list); + list_add(mdas_to, &mda->list); + } + } + + if (list_empty(mdas_from) || list_empty(mdas_to)) + return common_mda; + + return 1; +} + /* Sizes in sectors */ struct physical_volume *pv_create(const struct format_type *fmt, struct device *dev, @@ -759,6 +787,12 @@ r = 0; } } + + if (strcmp(pvl->pv->vg_name, vg->name)) { + log_error("Internal error: VG name for PV %s is corrupted", + dev_name(pvl->pv->dev)); + r = 0; + } } if (!check_pv_segments(vg)) { --- LVM2/lib/metadata/metadata.h 2007/02/07 13:29:52 1.153 +++ LVM2/lib/metadata/metadata.h 2007/03/23 12:43:17 1.154 @@ -178,6 +178,11 @@ struct volume_group * vg, struct metadata_area * mda); int (*vg_remove) (struct format_instance * fi, struct volume_group * vg, struct metadata_area * mda); + /* + * Check if metadata area belongs to vg + */ + int (*mda_in_vg) (struct format_instance * fi, + struct volume_group * vg, struct metadata_area *mda); }; struct metadata_area { @@ -450,6 +455,8 @@ int pv_count, char **pv_names); int vg_change_pesize(struct cmd_context *cmd, struct volume_group *vg, uint32_t new_extent_size); +int vg_split_mdas(struct cmd_context *cmd, struct volume_group *vg_from, + struct volume_group *vg_to); /* Manipulate LVs */ struct logical_volume *lv_create_empty(struct format_instance *fi, --- LVM2/tools/vgsplit.c 2007/03/09 21:25:33 1.23 +++ LVM2/tools/vgsplit.c 2007/03/23 12:43:17 1.24 @@ -299,6 +299,10 @@ goto error; } + /* Set metadata format of original VG */ + /* FIXME: need some common logic */ + cmd->fmt = vg_from->fid->fmt; + /* Create new VG structure */ if (!(vg_to = vg_create(cmd, vg_name_to, vg_from->extent_size, vg_from->max_pv, vg_from->max_lv, @@ -330,11 +334,15 @@ if (!(_move_mirrors(vg_from, vg_to))) goto error; - /* FIXME Split mdas properly somehow too! */ - /* Currently we cheat by sharing the format instance and relying on - * vg_write to ignore mdas outside the VG! Done this way, with text - * format, vg_from disappears for a short time. */ - vg_to->fid = vg_from->fid; + /* Split metadata areas and check if both vgs have at least one area */ + if (!(vg_split_mdas(cmd, vg_from, vg_to))) { + log_error("Cannot split: Nowhere to store metadata for new Volume Group"); + goto error; + } + + /* Set proper name for all PVs in new VG */ + if (!vg_rename(cmd, vg_to, vg_name_to)) + goto error; /* store it on disks */ log_verbose("Writing out updated volume groups"); From mbroz@sourceware.org Mon Mar 26 16:10:00 2007 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 26 Mar 2007 16:10:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/mirror.c tools/l ... Message-ID: <20070326161014.12892.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2007-03-26 17:10:11 Modified files: . : WHATS_NEW lib/metadata : mirror.c tools : lvconvert.c lvcreate.c toollib.c toollib.h Log message: Fix creation and conversion of mirrors with tags. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.591&r2=1.592 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.133&r2=1.134 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.97&r2=1.98 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.45&r2=1.46 --- LVM2/WHATS_NEW 2007/03/23 12:43:17 1.591 +++ LVM2/WHATS_NEW 2007/03/26 16:10:09 1.592 @@ -1,5 +1,6 @@ Version 2.02.25 - ================================= + Fix creation and conversion of mirrors with tags. Fix vgsplit for lvm1 format (set and validate VG name in PVs metadata). Split metadata areas in vgsplit properly. --- LVM2/lib/metadata/mirror.c 2006/11/30 17:52:47 1.37 +++ LVM2/lib/metadata/mirror.c 2007/03/26 16:10:10 1.38 @@ -21,6 +21,7 @@ #include "activate.h" #include "lv_alloc.h" #include "lvm-string.h" +#include "str_list.h" #include "locking.h" /* FIXME Should not be used in this file */ #include "defaults.h" /* FIXME: should this be defaults.h? */ @@ -77,6 +78,42 @@ lv_from->size = 0; } + +/* + * Delete independent/orphan LV, it must acquire lock. + */ +static int _delete_lv(struct lv_segment *mirrored_seg, struct logical_volume *lv) +{ + struct cmd_context *cmd = mirrored_seg->lv->vg->cmd; + struct str_list *sl; + + /* Inherit tags - maybe needed for activation */ + if (!str_list_match_list(&mirrored_seg->lv->tags, &lv->tags)) { + list_iterate_items(sl, &mirrored_seg->lv->tags) + if (!str_list_add(cmd->mem, &lv->tags, sl->str)) { + log_error("Aborting. Unable to tag."); + return 0; + } + + if (!vg_write(mirrored_seg->lv->vg) || + !vg_commit(mirrored_seg->lv->vg)) { + log_error("Intermediate VG commit for orphan volume failed."); + return 0; + } + } + + if (!activate_lv(cmd, lv)) + return_0; + + if (!deactivate_lv(cmd, lv)) + return_0; + + if (!lv_remove(lv)) + return_0; + + return 1; +} + /* * Reduce mirrored_seg to num_mirrors images. */ @@ -205,57 +242,15 @@ } /* Delete the 'orphan' LVs */ - for (m = num_mirrors; m < old_area_count; m++) { - /* LV is now independent of the mirror so must acquire lock. */ - if (!activate_lv(mirrored_seg->lv->vg->cmd, seg_lv(mirrored_seg, m))) { - stack; - return 0; - } - - if (!deactivate_lv(mirrored_seg->lv->vg->cmd, seg_lv(mirrored_seg, m))) { - stack; - return 0; - } - - if (!lv_remove(seg_lv(mirrored_seg, m))) { - stack; - return 0; - } - } - - if (lv1) { - if (!activate_lv(mirrored_seg->lv->vg->cmd, lv1)) { - stack; - return 0; - } - - if (!deactivate_lv(mirrored_seg->lv->vg->cmd, lv1)) { - stack; + for (m = num_mirrors; m < old_area_count; m++) + if (!_delete_lv(mirrored_seg, seg_lv(mirrored_seg, m))) return 0; - } - - if (!lv_remove(lv1)) { - stack; - return 0; - } - } - if (log_lv) { - if (!activate_lv(mirrored_seg->lv->vg->cmd, log_lv)) { - stack; - return 0; - } - - if (!deactivate_lv(mirrored_seg->lv->vg->cmd, log_lv)) { - stack; - return 0; - } + if (lv1 && !_delete_lv(mirrored_seg, lv1)) + return 0; - if (!lv_remove(log_lv)) { - stack; - return 0; - } - } + if (log_lv && !_delete_lv(mirrored_seg, log_lv)) + return 0; return 1; } --- LVM2/tools/lvconvert.c 2007/01/10 14:13:46 1.25 +++ LVM2/tools/lvconvert.c 2007/03/26 16:10:10 1.26 @@ -307,7 +307,7 @@ if (!(log_lv = create_mirror_log(cmd, lv->vg, ah, lp->alloc, lv->name, (sync_percent >= 100.0) ? - 1 : 0))) { + 1 : 0, &lv->tags))) { log_error("Failed to create mirror log."); return 0; } @@ -385,7 +385,7 @@ if (!arg_count(cmd, corelog_ARG) && !(log_lv = create_mirror_log(cmd, lv->vg, ah, lp->alloc, - lv->name, 0))) { + lv->name, 0, &lv->tags))) { log_error("Failed to create mirror log."); return 0; } --- LVM2/tools/lvcreate.c 2007/03/09 20:47:41 1.133 +++ LVM2/tools/lvcreate.c 2007/03/26 16:10:10 1.134 @@ -476,8 +476,8 @@ uint64_t tmp_size; struct volume_group *vg; struct logical_volume *lv, *org = NULL, *log_lv = NULL; - struct list *pvh; - const char *tag; + struct list *pvh, tags; + const char *tag = NULL; int consistent = 1; struct alloc_handle *ah = NULL; char lv_name_buf[128]; @@ -675,6 +675,19 @@ lv_name = &lv_name_buf[0]; } + if (arg_count(cmd, addtag_ARG)) { + if (!(tag = arg_str_value(cmd, addtag_ARG, NULL))) { + log_error("Failed to get tag"); + return 0; + } + + if (!(vg->fid->fmt->features & FMT_TAGS)) { + log_error("Volume group %s does not support tags", + vg->name); + return 0; + } + } + if (lp->mirrors > 1) { /* FIXME Calculate how many extents needed for the log */ @@ -698,9 +711,13 @@ status |= MIRROR_NOTSYNCED; } + list_init(&tags); + if (tag) + str_list_add(cmd->mem, &tags, tag); + if (!lp->corelog && !(log_lv = create_mirror_log(cmd, vg, ah, lp->alloc, - lv_name, lp->nosync))) { + lv_name, lp->nosync, &tags))) { log_error("Failed to create mirror log."); return 0; } @@ -725,23 +742,10 @@ lv->minor); } - if (arg_count(cmd, addtag_ARG)) { - if (!(tag = arg_str_value(cmd, addtag_ARG, NULL))) { - log_error("Failed to get tag"); - goto error; - } - - if (!(lv->vg->fid->fmt->features & FMT_TAGS)) { - log_error("Volume group %s does not support tags", - lv->vg->name); - goto error; - } - - if (!str_list_add(cmd->mem, &lv->tags, tag)) { - log_error("Failed to add tag %s to %s/%s", - tag, lv->vg->name, lv->name); - goto error; - } + if (tag && !str_list_add(cmd->mem, &lv->tags, tag)) { + log_error("Failed to add tag %s to %s/%s", + tag, lv->vg->name, lv->name); + goto error; } if (lp->mirrors > 1) { --- LVM2/tools/toollib.c 2007/03/09 20:47:41 1.97 +++ LVM2/tools/toollib.c 2007/03/26 16:10:10 1.98 @@ -1310,11 +1310,13 @@ struct alloc_handle *ah, alloc_policy_t alloc, const char *lv_name, - int in_sync) + int in_sync, + struct list *tags) { struct logical_volume *log_lv; char *log_name; size_t len; + struct str_list *sl; len = strlen(lv_name) + 32; if (!(log_name = alloca(len)) || @@ -1336,6 +1338,13 @@ goto error; } + /* Temporary tag mirror log */ + list_iterate_items(sl, tags) + if (!str_list_add(cmd->mem, &log_lv->tags, sl->str)) { + log_error("Aborting. Unable to tag mirror log."); + goto error; + } + /* store mirror log on disk(s) */ if (!vg_write(vg)) { stack; @@ -1361,6 +1370,11 @@ goto error; } + list_iterate_items(sl, tags) + if (!str_list_del(&log_lv->tags, sl->str)) + log_error("Failed to remove tag %s from mirror log.", + sl->str); + if (activation() && !set_lv(cmd, log_lv, log_lv->size, in_sync ? -1 : 0)) { log_error("Aborting. Failed to wipe mirror log. " --- LVM2/tools/toollib.h 2007/03/09 20:47:41 1.45 +++ LVM2/tools/toollib.h 2007/03/26 16:10:10 1.46 @@ -100,7 +100,8 @@ struct alloc_handle *ah, alloc_policy_t alloc, const char *lv_name, - int in_sync); + int in_sync, + struct list *tags); int set_lv(struct cmd_context *cmd, struct logical_volume *lv, uint64_t sectors, int value); From agk@sourceware.org Tue Mar 27 13:35:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 27 Mar 2007 13:35:00 -0000 Subject: LVM2 ./WHATS_NEW lib/report/report.c man/lvs.8 ... Message-ID: <20070327133535.28320.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-03-27 14:35:34 Modified files: . : WHATS_NEW lib/report : report.c man : lvs.8 vgs.8 Log message: Update lists of attribute characters in man pages. Change cling alloc policy attribute character from 'C' to l'. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.592&r2=1.593 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvs.8.diff?cvsroot=lvm2&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/vgs.8.diff?cvsroot=lvm2&r1=1.4&r2=1.5 --- LVM2/WHATS_NEW 2007/03/26 16:10:09 1.592 +++ LVM2/WHATS_NEW 2007/03/27 13:35:33 1.593 @@ -1,5 +1,7 @@ Version 2.02.25 - ================================= + Update lists of attribute characters in man pages. + Change cling alloc policy attribute character from 'C' to l'. Fix creation and conversion of mirrors with tags. Fix vgsplit for lvm1 format (set and validate VG name in PVs metadata). Split metadata areas in vgsplit properly. --- LVM2/lib/report/report.c 2007/01/29 23:01:18 1.55 +++ LVM2/lib/report/report.c 2007/03/27 13:35:33 1.56 @@ -49,7 +49,7 @@ case ALLOC_CONTIGUOUS: return 'c'; case ALLOC_CLING: - return 'C'; + return 'l'; case ALLOC_NORMAL: return 'n'; case ALLOC_ANYWHERE: --- LVM2/man/lvs.8 2007/01/18 22:33:24 1.5 +++ LVM2/man/lvs.8 2007/03/27 13:35:33 1.6 @@ -51,7 +51,7 @@ .IP 2 3 Permissions: (w)riteable, (r)ead-only .IP 3 3 -Allocation policy: (c)ontiguous, (n)ormal, (a)nywhere, (i)nherited +Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited This is capitalised if the volume is currently locked against allocation changes, for example during \fBpvmove\fP (8). .IP 4 3 --- LVM2/man/vgs.8 2007/01/18 22:33:24 1.4 +++ LVM2/man/vgs.8 2007/03/27 13:35:33 1.5 @@ -36,9 +36,24 @@ vg_tags. Any "vg_" prefixes are optional. Columns mentioned in either \fBpvs (8)\fP or \fBlvs (8)\fP can also be chosen, but columns cannot be taken from both -at the same time. The vg_attr bits are: (w)riteable, (r)eadonly, -resi(z)eable, e(x)ported, (p)artial and (c)lustered. +at the same time. Use \fb-o help\fP to view the full list of fields available. +.IP +The vg_attr bits are: +.RS +.IP 1 3 +Permissions: (w)riteable, (r)ead-only +.IP 2 3 +Resi(z)eable +.IP 3 3 +E(x)ported +.IP 4 3 +(p)artial +.IP 5 3 +Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited +.IP 6 3 +(c)lustered +.RE .TP .I \-O, \-\-sort Comma-separated ordered list of columns to sort by. Replaces the default From pcaulfield@sourceware.org Thu Mar 29 13:59:00 2007 From: pcaulfield@sourceware.org (pcaulfield@sourceware.org) Date: Thu, 29 Mar 2007 13:59:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd.c Message-ID: <20070329135934.24669.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: pcaulfield@sourceware.org 2007-03-29 14:59:33 Modified files: . : WHATS_NEW daemons/clvmd : clvmd.c Log message: Add some extra error checking & robustness. Thanks to the Crosswalk engineering team: Leonard Maiorani Henry Harris Scott Cannata Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.593&r2=1.594 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34 --- LVM2/WHATS_NEW 2007/03/27 13:35:33 1.593 +++ LVM2/WHATS_NEW 2007/03/29 13:59:32 1.594 @@ -5,6 +5,7 @@ Fix creation and conversion of mirrors with tags. Fix vgsplit for lvm1 format (set and validate VG name in PVs metadata). Split metadata areas in vgsplit properly. + Add extra internal error checking to clvmd Version 2.02.24 - 19th March 2007 ================================= --- LVM2/daemons/clvmd/clvmd.c 2006/12/11 13:48:41 1.33 +++ LVM2/daemons/clvmd/clvmd.c 2007/03/29 13:59:33 1.34 @@ -56,6 +56,8 @@ #define FALSE 0 #endif +#define MAX_RETRIES 4 + /* The maximum size of a message that will fit into a packet. Anything bigger than this is sent via the system LV */ #define MAX_INLINE_MESSAGE (max_cluster_message-sizeof(struct clvm_header)) @@ -325,7 +327,7 @@ /* This needs to be started after cluster initialisation as it may need to take out locks */ DEBUGLOG("starting LVM thread\n"); - pthread_create(&lvm_thread, NULL, lvm_thread_fn, + pthread_create(&lvm_thread, NULL, lvm_thread_fn, (void *)(long)using_gulm); /* Tell the rest of the cluster our version number */ @@ -375,6 +377,9 @@ socklen_t sl = sizeof(socka); int client_fd = accept(thisfd->fd, (struct sockaddr *) &socka, &sl); + if (client_fd == -1 && errno == EINTR) + return 1; + if (client_fd >= 0) { newfd = malloc(sizeof(struct local_client)); if (!newfd) { @@ -412,6 +417,8 @@ int status = -1; /* in error by default */ len = read(thisfd->fd, buffer, sizeof(int)); + if (len == -1 && errno == EINTR) + return 1; if (len == sizeof(int)) { memcpy(&status, buffer, sizeof(int)); @@ -786,6 +793,8 @@ char buffer[PIPE_BUF]; len = read(thisfd->fd, buffer, sizeof(buffer)); + if (len == -1 && errno == EINTR) + return 1; DEBUGLOG("Read on local socket %d, len = %d\n", thisfd->fd, len); @@ -901,8 +910,12 @@ len - strlen(inheader->node) - sizeof(struct clvm_header); missing_len = inheader->arglen - argslen; + if (missing_len < 0) + missing_len = 0; + /* Save the message */ thisfd->bits.localsock.cmd = malloc(len + missing_len); + if (!thisfd->bits.localsock.cmd) { struct clvm_header reply; reply.cmd = CLVMD_CMD_REPLY; @@ -927,9 +940,8 @@ DEBUGLOG ("got %d bytes, need another %d (total %d)\n", argslen, missing_len, inheader->arglen); - len = - read(thisfd->fd, argptr + argslen, - missing_len); + len = read(thisfd->fd, argptr + argslen, + missing_len); if (len >= 0) { missing_len -= len; argslen += len; @@ -1215,7 +1227,7 @@ /* Version check is internal - don't bother exposing it in clvmd-command.c */ if (msg->cmd == CLVMD_CMD_VERSION) { - int version_nums[3]; + int version_nums[3]; char node[256]; memcpy(version_nums, msg->args, sizeof(version_nums)); @@ -1395,6 +1407,7 @@ { struct local_client *client = (struct local_client *) arg; int status; + int write_status; sigset_t ss; int pipe_fd = client->bits.localsock.pipe; @@ -1424,8 +1437,19 @@ client->bits.localsock.all_success = 0; DEBUGLOG("Writing status %d down pipe %d\n", status, pipe_fd); + /* Tell the parent process we have finished this bit */ - write(pipe_fd, &status, sizeof(int)); + do { + write_status = write(pipe_fd, &status, sizeof(int)); + if (write_status == sizeof(int)) + break; + if (write_status < 0 && + (errno == EINTR || errno == EAGAIN)) + continue; + log_error("Error sending to pipe: %m\n"); + break; + } while(1); + if (status) continue; /* Wait for another PRE command */ @@ -1446,7 +1470,16 @@ status = 0; do_post_command(client); - write(pipe_fd, &status, sizeof(int)); + do { + write_status = write(pipe_fd, &status, sizeof(int)); + if (write_status == sizeof(int)) + break; + if (write_status < 0 && + (errno == EINTR || errno == EAGAIN)) + continue; + log_error("Error sending to pipe: %m\n"); + break; + } while(1); DEBUGLOG("Waiting for next pre command\n"); @@ -1650,6 +1683,11 @@ const char *errtext) { int len; + int saved_errno = 0; + struct timespec delay; + struct timespec remtime; + + int retry_cnt = 0; /* Send remote messages down the cluster socket */ if (csid == NULL || !ISLOCAL_CSID(csid)) { @@ -1660,14 +1698,38 @@ /* Make sure it all goes */ do { + if (retry_cnt > MAX_RETRIES) + { + errno = saved_errno; + log_error(errtext); + errno = saved_errno; + break; + } + len = write(fd, buf + ptr, msglen - ptr); if (len <= 0) { + if (errno == EINTR) + continue; + if (errno == EAGAIN || + errno == EIO || + errno == ENOSPC) { + saved_errno = errno; + retry_cnt++; + + delay.tv_sec = 0; + delay.tv_nsec = 100000; + remtime.tv_sec = 0; + remtime.tv_nsec = 0; + (void) nanosleep (&delay, &remtime); + + continue; + } log_error(errtext); break; } ptr += len; - } while (len < msglen); + } while (ptr < msglen); } return len; } From wysochanski@sourceware.org Fri Mar 30 21:00:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Fri, 30 Mar 2007 21:00:00 -0000 Subject: LVM2 man/lvm.8 man/Makefile.in tools/commands. ... Message-ID: <20070330210031.18518.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-03-30 22:00:27 Modified files: man : lvm.8 Makefile.in tools : commands.h Makefile.in . : WHATS_NEW Added files: man : pvck.8 tools : pvck.c Log message: Add stub for pvck, a command to check physical volume consistency. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/pvck.8.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvm.8.diff?cvsroot=lvm2&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/Makefile.in.diff?cvsroot=lvm2&r1=1.18&r2=1.19 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvck.c.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.94&r2=1.95 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/Makefile.in.diff?cvsroot=lvm2&r1=1.78&r2=1.79 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.594&r2=1.595 /cvs/lvm2/LVM2/man/pvck.8,v --> standard output revision 1.1 --- LVM2/man/pvck.8 +++ - 2007-03-30 22:00:30.440519000 +0100 @@ -0,0 +1,15 @@ +.TH PVCK 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*- +.SH NAME +pvck \- check physical volume metadata +.SH SYNOPSIS +.B pvck +[\-d/\-\-debug] [\-h/\-?/\-\-help] [\-v/\-\-verbose] [PhysicalVolume...] +.SH DESCRIPTION +pvck checks physical volume LVM metadata for consistency. +.SH OPTIONS +See \fBlvm\fP for common options. +.SH SEE ALSO +.BR lvm (8), +.BR pvcreate (8), +.BR pvscan (8) +.BR vgck (8) --- LVM2/man/lvm.8 2006/10/08 12:01:12 1.9 +++ LVM2/man/lvm.8 2007/03/30 21:00:25 1.10 @@ -194,6 +194,7 @@ .BR lvs (8), .BR lvscan (8), .BR pvchange (8), +.BR pvck (8), .BR pvcreate (8), .BR pvdisplay (8), .BR pvmove (8), --- LVM2/man/Makefile.in 2006/11/20 20:03:26 1.18 +++ LVM2/man/Makefile.in 2007/03/30 21:00:25 1.19 @@ -20,7 +20,7 @@ MAN8=lvchange.8 lvconvert.8 lvcreate.8 lvdisplay.8 lvextend.8 lvm.8 \ lvmchange.8 lvmdiskscan.8 lvmdump.8 \ lvreduce.8 lvremove.8 lvrename.8 lvresize.8 lvs.8 \ - lvscan.8 pvchange.8 pvcreate.8 pvdisplay.8 pvmove.8 pvremove.8 \ + lvscan.8 pvchange.8 pvck.8 pvcreate.8 pvdisplay.8 pvmove.8 pvremove.8 \ pvresize.8 pvs.8 pvscan.8 vgcfgbackup.8 vgcfgrestore.8 vgchange.8 \ vgck.8 vgcreate.8 vgconvert.8 vgdisplay.8 vgexport.8 vgextend.8 \ vgimport.8 vgmerge.8 vgmknodes.8 vgreduce.8 vgremove.8 vgrename.8 \ /cvs/lvm2/LVM2/tools/pvck.c,v --> standard output revision 1.1 --- LVM2/tools/pvck.c +++ - 2007-03-30 22:00:31.021537000 +0100 @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. + * Copyright (C) 2007 Red Hat, Inc. All rights reserved. + * + * This file is part of LVM2. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU General Public License v.2. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "tools.h" + +static int _pvck_single(struct cmd_context * cmd, + struct volume_group * vg, + struct physical_volume * pv, + void *handle) +{ + return ECMD_PROCESSED; +} + +int pvck(struct cmd_context *cmd, int argc, char **argv) +{ + /* FIXME: Correlate findings of each PV */ + return process_each_pv(cmd, argc, argv, NULL, NULL, _pvck_single); +} --- LVM2/tools/commands.h 2007/01/23 13:08:34 1.94 +++ LVM2/tools/commands.h 2007/03/30 21:00:26 1.95 @@ -407,6 +407,15 @@ physicalvolumesize_ARG, test_ARG) +xx(pvck, + "Check the consistency of physical volume(s)", + "pvck " + "\t[-d|--debug]\n" + "\t[-h|--help]\n" + "\t[-v|--verbose]\n" + "\t[--version]" "\n" + "\tPhysicalVolume [PhysicalVolume...]\n" ) + xx(pvcreate, "Initialize physical volume(s) for use by LVM", "pvcreate " "\n" --- LVM2/tools/Makefile.in 2007/01/11 17:12:27 1.78 +++ LVM2/tools/Makefile.in 2007/03/30 21:00:26 1.79 @@ -38,6 +38,7 @@ lvscan.c \ polldaemon.c \ pvchange.c \ + pvck.c \ pvcreate.c \ pvdisplay.c \ pvmove.c \ --- LVM2/WHATS_NEW 2007/03/29 13:59:32 1.594 +++ LVM2/WHATS_NEW 2007/03/30 21:00:26 1.595 @@ -1,5 +1,6 @@ Version 2.02.25 - ================================= + Add pvck command stub. Update lists of attribute characters in man pages. Change cling alloc policy attribute character from 'C' to l'. Fix creation and conversion of mirrors with tags.