From wysochanski@sourceware.org Mon Jul 2 11:17:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 02 Jul 2007 11:17:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/a ... Message-ID: <20070702111722.16421.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-02 11:17:21 Modified files: . : WHATS_NEW lib/activate : activate.c dev_manager.c lib/format_text: archive.c format-text.c lib/snapshot : snapshot.c Log message: Don't use index and rindex functions marked by SUSv3 as legacy - Jakub Bogusz Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.643&r2=1.644 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.123&r2=1.124 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.124&r2=1.125 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/archive.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.76&r2=1.77 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/snapshot/snapshot.c.diff?cvsroot=lvm2&r1=1.19&r2=1.20 --- LVM2/WHATS_NEW 2007/06/28 17:59:34 1.643 +++ LVM2/WHATS_NEW 2007/07/02 11:17:20 1.644 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Don't use index and rindex functions marked by SUSv3 as legacy. Fix vgsplit if splitting all PVs from VG. Fix lvmdiskscan volume reporting when run in the lvm shell Fix missing lvm_shell symbol in lvm2cmd library. (2.02.23) --- LVM2/lib/activate/activate.c 2007/06/28 17:33:43 1.123 +++ LVM2/lib/activate/activate.c 2007/07/02 11:17:21 1.124 @@ -313,7 +313,7 @@ else continue; } - if (!index(str, '/')) { + if (!strchr(str, '/')) { /* vgname supplied */ if (!strcmp(str, lv->vg->name)) return 1; --- LVM2/lib/activate/dev_manager.c 2007/05/15 14:42:01 1.124 +++ LVM2/lib/activate/dev_manager.c 2007/07/02 11:17:21 1.125 @@ -561,7 +561,7 @@ log_debug("Getting device info for %s", dl->name); /* Rename? */ - if ((suffix = rindex(dl->dlid + sizeof(UUID_PREFIX) - 1, '-'))) + if ((suffix = strrchr(dl->dlid + sizeof(UUID_PREFIX) - 1, '-'))) suffix++; newname = build_dm_name(dm->mem, dm->vg_name, dl->lv->name, suffix); --- LVM2/lib/format_text/archive.c 2007/06/08 22:38:48 1.26 +++ LVM2/lib/format_text/archive.c 2007/07/02 11:17:21 1.27 @@ -71,7 +71,7 @@ if (strcmp(".vg", dot)) return 0; - if (!(underscore = rindex(filename, '_'))) + if (!(underscore = strrchr(filename, '_'))) return 0; if (sscanf(underscore + 1, "%u", ix) != 1) --- LVM2/lib/format_text/format-text.c 2007/06/28 17:33:44 1.76 +++ LVM2/lib/format_text/format-text.c 2007/07/02 11:17:21 1.77 @@ -850,7 +850,7 @@ char *slash; char temp_file[PATH_MAX], temp_dir[PATH_MAX]; - slash = rindex(tc->path_edit, '/'); + slash = strrchr(tc->path_edit, '/'); if (slash == 0) strcpy(temp_dir, "."); @@ -948,7 +948,7 @@ return 0; /* vgrename? */ - if ((slash = rindex(tc->path_live, '/'))) + if ((slash = strrchr(tc->path_live, '/'))) slash = slash + 1; else slash = tc->path_live; --- LVM2/lib/snapshot/snapshot.c 2006/10/18 18:01:52 1.19 +++ LVM2/lib/snapshot/snapshot.c 2007/07/02 11:17:21 1.20 @@ -98,7 +98,7 @@ float percent2; uint64_t numerator, denominator; - if (index(params, '/')) { + if (strchr(params, '/')) { if (sscanf(params, "%" PRIu64 "/%" PRIu64, &numerator, &denominator) == 2) { *total_numerator += numerator; From mbroz@sourceware.org Mon Jul 2 20:18:00 2007 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 02 Jul 2007 20:18:00 -0000 Subject: LVM2 ./WHATS_NEW scripts/lvm_dump.sh Message-ID: <20070702201838.25506.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2007-07-02 20:18:38 Modified files: . : WHATS_NEW scripts : lvm_dump.sh Log message: Add kernel and device-mapper targets versions report to lvmdump. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.644&r2=1.645 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/lvm_dump.sh.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/WHATS_NEW 2007/07/02 11:17:20 1.644 +++ LVM2/WHATS_NEW 2007/07/02 20:18:38 1.645 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Add kernel and device-mapper targets versions report to lvmdump. Don't use index and rindex functions marked by SUSv3 as legacy. Fix vgsplit if splitting all PVs from VG. Fix lvmdiskscan volume reporting when run in the lvm shell --- LVM2/scripts/lvm_dump.sh 2007/04/25 14:49:27 1.5 +++ LVM2/scripts/lvm_dump.sh 2007/07/02 20:18:38 1.6 @@ -18,6 +18,7 @@ CUT=cut DATE=date BASENAME=basename +UNAME=uname # user may override lvm and dmsetup location by setting LVM_BINARY # and DMSETUP_BINARY respectively @@ -131,6 +132,10 @@ $LVM lvs --version >> $dir/versions 2>> $log echo "DEVICE MAPPER VERSION:" >> $dir/versions $DMSETUP --version >> $dir/versions 2>> $log +echo "KERNEL VERSION:" >> $dir/versions +$UNAME -a >> $dir/versions 2>> $log +echo "DM TARGETS VERSIONS:" >> $dir/versions +$DMSETUP targets >> $dir/versions 2>> $log myecho "Gathering dmsetup info..." log "$DMSETUP info -c > $dir/dmsetup_info 2>> $log" From wysochanski@sourceware.org Mon Jul 2 21:48:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 02 Jul 2007 21:48:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/metadata.c Message-ID: <20070702214831.4164.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-02 21:48:31 Modified files: . : WHATS_NEW lib/metadata : metadata.c Log message: Convert _add_pv_to_vg to usable LVM library function. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.645&r2=1.646 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.122&r2=1.123 --- LVM2/WHATS_NEW 2007/07/02 20:18:38 1.645 +++ LVM2/WHATS_NEW 2007/07/02 21:48:30 1.646 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Convert _add_pv_to_vg to usable LVM library function. Add kernel and device-mapper targets versions report to lvmdump. Don't use index and rindex functions marked by SUSv3 as legacy. Fix vgsplit if splitting all PVs from VG. --- LVM2/lib/metadata/metadata.c 2007/06/28 17:33:44 1.122 +++ LVM2/lib/metadata/metadata.c 2007/07/02 21:48:30 1.123 @@ -66,11 +66,11 @@ return MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT; } -static int _add_pv_to_vg(struct format_instance *fid, struct volume_group *vg, - const char *pv_name) +static int _add_pv_to_vg(struct volume_group *vg, const char *pv_name) { struct pv_list *pvl; struct physical_volume *pv; + struct format_instance *fid = vg->fid; struct dm_pool *mem = fid->fmt->cmd->mem; struct list mdas; @@ -251,7 +251,7 @@ /* attach each pv */ for (i = 0; i < pv_count; i++) - if (!_add_pv_to_vg(vg->fid, vg, pv_names[i])) { + if (!_add_pv_to_vg(vg, pv_names[i])) { log_error("Unable to add physical volume '%s' to " "volume group '%s'.", pv_names[i], vg->name); return 0; From wysochanski@sourceware.org Tue Jul 3 13:10:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Tue, 03 Jul 2007 13:10:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20070703131015.3215.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-03 13:10:15 Modified files: . : WHATS_NEW Log message: Fix WHATS_NEW for last checkin until further patches for LVM library are ready. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.646&r2=1.647 --- LVM2/WHATS_NEW 2007/07/02 21:48:30 1.646 +++ LVM2/WHATS_NEW 2007/07/03 13:10:14 1.647 @@ -1,6 +1,6 @@ Version 2.02.27 - ================================ - Convert _add_pv_to_vg to usable LVM library function. + Remove unused parameter 'fid' from _add_pv_to_vg. Add kernel and device-mapper targets versions report to lvmdump. Don't use index and rindex functions marked by SUSv3 as legacy. Fix vgsplit if splitting all PVs from VG. From agk@sourceware.org Sun Jul 8 22:51:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Sun, 08 Jul 2007 22:51:00 -0000 Subject: LVM2 ./WHATS_NEW lib/config/config.c Message-ID: <20070708225122.22491.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-08 22:51:21 Modified files: . : WHATS_NEW lib/config : config.c Log message: Fix dumpconfig to use log_print instead of stdout directly. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.647&r2=1.648 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60 --- LVM2/WHATS_NEW 2007/07/03 13:10:14 1.647 +++ LVM2/WHATS_NEW 2007/07/08 22:51:20 1.648 @@ -1,10 +1,11 @@ Version 2.02.27 - ================================ + Fix dumpconfig to use log_print instead of stdout directly. Remove unused parameter 'fid' from _add_pv_to_vg. - Add kernel and device-mapper targets versions report to lvmdump. - Don't use index and rindex functions marked by SUSv3 as legacy. - Fix vgsplit if splitting all PVs from VG. - Fix lvmdiskscan volume reporting when run in the lvm shell + Add kernel and device-mapper targets versions to lvmdump. + Replace BSD (r)index with C89 str(r)chr. + Handle vgsplit of an entire VG as a vgrename. + Reinitialise internal lvmdiskscan variables when called repeatedly. Fix missing lvm_shell symbol in lvm2cmd library. (2.02.23) Add vg_status function and clean up vg->status in tools directory. Add --ignoremonitoring to disable all dmeventd interaction. --- LVM2/lib/config/config.c 2007/06/13 15:11:19 1.59 +++ LVM2/lib/config/config.c 2007/07/08 22:51:20 1.60 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. + * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. * Copyright (C) 2004 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. @@ -66,6 +66,11 @@ struct device *dev; }; +struct output_line { + FILE *fp; + struct dm_pool *mem; +}; + static void _get_token(struct parser *p, int tok_prev); static void _eat_space(struct parser *p); static struct config_node *_file(struct parser *p); @@ -345,33 +350,87 @@ return 1; } -static void _write_value(FILE *fp, struct config_value *v) +static int _line_start(struct output_line *outline) +{ + if (!dm_pool_begin_object(outline->mem, 128)) { + log_error("dm_pool_begin_object failed for config line"); + return 0; + } + + return 1; +} + +static int _line_append(struct output_line *outline, const char *fmt, ...) +{ + char buf[4096]; + va_list ap; + int n; + + va_start(ap, fmt); + n = vsnprintf(&buf[0], 4095, fmt, ap); + if (n < 0 || n > 4095) { + log_error("vsnprintf failed for config line"); + return 0; + } + va_end(ap); + + if (!dm_pool_grow_object(outline->mem, &buf[0], strlen(buf))) { + log_error("dm_pool_grew_object failed for config line"); + return 0; + } + + return 1; +} + +#define line_append(args...) do {if (!_line_append(outline, args)) {return_0;}} while (0) + +static int _line_end(struct output_line *outline) +{ + const char *line; + + if (!dm_pool_grow_object(outline->mem, "\0", 1)) { + log_error("dm_pool_grow_object failed for config line"); + return 0; + } + + line = dm_pool_end_object(outline->mem); + if (!outline->fp) + log_print("%s", line); + else + fprintf(outline->fp, "%s\n", line); + + return 1; +} + +static int _write_value(struct output_line *outline, struct config_value *v) { switch (v->type) { case CFG_STRING: - fprintf(fp, "\"%s\"", v->v.str); + line_append("\"%s\"", v->v.str); break; case CFG_FLOAT: - fprintf(fp, "%f", v->v.r); + line_append("%f", v->v.r); break; case CFG_INT: - fprintf(fp, "%" PRId64, v->v.i); + line_append("%" PRId64, v->v.i); break; case CFG_EMPTY_ARRAY: - fprintf(fp, "[]"); + line_append("[]"); break; default: log_error("_write_value: Unknown value type: %d", v->type); } + + return 1; } -static int _write_config(struct config_node *n, int only_one, FILE *fp, - int level) +static int _write_config(struct config_node *n, int only_one, + struct output_line *outline, int level) { char space[MAX_INDENT + 1]; int l = (level < MAX_INDENT) ? level : MAX_INDENT; @@ -385,29 +444,38 @@ space[i] = '\0'; do { - fprintf(fp, "%s%s", space, n->key); + if (!_line_start(outline)) + return_0; + line_append("%s%s", space, n->key); if (!n->v) { /* it's a sub section */ - fprintf(fp, " {\n"); - _write_config(n->child, 0, fp, level + 1); - fprintf(fp, "%s}", space); + line_append(" {"); + if (!_line_end(outline)) + return_0; + if (!_line_start(outline)) + return_0; + _write_config(n->child, 0, outline, level + 1); + line_append("%s}", space); } else { /* it's a value */ struct config_value *v = n->v; - fprintf(fp, "="); + line_append("="); if (v->next) { - fprintf(fp, "["); + line_append("["); while (v) { - _write_value(fp, v); + if (!_write_value(outline, v)) + return_0; v = v->next; if (v) - fprintf(fp, ", "); + line_append(", "); } - fprintf(fp, "]"); + line_append("]"); } else - _write_value(fp, v); + if (!_write_value(outline, v)) + return_0; } - fprintf(fp, "\n"); + if (!_line_end(outline)) + return_0; n = n->sib; } while (n && !only_one); /* FIXME: add error checking */ @@ -419,25 +487,27 @@ { struct config_node *cn; int r = 1; - FILE *fp; + struct output_line outline; + outline.fp = NULL; - if (!file) { - fp = stdout; + if (!file) file = "stdout"; - } else if (!(fp = fopen(file, "w"))) { + else if (!(outline.fp = fopen(file, "w"))) { log_sys_error("open", file); return 0; } + outline.mem = dm_pool_create("config_line", 1024); + log_verbose("Dumping configuration to %s", file); if (!argc) { - if (!_write_config(cft->root, 0, fp, 0)) { + if (!_write_config(cft->root, 0, &outline, 0)) { log_error("Failure while writing to %s", file); r = 0; } } else while (argc--) { if ((cn = find_config_node(cft->root, *argv))) { - if (!_write_config(cn, 1, fp, 0)) { + if (!_write_config(cn, 1, &outline, 0)) { log_error("Failure while writing to %s", file); r = 0; } @@ -448,11 +518,12 @@ argv++; } - if ((fp != stdout) && fclose(fp)) { + if (outline.fp && fclose(outline.fp)) { log_sys_error("fclose", file); r = 0; } + dm_pool_destroy(outline.mem); return r; } @@ -918,26 +989,26 @@ } struct config_node *find_config_tree_node(struct cmd_context *cmd, - const char *path) + const char *path) { return _find_first_config_node(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path); } const char *find_config_tree_str(struct cmd_context *cmd, - const char *path, const char *fail) + const char *path, const char *fail) { return _find_config_str(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, fail); } int find_config_tree_int(struct cmd_context *cmd, const char *path, - int fail) + int fail) { /* FIXME Add log_error message on overflow */ return (int) _find_config_int64(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, (int64_t) fail); } float find_config_tree_float(struct cmd_context *cmd, const char *path, - float fail) + float fail) { return _find_config_float(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, fail); } From agk@sourceware.org Mon Jul 9 15:40:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 09 Jul 2007 15:40:00 -0000 Subject: LVM2 ./WHATS_NEW lib/report/columns.h lib/repo ... Message-ID: <20070709154043.24139.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-09 15:40:43 Modified files: . : WHATS_NEW lib/report : columns.h report.c Log message: Add vg_mda_count and pv_mda_count columns to reports. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.648&r2=1.649 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/columns.h.diff?cvsroot=lvm2&r1=1.19&r2=1.20 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57 --- LVM2/WHATS_NEW 2007/07/08 22:51:20 1.648 +++ LVM2/WHATS_NEW 2007/07/09 15:40:42 1.649 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Add vg_mda_count and pv_mda_count columns to reports. Fix dumpconfig to use log_print instead of stdout directly. Remove unused parameter 'fid' from _add_pv_to_vg. Add kernel and device-mapper targets versions to lvmdump. --- LVM2/lib/report/columns.h 2007/01/24 16:51:24 1.19 +++ LVM2/lib/report/columns.h 2007/07/09 15:40:43 1.20 @@ -47,6 +47,7 @@ FIELD(PVS, pv, NUM, "PE", pe_count, 3, uint32, "pv_pe_count", "Total number of Physical Extents.") FIELD(PVS, pv, NUM, "Alloc", pe_alloc_count, 5, uint32, "pv_pe_alloc_count", "Total number of allocated Physical Extents.") FIELD(PVS, pv, STR, "PV Tags", tags, 7, tags, "pv_tags", "Tags, if any.") +FIELD(PVS, pv, NUM, "#PMda", id, 5, pvmdas, "pv_mda_count", "Number of metadata areas on this device.") FIELD(VGS, vg, STR, "Fmt", cmd, 3, vgfmt, "vg_fmt", "Type of metadata.") FIELD(VGS, vg, STR, "VG UUID", id, 38, uuid, "vg_uuid", "Unique identifier.") @@ -65,6 +66,7 @@ FIELD(VGS, vg, NUM, "#SN", snapshot_count, 3, uint32, "snap_count", "Number of snapshots.") FIELD(VGS, vg, NUM, "Seq", seqno, 3, uint32, "vg_seqno", "Revision number of internal metadata. Incremented whenever it changes.") FIELD(VGS, vg, STR, "VG Tags", tags, 7, tags, "vg_tags", "Tags, if any.") +FIELD(VGS, vg, NUM, "#VMda", cmd, 5, vgmdas, "vg_mda_count", "Number of metadata areas in use by this VG.") FIELD(SEGS, seg, STR, "Type", list, 4, segtype, "segtype", "Type of LV segment") FIELD(SEGS, seg, NUM, "#Str", area_count, 4, uint32, "stripes", "Number of stripes or mirror legs.") --- LVM2/lib/report/report.c 2007/03/27 13:35:33 1.56 +++ LVM2/lib/report/report.c 2007/07/09 15:40:43 1.57 @@ -718,6 +718,31 @@ return dm_report_field_int32(rh, field, data); } +static int _pvmdas_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + struct lvmcache_info *info; + uint32_t count; + + info = info_from_pvid((const char *)(&((struct id *) data)->uuid)); + count = list_size(&info->mdas); + + return _uint32_disp(rh, mem, field, &count, private); +} + +static int _vgmdas_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + const struct volume_group *vg = (const struct volume_group *) data; + uint32_t count; + + count = list_size(&vg->fid->metadata_areas); + + return _uint32_disp(rh, mem, field, &count, private); +} + static int _lvsegcount_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private) From agk@sourceware.org Tue Jul 10 17:51:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 10 Jul 2007 17:51:00 -0000 Subject: LVM2 ./WHATS_NEW tools/toollib.c Message-ID: <20070710175126.10593.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-10 17:51:26 Modified files: . : WHATS_NEW tools : toollib.c Log message: Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.649&r2=1.650 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102 --- LVM2/WHATS_NEW 2007/07/09 15:40:42 1.649 +++ LVM2/WHATS_NEW 2007/07/10 17:51:26 1.650 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint. Add vg_mda_count and pv_mda_count columns to reports. Fix dumpconfig to use log_print instead of stdout directly. Remove unused parameter 'fid' from _add_pv_to_vg. --- LVM2/tools/toollib.c 2007/06/19 04:36:12 1.101 +++ LVM2/tools/toollib.c 2007/07/10 17:51:26 1.102 @@ -659,7 +659,7 @@ if (ret > ret_max) ret_max = ret; if (sigint_caught()) - return ret_max; + break; } dev_iter_destroy(iter); From agk@sourceware.org Tue Jul 10 18:18:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 10 Jul 2007 18:18:00 -0000 Subject: LVM2/lib/report report.c Message-ID: <20070710181834.29170.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-10 18:18:33 Modified files: lib/report : report.c Log message: Fix pv_mda_count to cope with missing PV. [vgcreate vg1 pv1 pv2; pvremove -ff pv1; pvs -P -o+pv_mda_count =>segfault] Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.57&r2=1.58 --- LVM2/lib/report/report.c 2007/07/09 15:40:43 1.57 +++ LVM2/lib/report/report.c 2007/07/10 18:18:33 1.58 @@ -723,10 +723,11 @@ const void *data, void *private) { struct lvmcache_info *info; - uint32_t count; + uint32_t count = 0; + const char *pvid = (const char *)(&((struct id *) data)->uuid); - info = info_from_pvid((const char *)(&((struct id *) data)->uuid)); - count = list_size(&info->mdas); + info = info_from_pvid(pvid); + count = info ? list_size(&info->mdas) : 0; return _uint32_disp(rh, mem, field, &count, private); } From agk@sourceware.org Tue Jul 10 18:20:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 10 Jul 2007 18:20:00 -0000 Subject: LVM2/lib/report report.c Message-ID: <20070710182000.30019.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-10 18:20:00 Modified files: lib/report : report.c Log message: tidy Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59 --- LVM2/lib/report/report.c 2007/07/10 18:18:33 1.58 +++ LVM2/lib/report/report.c 2007/07/10 18:20:00 1.59 @@ -723,7 +723,7 @@ const void *data, void *private) { struct lvmcache_info *info; - uint32_t count = 0; + uint32_t count; const char *pvid = (const char *)(&((struct id *) data)->uuid); info = info_from_pvid(pvid); @@ -906,8 +906,8 @@ #undef FIELD void *report_init(struct cmd_context *cmd, const char *format, const char *keys, - report_type_t *report_type, const char *separator, - int aligned, int buffered, int headings) + report_type_t *report_type, const char *separator, + int aligned, int buffered, int headings) { uint32_t report_flags = 0; @@ -920,7 +920,7 @@ if (headings) report_flags |= DM_REPORT_OUTPUT_HEADINGS; - return dm_report_init(report_type, _report_types, _fields, format, + return dm_report_init(report_type, _report_types, _fields, format, separator, report_flags, keys, cmd); } From agk@sourceware.org Tue Jul 10 18:50:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 10 Jul 2007 18:50:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/merge.c Message-ID: <20070710185003.14487.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-10 18:50:03 Modified files: . : WHATS_NEW lib/metadata : merge.c Log message: Cope with find_seg_by_le() failure in check_lv_segments(). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.650&r2=1.651 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/merge.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28 --- LVM2/WHATS_NEW 2007/07/10 17:51:26 1.650 +++ LVM2/WHATS_NEW 2007/07/10 18:50:02 1.651 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Cope with find_seg_by_le() failure in check_lv_segments(). Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint. Add vg_mda_count and pv_mda_count columns to reports. Fix dumpconfig to use log_print instead of stdout directly. --- LVM2/lib/metadata/merge.c 2005/10/28 12:48:50 1.27 +++ LVM2/lib/metadata/merge.c 2007/07/10 18:50:03 1.28 @@ -146,9 +146,9 @@ if (complete_vg && seg_lv(seg, s) && (seg_lv(seg, s)->status & MIRROR_IMAGE) && - (find_seg_by_le(seg_lv(seg, s), - seg_le(seg, s))->mirror_seg - != seg)) { + (!(seg2 = find_seg_by_le(seg_lv(seg, s), + seg_le(seg, s))) || + seg2->mirror_seg != seg)) { log_error("LV %s: segment %u mirror " "image %u missing mirror ptr", lv->name, seg_count, s); From pcaulfield@sourceware.org Wed Jul 11 12:07:00 2007 From: pcaulfield@sourceware.org (pcaulfield@sourceware.org) Date: Wed, 11 Jul 2007 12:07:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd-openais.c Message-ID: <20070711120740.12673.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: pcaulfield@sourceware.org 2007-07-11 12:07:39 Modified files: . : WHATS_NEW daemons/clvmd : clvmd-openais.c Log message: Tidy bits of clvmd-openais and improve an error report. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.651&r2=1.652 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-openais.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3 --- LVM2/WHATS_NEW 2007/07/10 18:50:02 1.651 +++ LVM2/WHATS_NEW 2007/07/11 12:07:39 1.652 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Tidy clvmd-openais of redundant bits, and improve an error report. Cope with find_seg_by_le() failure in check_lv_segments(). Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint. Add vg_mda_count and pv_mda_count columns to reports. --- LVM2/daemons/clvmd/clvmd-openais.c 2007/06/25 09:02:37 1.2 +++ LVM2/daemons/clvmd/clvmd-openais.c 2007/07/11 12:07:39 1.3 @@ -37,7 +37,6 @@ #include #include -#include #include #include "list.h" @@ -346,7 +345,6 @@ SaAisErrorT err; SaVersionT ver = { 'B', 1, 1 }; int select_fd; - SaClmClusterNodeT cluster_node; node_hash = dm_hash_create(100); lock_hash = dm_hash_create(10); @@ -379,19 +377,18 @@ cpg_finalize(cpg_handle); saLckFinalize(lck_handle); syslog(LOG_ERR, "Cannot join clvmd process group"); - DEBUGLOG("Cannot join clvmd process group\n"); + DEBUGLOG("Cannot join clvmd process group: %d\n", err); return ais_to_errno(err); } err = cpg_local_get(cpg_handle, - &cluster_node); + &our_nodeid); if (err != SA_AIS_OK) { cpg_finalize(cpg_handle); saLckFinalize(lck_handle); syslog(LOG_ERR, "Cannot get local node id\n"); return ais_to_errno(err); } - our_nodeid = cluster_node.nodeId; DEBUGLOG("Our local node id is %d\n", our_nodeid); saLckSelectionObjectGet(lck_handle, (SaSelectionObjectT *)&select_fd); From wysochanski@sourceware.org Wed Jul 11 23:33:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Wed, 11 Jul 2007 23:33:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/metadata.c lib/m ... Message-ID: <20070711233313.28767.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-11 23:33:12 Modified files: . : WHATS_NEW lib/metadata : metadata.c metadata.h Log message: Add pv_read_path, a proposed external LVM library function to take a device path and return a PV handle Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.652&r2=1.653 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.123&r2=1.124 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.166&r2=1.167 --- LVM2/WHATS_NEW 2007/07/11 12:07:39 1.652 +++ LVM2/WHATS_NEW 2007/07/11 23:33:12 1.653 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Add pv_read_path external library function. Tidy clvmd-openais of redundant bits, and improve an error report. Cope with find_seg_by_le() failure in check_lv_segments(). Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint. --- LVM2/lib/metadata/metadata.c 2007/07/02 21:48:30 1.123 +++ LVM2/lib/metadata/metadata.c 2007/07/11 23:33:12 1.124 @@ -72,7 +72,6 @@ struct physical_volume *pv; struct format_instance *fid = vg->fid; struct dm_pool *mem = fid->fmt->cmd->mem; - struct list mdas; log_verbose("Adding physical volume '%s' to volume group '%s'", pv_name, vg->name); @@ -82,8 +81,7 @@ return 0; } - list_init(&mdas); - if (!(pv = _pv_read(fid->fmt->cmd, pv_name, &mdas, NULL, 1))) { + if (!(pv = pv_read_path(fid->fmt->cmd, pv_name))) { log_error("%s not identified as an existing physical volume", pv_name); return 0; @@ -1842,3 +1840,22 @@ { return vg->status; } + + +/** + * pv_read_path - Given a device path return a PV handle if it is a PV + * @cmd - handle to the LVM command instance + * @pv_name - device path to read for the PV + * + * Returns: + * NULL - device path does not contain a valid PV + * non-NULL - PV handle corresponding to device path + * + */ +pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name) +{ + struct list mdas; + + list_init(&mdas); + return _pv_read(cmd, pv_name, &mdas, NULL, 1); +} --- LVM2/lib/metadata/metadata.h 2007/06/19 04:36:12 1.166 +++ LVM2/lib/metadata/metadata.h 2007/07/11 23:33:12 1.167 @@ -638,7 +638,7 @@ char *buffer, size_t len); /* - * Gets/Sets for external LVM library + * Begin skeleton for external LVM library */ struct id pv_id(pv_t *pv); const struct format_type *pv_format_type(pv_t *pv); @@ -654,4 +654,6 @@ uint32_t vg_status(vg_t *vg); +pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name); + #endif From wysochanski@sourceware.org Thu Jul 12 04:12:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 12 Jul 2007 04:12:00 -0000 Subject: LVM2/lib/metadata metadata.c Message-ID: <20070712041204.18616.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-12 04:12:04 Modified files: lib/metadata : metadata.c Log message: Refactor vg_extend error path. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.124&r2=1.125 --- LVM2/lib/metadata/metadata.c 2007/07/11 23:33:12 1.124 +++ LVM2/lib/metadata/metadata.c 2007/07/12 04:12:04 1.125 @@ -249,15 +249,17 @@ /* attach each pv */ for (i = 0; i < pv_count; i++) - if (!_add_pv_to_vg(vg, pv_names[i])) { - log_error("Unable to add physical volume '%s' to " - "volume group '%s'.", pv_names[i], vg->name); - return 0; - } + if (!_add_pv_to_vg(vg, pv_names[i])) + goto bad; /* FIXME Decide whether to initialise and add new mdahs to format instance */ return 1; + + bad: + log_error("Unable to add physical volume '%s' to " + "volume group '%s'.", pv_names[i], vg->name); + return 0; } const char *strip_dir(const char *vg_name, const char *dev_dir) From wysochanski@sourceware.org Thu Jul 12 05:04:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 12 Jul 2007 05:04:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/metadata.c lib/m ... Message-ID: <20070712050443.13625.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-12 05:04:42 Modified files: . : WHATS_NEW lib/metadata : metadata.c metadata.h Log message: Turn _add_pv_to_vg() into external library function add_pv_to_vg() Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.653&r2=1.654 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.125&r2=1.126 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.167&r2=1.168 --- LVM2/WHATS_NEW 2007/07/11 23:33:12 1.653 +++ LVM2/WHATS_NEW 2007/07/12 05:04:39 1.654 @@ -1,6 +1,7 @@ Version 2.02.27 - ================================ - Add pv_read_path external library function. + Turn _add_pv_to_vg() into external library function add_pv_to_vg(). + Add pv_read_path() external library function. Tidy clvmd-openais of redundant bits, and improve an error report. Cope with find_seg_by_le() failure in check_lv_segments(). Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint. --- LVM2/lib/metadata/metadata.c 2007/07/12 04:12:04 1.125 +++ LVM2/lib/metadata/metadata.c 2007/07/12 05:04:41 1.126 @@ -66,10 +66,21 @@ return MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT; } -static int _add_pv_to_vg(struct volume_group *vg, const char *pv_name) +/** + * add_pv_to_vg - Add a physical volume to a volume group + * @vg - volume group to add to + * @pv_name - name of the pv (to be removed) + * @pv - physical volume to add to volume group + * + * Returns: + * 0 - failure + * 1 - success + * FIXME: remove pv_name - obtain safely from pv + */ +int add_pv_to_vg(struct volume_group *vg, const char *pv_name, + struct physical_volume *pv) { struct pv_list *pvl; - struct physical_volume *pv; struct format_instance *fid = vg->fid; struct dm_pool *mem = fid->fmt->cmd->mem; @@ -81,12 +92,6 @@ return 0; } - if (!(pv = pv_read_path(fid->fmt->cmd, pv_name))) { - log_error("%s not identified as an existing physical volume", - pv_name); - return 0; - } - if (*pv->vg_name) { log_error("Physical volume '%s' is already in volume group " "'%s'", pv_name, pv->vg_name); @@ -246,11 +251,19 @@ int vg_extend(struct volume_group *vg, int pv_count, char **pv_names) { int i; + struct physical_volume *pv; /* attach each pv */ - for (i = 0; i < pv_count; i++) - if (!_add_pv_to_vg(vg, pv_names[i])) + for (i = 0; i < pv_count; i++) { + if (!(pv = pv_read_path(vg->fid->fmt->cmd, pv_names[i]))) { + log_error("%s not identified as an existing " + "physical volume", pv_names[i]); goto bad; + } + + if (!add_pv_to_vg(vg, pv_names[i], pv)) + goto bad; + } /* FIXME Decide whether to initialise and add new mdahs to format instance */ @@ -1854,7 +1867,7 @@ * non-NULL - PV handle corresponding to device path * */ -pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name) +pv_t *pv_read_path(struct cmd_context *cmd, const char *pv_name) { struct list mdas; --- LVM2/lib/metadata/metadata.h 2007/07/11 23:33:12 1.167 +++ LVM2/lib/metadata/metadata.h 2007/07/12 05:04:42 1.168 @@ -654,6 +654,8 @@ uint32_t vg_status(vg_t *vg); -pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name); +pv_t *pv_read_path(struct cmd_context *cmd, const char *pv_name); +int add_pv_to_vg(struct volume_group *vg, const char *pv_name, + struct physical_volume *pv); #endif From wysochanski@sourceware.org Thu Jul 12 15:38:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 12 Jul 2007 15:38:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/metadata.c lib/m ... Message-ID: <20070712153853.29439.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-12 15:38:53 Modified files: . : WHATS_NEW lib/metadata : metadata.c metadata.h Log message: Change pv_read_path to pv_by_path Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.654&r2=1.655 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.126&r2=1.127 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.168&r2=1.169 --- LVM2/WHATS_NEW 2007/07/12 05:04:39 1.654 +++ LVM2/WHATS_NEW 2007/07/12 15:38:52 1.655 @@ -1,7 +1,7 @@ Version 2.02.27 - ================================ Turn _add_pv_to_vg() into external library function add_pv_to_vg(). - Add pv_read_path() external library function. + Add pv_by_path() external library function. Tidy clvmd-openais of redundant bits, and improve an error report. Cope with find_seg_by_le() failure in check_lv_segments(). Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint. --- LVM2/lib/metadata/metadata.c 2007/07/12 05:04:41 1.126 +++ LVM2/lib/metadata/metadata.c 2007/07/12 15:38:53 1.127 @@ -255,7 +255,7 @@ /* attach each pv */ for (i = 0; i < pv_count; i++) { - if (!(pv = pv_read_path(vg->fid->fmt->cmd, pv_names[i]))) { + if (!(pv = pv_by_path(vg->fid->fmt->cmd, pv_names[i]))) { log_error("%s not identified as an existing " "physical volume", pv_names[i]); goto bad; @@ -1858,7 +1858,7 @@ /** - * pv_read_path - Given a device path return a PV handle if it is a PV + * pv_by_path - Given a device path return a PV handle if it is a PV * @cmd - handle to the LVM command instance * @pv_name - device path to read for the PV * @@ -1866,8 +1866,9 @@ * NULL - device path does not contain a valid PV * non-NULL - PV handle corresponding to device path * + * FIXME: merge with find_pv_by_name ? */ -pv_t *pv_read_path(struct cmd_context *cmd, const char *pv_name) +pv_t *pv_by_path(struct cmd_context *cmd, const char *pv_name) { struct list mdas; --- LVM2/lib/metadata/metadata.h 2007/07/12 05:04:42 1.168 +++ LVM2/lib/metadata/metadata.h 2007/07/12 15:38:53 1.169 @@ -654,7 +654,7 @@ uint32_t vg_status(vg_t *vg); -pv_t *pv_read_path(struct cmd_context *cmd, const char *pv_name); +pv_t *pv_by_path(struct cmd_context *cmd, const char *pv_name); int add_pv_to_vg(struct volume_group *vg, const char *pv_name, struct physical_volume *pv); From agk@sourceware.org Fri Jul 13 17:08:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 13 Jul 2007 17:08:00 -0000 Subject: LVM2 WHATS_NEW configure configure.in Message-ID: <20070713170804.9637.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-13 17:08:00 Modified files: . : WHATS_NEW configure configure.in Log message: Fix configure libdevmapper.h check when --with-dmdir is used. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.655&r2=1.656 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.diff?cvsroot=lvm2&r1=1.57&r2=1.58 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.56&r2=1.57 --- LVM2/WHATS_NEW 2007/07/12 15:38:52 1.655 +++ LVM2/WHATS_NEW 2007/07/13 17:08:00 1.656 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Fix configure libdevmapper.h check when --with-dmdir is used. Turn _add_pv_to_vg() into external library function add_pv_to_vg(). Add pv_by_path() external library function. Tidy clvmd-openais of redundant bits, and improve an error report. --- LVM2/configure 2007/01/09 22:07:20 1.57 +++ LVM2/configure 2007/07/13 17:08:00 1.58 @@ -8957,7 +8957,7 @@ # Check whether --with-dmdir or --without-dmdir was given. if test "${with_dmdir+set}" = set; then withval="$with_dmdir" - DMDIR="$withval" + DMDIR="$withval" CPPFLAGS="$CPPFLAGS -I$DMDIR/include" else DMDIR= fi; --- LVM2/configure.in 2007/01/09 22:07:20 1.56 +++ LVM2/configure.in 2007/07/13 17:08:00 1.57 @@ -522,7 +522,7 @@ AC_ARG_WITH(dmdir, [ --with-dmdir=DIR Build against device-mapper source tree in DIR], - [ DMDIR="$withval" ], + [ DMDIR="$withval" CPPFLAGS="$CPPFLAGS -I$DMDIR/include"], [ DMDIR= ]) ################################################################################ From mbroz@sourceware.org Tue Jul 17 16:13:00 2007 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 17 Jul 2007 16:13:00 -0000 Subject: LVM2 ./WHATS_NEW tools/lvcreate.c Message-ID: <20070717161313.24537.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2007-07-17 16:13:12 Modified files: . : WHATS_NEW tools : lvcreate.c Log message: Fix snapshot cow area deactivation if origin is not active. (2.02.13) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.656&r2=1.657 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.137&r2=1.138 --- LVM2/WHATS_NEW 2007/07/13 17:08:00 1.656 +++ LVM2/WHATS_NEW 2007/07/17 16:13:12 1.657 @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Fix snapshot cow area deactivation if origin is not active. (2.02.13) Fix configure libdevmapper.h check when --with-dmdir is used. Turn _add_pv_to_vg() into external library function add_pv_to_vg(). Add pv_by_path() external library function. --- LVM2/tools/lvcreate.c 2007/06/28 17:33:44 1.137 +++ LVM2/tools/lvcreate.c 2007/07/17 16:13:12 1.138 @@ -478,10 +478,11 @@ struct logical_volume *lv, *org = NULL, *log_lv = NULL; struct list *pvh, tags; const char *tag = NULL; - int consistent = 1; + int consistent = 1, origin_active = 0; struct alloc_handle *ah = NULL; char lv_name_buf[128]; const char *lv_name; + struct lvinfo info; status |= lp->permission | VISIBLE_LV; @@ -615,6 +616,13 @@ /* Must zero cow */ status |= LVM_WRITE; + + if (!lv_info(cmd, org, &info, 0)) { + log_error("Check for existence of snapshot origin " + "'%s' failed.", org->name); + return 0; + } + origin_active = info.exists; } if (!lp->extents) { @@ -792,6 +800,13 @@ if (!(lp->permission & LVM_WRITE)) lv->status &= ~LVM_WRITE; + /* COW area must be deactivated if origin is not active */ + if (!origin_active && !deactivate_lv(cmd, lv)) { + log_error("Aborting. Couldn't deactivate snapshot " + "COW area."); + return 0; + } + /* cow LV remains active and becomes snapshot LV */ if (!vg_add_snapshot(vg->fid, NULL, org, lv, NULL, From agk@sourceware.org Tue Jul 17 20:45:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 17 Jul 2007 20:45:00 -0000 Subject: LVM2 VERSION WHATS_NEW Message-ID: <20070717204518.6745.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-17 20:45:18 Modified files: . : VERSION WHATS_NEW Log message: pre-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.154&r2=1.155 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.657&r2=1.658 --- LVM2/VERSION 2007/06/15 20:49:09 1.154 +++ LVM2/VERSION 2007/07/17 20:45:17 1.155 @@ -1 +1 @@ -2.02.27-cvs (2007-06-15) +2.02.27-cvs (2007-07-17) --- LVM2/WHATS_NEW 2007/07/17 16:13:12 1.657 +++ LVM2/WHATS_NEW 2007/07/17 20:45:17 1.658 @@ -1,4 +1,4 @@ -Version 2.02.27 - +Version 2.02.27 - 17th July 2007 ================================ Fix snapshot cow area deactivation if origin is not active. (2.02.13) Fix configure libdevmapper.h check when --with-dmdir is used. From agk@sourceware.org Tue Jul 17 20:53:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 17 Jul 2007 20:53:00 -0000 Subject: LVM2 VERSION WHATS_NEW Message-ID: <20070717205351.9828.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-17 20:53:51 Modified files: . : VERSION WHATS_NEW Log message: post-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.155&r2=1.156 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.658&r2=1.659 --- LVM2/VERSION 2007/07/17 20:45:17 1.155 +++ LVM2/VERSION 2007/07/17 20:53:51 1.156 @@ -1 +1 @@ -2.02.27-cvs (2007-07-17) +2.02.28-cvs (2007-07-17) --- LVM2/WHATS_NEW 2007/07/17 20:45:17 1.658 +++ LVM2/WHATS_NEW 2007/07/17 20:53:51 1.659 @@ -1,3 +1,6 @@ +Version 2.02.28 - +================================ + Version 2.02.27 - 17th July 2007 ================================ Fix snapshot cow area deactivation if origin is not active. (2.02.13) From agk@sourceware.org Wed Jul 18 15:39:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 18 Jul 2007 15:39:00 -0000 Subject: LVM2 ./WHATS_NEW include/.symlinks lib/activat ... Message-ID: <20070718153900.28800.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-18 15:38:58 Modified files: . : WHATS_NEW include : .symlinks lib/activate : activate.h lib/display : display.h lib/error : errseg.c lib/format_text: archiver.h lib/metadata : metadata.h lib/report : report.h lib/striped : striped.c lib/zero : zero.c tools : polldaemon.h toollib.h tools.h Added files: lib/metadata : metadata-exported.h Log message: Split metadata-external.h out from metadata.h for the tools to use. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.659&r2=1.660 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/include/.symlinks.diff?cvsroot=lvm2&r1=1.44&r2=1.45 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.55&r2=1.56 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.h.diff?cvsroot=lvm2&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/error/errseg.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/archiver.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.169&r2=1.170 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.h.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/striped/striped.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/zero/zero.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.46&r2=1.47 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.52&r2=1.53 --- LVM2/WHATS_NEW 2007/07/17 20:53:51 1.659 +++ LVM2/WHATS_NEW 2007/07/18 15:38:57 1.660 @@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Split metadata-external.h out from metadata.h for the tools to use. Version 2.02.27 - 17th July 2007 ================================ --- LVM2/include/.symlinks 2007/04/27 18:52:05 1.44 +++ LVM2/include/.symlinks 2007/07/18 15:38:57 1.45 @@ -30,6 +30,7 @@ ../lib/log/log.h ../lib/metadata/lv_alloc.h ../lib/metadata/metadata.h +../lib/metadata/metadata-exported.h ../lib/metadata/pv_alloc.h ../lib/metadata/segtype.h ../lib/mm/memlock.h --- LVM2/lib/activate/activate.h 2007/03/08 21:08:25 1.55 +++ LVM2/lib/activate/activate.h 2007/07/18 15:38:57 1.56 @@ -16,7 +16,7 @@ #ifndef LVM_ACTIVATE_H #define LVM_ACTIVATE_H -#include "metadata.h" +#include "metadata-exported.h" struct lvinfo { int exists; --- LVM2/lib/display/display.h 2007/05/30 20:43:09 1.17 +++ LVM2/lib/display/display.h 2007/07/18 15:38:57 1.18 @@ -16,7 +16,7 @@ #ifndef _LVM_DISPLAY_H #define _LVM_DISPLAY_H -#include "metadata.h" +#include "metadata-exported.h" #include --- LVM2/lib/error/errseg.c 2006/10/18 18:01:51 1.12 +++ LVM2/lib/error/errseg.c 2007/07/18 15:38:58 1.13 @@ -24,6 +24,7 @@ #include "lvm-string.h" #include "activate.h" #include "str_list.h" +#include "metadata.h" static const char *_errseg_name(const struct lv_segment *seg) { --- LVM2/lib/format_text/archiver.h 2007/06/08 22:38:48 1.2 +++ LVM2/lib/format_text/archiver.h 2007/07/18 15:38:58 1.3 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -16,7 +16,7 @@ #ifndef _LVM_TOOL_ARCHIVE_H #define _LVM_TOOL_ARCHIVE_H -#include "metadata.h" +#include "metadata-exported.h" /* * There are two operations that come under the general area of /cvs/lvm2/LVM2/lib/metadata/metadata-exported.h,v --> standard output revision 1.1 --- LVM2/lib/metadata/metadata-exported.h +++ - 2007-07-18 15:38:59.653039000 +0000 @@ -0,0 +1,451 @@ +/* + * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. + * Copyright (C) 2004-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 + */ + +/* + * This is the representation of LVM metadata that is being adapted + * for library export. + */ + +#ifndef _LVM_METADATA_EXPORTED_H +#define _LVM_METADATA_EXPORTED_H + +#include "uuid.h" + +struct physical_volume; +typedef struct physical_volume pv_t; +struct volume_group; +typedef struct volume_group vg_t; + +struct logical_volume; + +struct lv_segment; +struct pv_segment; + +#define MAX_STRIPES 128U +#define SECTOR_SHIFT 9L +#define STRIPE_SIZE_MIN ( (unsigned) lvm_getpagesize() >> SECTOR_SHIFT) /* PAGESIZE in sectors */ +#define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ +#define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1) +#define PV_MIN_SIZE ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ +#define MAX_RESTRICTED_LVS 255 /* Used by FMT_RESTRICTED_LVIDS */ + +/* Various flags */ +/* Note that the bits no longer necessarily correspond to LVM1 disk format */ + +#define PARTIAL_VG 0x00000001U /* VG */ +#define EXPORTED_VG 0x00000002U /* VG PV */ +#define RESIZEABLE_VG 0x00000004U /* VG */ + +/* May any free extents on this PV be used or must they be left free? */ +#define ALLOCATABLE_PV 0x00000008U /* PV */ + +//#define SPINDOWN_LV 0x00000010U /* LV */ +//#define BADBLOCK_ON 0x00000020U /* LV */ +#define VISIBLE_LV 0x00000040U /* LV */ +#define FIXED_MINOR 0x00000080U /* LV */ +/* FIXME Remove when metadata restructuring is completed */ +#define SNAPSHOT 0x00001000U /* LV - internal use only */ +#define PVMOVE 0x00002000U /* VG LV SEG */ +#define LOCKED 0x00004000U /* LV */ +#define MIRRORED 0x00008000U /* LV - internal use only */ +//#define VIRTUAL 0x00010000U /* LV - internal use only */ +#define MIRROR_LOG 0x00020000U /* LV */ +#define MIRROR_IMAGE 0x00040000U /* LV */ +#define MIRROR_NOTSYNCED 0x00080000U /* LV */ +//#define ACTIVATE_EXCL 0x00100000U /* LV - internal use only */ +//#define PRECOMMITTED 0x00200000U /* VG - internal use only */ + +#define LVM_READ 0x00000100U /* LV VG */ +#define LVM_WRITE 0x00000200U /* LV VG */ +#define CLUSTERED 0x00000400U /* VG */ +//#define SHARED 0x00000800U /* VG */ + +/* Format features flags */ +#define FMT_SEGMENTS 0x00000001U /* Arbitrary segment params? */ +#define FMT_MDAS 0x00000002U /* Proper metadata areas? */ +#define FMT_TAGS 0x00000004U /* Tagging? */ +#define FMT_UNLIMITED_VOLS 0x00000008U /* Unlimited PVs/LVs? */ +#define FMT_RESTRICTED_LVIDS 0x00000010U /* LVID <= 255 */ +#define FMT_ORPHAN_ALLOCATABLE 0x00000020U /* Orphan PV allocatable? */ +//#define FMT_PRECOMMIT 0x00000040U /* Supports pre-commit? */ +#define FMT_RESIZE_PV 0x00000080U /* Supports pvresize? */ +#define FMT_UNLIMITED_STRIPESIZE 0x00000100U /* Unlimited stripe size? */ + +/* Ordered list - see lv_manip.c */ +typedef enum { + ALLOC_INVALID, + ALLOC_CONTIGUOUS, + ALLOC_CLING, + ALLOC_NORMAL, + ALLOC_ANYWHERE, + ALLOC_INHERIT +} alloc_policy_t; + +typedef enum { + AREA_UNASSIGNED, + AREA_PV, + AREA_LV +} area_type_t; + +struct cmd_context; +struct format_handler; +struct labeller; + +struct format_type { + struct list list; + struct cmd_context *cmd; + struct format_handler *ops; + struct labeller *labeller; + const char *name; + const char *alias; + uint32_t features; + void *library; + void *private; +}; + +struct pv_segment { + struct list list; /* Member of pv->segments: ordered list + * covering entire data area on this PV */ + + struct physical_volume *pv; + uint32_t pe; + uint32_t len; + + struct lv_segment *lvseg; /* NULL if free space */ + uint32_t lv_area; /* Index to area in LV segment */ +}; + +struct physical_volume { + struct id id; + struct device *dev; + const struct format_type *fmt; + const char *vg_name; + struct id vgid; + + uint32_t status; + uint64_t size; + + /* physical extents */ + uint32_t pe_size; + uint64_t pe_start; + uint32_t pe_count; + uint32_t pe_alloc_count; + + struct list segments; /* Ordered pv_segments covering complete PV */ + struct list tags; +}; + +struct format_instance { + const struct format_type *fmt; + struct list metadata_areas; /* e.g. metadata locations */ + void *private; +}; + +struct volume_group { + struct cmd_context *cmd; + struct format_instance *fid; + uint32_t seqno; /* Metadata sequence number */ + + struct id id; + char *name; + char *system_id; + + uint32_t status; + alloc_policy_t alloc; + + uint32_t extent_size; + uint32_t extent_count; + uint32_t free_count; + + uint32_t max_lv; + uint32_t max_pv; + + /* physical volumes */ + uint32_t pv_count; + struct list pvs; + + /* logical volumes */ + uint32_t lv_count; + uint32_t snapshot_count; + struct list lvs; + + struct list tags; +}; + +/* There will be one area for each stripe */ +struct lv_segment_area { + area_type_t type; + union { + struct { + struct pv_segment *pvseg; + } pv; + struct { + struct logical_volume *lv; + uint32_t le; + } lv; + } u; +}; + +struct segment_type; +struct lv_segment { + struct list list; + struct logical_volume *lv; + + const struct segment_type *segtype; + uint32_t le; + uint32_t len; + + uint32_t status; + + /* FIXME Fields depend on segment type */ + uint32_t stripe_size; + uint32_t area_count; + uint32_t area_len; + struct logical_volume *origin; + struct logical_volume *cow; + struct list origin_list; + uint32_t chunk_size; /* For snapshots - in sectors */ + uint32_t region_size; /* For mirrors - in sectors */ + uint32_t extents_copied; + struct logical_volume *log_lv; + struct lv_segment *mirror_seg; + + struct list tags; + + struct lv_segment_area *areas; +}; + +#define seg_type(seg, s) (seg)->areas[(s)].type +#define seg_pv(seg, s) (seg)->areas[(s)].u.pv.pvseg->pv +#define seg_lv(seg, s) (seg)->areas[(s)].u.lv.lv + +struct logical_volume { + union lvid lvid; + char *name; + + struct volume_group *vg; + + uint32_t status; + alloc_policy_t alloc; + uint32_t read_ahead; + int32_t major; + int32_t minor; + + uint64_t size; /* Sectors */ + uint32_t le_count; + + uint32_t origin_count; + struct list snapshot_segs; + struct lv_segment *snapshot; + + struct list segments; + struct list tags; +}; + +struct pe_range { + struct list list; + uint32_t start; /* PEs */ + uint32_t count; /* PEs */ +}; + +struct pv_list { + struct list list; + struct physical_volume *pv; + struct list *mdas; /* Metadata areas */ + struct list *pe_ranges; /* Ranges of PEs e.g. for allocation */ +}; + +struct lv_list { + struct list list; + struct logical_volume *lv; +}; + +/* +* Utility functions +*/ +int vg_write(struct volume_group *vg); +int vg_commit(struct volume_group *vg); +int vg_revert(struct volume_group *vg); +struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, + const char *vgid, int *consistent); +struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name, + struct list *mdas, uint64_t *label_sector, + int warnings); +struct list *get_pvs(struct cmd_context *cmd); + +/* Set full_scan to 1 to re-read every (filtered) device label */ +struct list *get_vgs(struct cmd_context *cmd, int full_scan); +struct list *get_vgids(struct cmd_context *cmd, int full_scan); + +int pv_write(struct cmd_context *cmd, struct physical_volume *pv, + struct list *mdas, int64_t label_sector); +int is_orphan(pv_t *pv); + +/* pe_start and pe_end relate to any existing data so that new metadata +* areas can avoid overlap */ +pv_t *pv_create(const struct format_type *fmt, + struct device *dev, + struct id *id, + uint64_t size, + uint64_t pe_start, + uint32_t existing_extent_count, + uint32_t existing_extent_size, + int pvmetadatacopies, + uint64_t pvmetadatasize, struct list *mdas); +int pv_resize(struct physical_volume *pv, struct volume_group *vg, + uint32_t new_pe_count); +int pv_analyze(struct cmd_context *cmd, const char *pv_name, + int64_t label_sector); + +struct volume_group *vg_create(struct cmd_context *cmd, const char *name, + uint32_t extent_size, uint32_t max_pv, + uint32_t max_lv, alloc_policy_t alloc, + int pv_count, char **pv_names); +int vg_remove(struct volume_group *vg); +int vg_rename(struct cmd_context *cmd, struct volume_group *vg, + const char *new_name); +int vg_extend(struct volume_group *vg, 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, + const char *name, + union lvid *lvid, + uint32_t status, + alloc_policy_t alloc, + int import, + struct volume_group *vg); + +/* Reduce the size of an LV by extents */ +int lv_reduce(struct logical_volume *lv, uint32_t extents); + +/* Empty an LV prior to deleting it */ +int lv_empty(struct logical_volume *lv); + +/* Entry point for all LV extent allocations */ +int lv_extend(struct logical_volume *lv, + const struct segment_type *segtype, + uint32_t stripes, uint32_t stripe_size, + uint32_t mirrors, uint32_t extents, + struct physical_volume *mirrored_pv, uint32_t mirrored_pe, + uint32_t status, struct list *allocatable_pvs, + alloc_policy_t alloc); + +/* lv must be part of lv->vg->lvs */ +int lv_remove(struct logical_volume *lv); + +/* Find a PV within a given VG */ +struct pv_list *find_pv_in_vg(struct volume_group *vg, const char *pv_name); +pv_t *find_pv_in_vg_by_uuid(struct volume_group *vg, struct id *id); + +/* Find an LV within a given VG */ +struct lv_list *find_lv_in_vg(struct volume_group *vg, const char *lv_name); + +/* FIXME Merge these functions with ones above */ +struct logical_volume *find_lv(struct volume_group *vg, const char *lv_name); +struct physical_volume *find_pv_by_name(struct cmd_context *cmd, + const char *pv_name); + +/* Find LV segment containing given LE */ +struct lv_segment *first_seg(struct logical_volume *lv); + + +/* +* Useful functions for managing snapshots. +*/ +int lv_is_origin(const struct logical_volume *lv); +int lv_is_cow(const struct logical_volume *lv); +int lv_is_visible(const struct logical_volume *lv); + +int pv_is_in_vg(struct volume_group *vg, struct physical_volume *pv); + +/* Given a cow LV, return return the snapshot lv_segment that uses it */ +struct lv_segment *find_cow(const struct logical_volume *lv); + +/* Given a cow LV, return its origin */ +struct logical_volume *origin_from_cow(const struct logical_volume *lv); + +int vg_add_snapshot(struct format_instance *fid, const char *name, + struct logical_volume *origin, struct logical_volume *cow, + union lvid *lvid, uint32_t extent_count, + uint32_t chunk_size); + +int vg_remove_snapshot(struct logical_volume *cow); + +int vg_check_status(struct volume_group *vg, uint32_t status); + +/* +* Mirroring functions +*/ +struct alloc_handle; +uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents, + uint32_t region_size); +int create_mirror_layers(struct alloc_handle *ah, + uint32_t first_area, + uint32_t num_mirrors, + struct logical_volume *lv, + const struct segment_type *segtype, + uint32_t status, + uint32_t region_size, + struct logical_volume *log_lv); + +int remove_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, + struct list *removable_pvs, int remove_log); +int reconfigure_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, + struct list *removable_pvs, int remove_log); + +int insert_pvmove_mirrors(struct cmd_context *cmd, + struct logical_volume *lv_mirr, + struct list *source_pvl, + struct logical_volume *lv, + struct list *allocatable_pvs, + alloc_policy_t alloc, + struct list *lvs_changed); +int remove_pvmove_mirrors(struct volume_group *vg, + struct logical_volume *lv_mirr); +struct logical_volume *find_pvmove_lv(struct volume_group *vg, + struct device *dev, uint32_t lv_type); +struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd, + struct volume_group *vg, + const char *name, + uint32_t lv_type); +const char *get_pvmove_pvname_from_lv(struct logical_volume *lv); +const char *get_pvmove_pvname_from_lv_mirr(struct logical_volume *lv_mirr); +float copy_percent(struct logical_volume *lv_mirr); +struct list *lvs_using_lv(struct cmd_context *cmd, struct volume_group *vg, + struct logical_volume *lv); + +uint32_t find_free_lvnum(struct logical_volume *lv); +char *generate_lv_name(struct volume_group *vg, const char *format, + char *buffer, size_t len); + +/* +* Begin skeleton for external LVM library +*/ +struct device *pv_dev(pv_t *pv); +const char *pv_vg_name(pv_t *pv); +uint64_t pv_size(pv_t *pv); +uint32_t pv_status(pv_t *pv); +uint32_t pv_pe_size(pv_t *pv); +uint64_t pv_pe_start(pv_t *pv); +uint32_t pv_pe_count(pv_t *pv); +uint32_t pv_pe_alloc_count(pv_t *pv); + +uint32_t vg_status(vg_t *vg); + +#endif --- LVM2/lib/metadata/metadata.h 2007/07/12 15:38:53 1.169 +++ LVM2/lib/metadata/metadata.h 2007/07/18 15:38:58 1.170 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -24,127 +24,61 @@ #include "ctype.h" #include "dev-cache.h" #include "lvm-string.h" -#include "uuid.h" +#include "metadata-exported.h" -#define MAX_STRIPES 128U -#define SECTOR_SHIFT 9L +//#define MAX_STRIPES 128U +//#define SECTOR_SHIFT 9L #define SECTOR_SIZE ( 1L << SECTOR_SHIFT ) -#define STRIPE_SIZE_MIN ( (unsigned) lvm_getpagesize() >> SECTOR_SHIFT) /* PAGESIZE in sectors */ -#define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ -#define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1) -#define PV_MIN_SIZE ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ -#define MAX_RESTRICTED_LVS 255 /* Used by FMT_RESTRICTED_LVIDS */ +//#define STRIPE_SIZE_MIN ( (unsigned) lvm_getpagesize() >> SECTOR_SHIFT) /* PAGESIZE in sectors */ +//#define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ +//#define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1) +//#define PV_MIN_SIZE ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ +//#define MAX_RESTRICTED_LVS 255 /* Used by FMT_RESTRICTED_LVIDS */ #define MIRROR_LOG_SIZE 1 /* Extents */ /* Various flags */ /* Note that the bits no longer necessarily correspond to LVM1 disk format */ -#define PARTIAL_VG 0x00000001U /* VG */ -#define EXPORTED_VG 0x00000002U /* VG PV */ -#define RESIZEABLE_VG 0x00000004U /* VG */ +//#define PARTIAL_VG 0x00000001U /* VG */ +//#define EXPORTED_VG 0x00000002U /* VG PV */ +//#define RESIZEABLE_VG 0x00000004U /* VG */ /* May any free extents on this PV be used or must they be left free? */ -#define ALLOCATABLE_PV 0x00000008U /* PV */ +//#define ALLOCATABLE_PV 0x00000008U /* PV */ #define SPINDOWN_LV 0x00000010U /* LV */ #define BADBLOCK_ON 0x00000020U /* LV */ -#define VISIBLE_LV 0x00000040U /* LV */ -#define FIXED_MINOR 0x00000080U /* LV */ +//#define VISIBLE_LV 0x00000040U /* LV */ +//#define FIXED_MINOR 0x00000080U /* LV */ /* FIXME Remove when metadata restructuring is completed */ -#define SNAPSHOT 0x00001000U /* LV - internal use only */ -#define PVMOVE 0x00002000U /* VG LV SEG */ -#define LOCKED 0x00004000U /* LV */ -#define MIRRORED 0x00008000U /* LV - internal use only */ +//#define SNAPSHOT 0x00001000U /* LV - internal use only */ +//#define PVMOVE 0x00002000U /* VG LV SEG */ +//#define LOCKED 0x00004000U /* LV */ +//#define MIRRORED 0x00008000U /* LV - internal use only */ #define VIRTUAL 0x00010000U /* LV - internal use only */ -#define MIRROR_LOG 0x00020000U /* LV */ -#define MIRROR_IMAGE 0x00040000U /* LV */ -#define MIRROR_NOTSYNCED 0x00080000U /* LV */ +//#define MIRROR_LOG 0x00020000U /* LV */ +//#define MIRROR_IMAGE 0x00040000U /* LV */ +//#define MIRROR_NOTSYNCED 0x00080000U /* LV */ #define ACTIVATE_EXCL 0x00100000U /* LV - internal use only */ #define PRECOMMITTED 0x00200000U /* VG - internal use only */ -#define LVM_READ 0x00000100U /* LV VG */ -#define LVM_WRITE 0x00000200U /* LV VG */ -#define CLUSTERED 0x00000400U /* VG */ +//#define LVM_READ 0x00000100U /* LV VG */ +//#define LVM_WRITE 0x00000200U /* LV VG */ +//#define CLUSTERED 0x00000400U /* VG */ #define SHARED 0x00000800U /* VG */ /* Format features flags */ -#define FMT_SEGMENTS 0x00000001U /* Arbitrary segment params? */ -#define FMT_MDAS 0x00000002U /* Proper metadata areas? */ -#define FMT_TAGS 0x00000004U /* Tagging? */ -#define FMT_UNLIMITED_VOLS 0x00000008U /* Unlimited PVs/LVs? */ -#define FMT_RESTRICTED_LVIDS 0x00000010U /* LVID <= 255 */ -#define FMT_ORPHAN_ALLOCATABLE 0x00000020U /* Orphan PV allocatable? */ +//#define FMT_SEGMENTS 0x00000001U /* Arbitrary segment params? */ +//#define FMT_MDAS 0x00000002U /* Proper metadata areas? */ +//#define FMT_TAGS 0x00000004U /* Tagging? */ +//#define FMT_UNLIMITED_VOLS 0x00000008U /* Unlimited PVs/LVs? */ +//#define FMT_RESTRICTED_LVIDS 0x00000010U /* LVID <= 255 */ +//#define FMT_ORPHAN_ALLOCATABLE 0x00000020U /* Orphan PV allocatable? */ #define FMT_PRECOMMIT 0x00000040U /* Supports pre-commit? */ -#define FMT_RESIZE_PV 0x00000080U /* Supports pvresize? */ -#define FMT_UNLIMITED_STRIPESIZE 0x00000100U /* Unlimited stripe size? */ +//#define FMT_RESIZE_PV 0x00000080U /* Supports pvresize? */ +//#define FMT_UNLIMITED_STRIPESIZE 0x00000100U /* Unlimited stripe size? */ -/* Ordered list - see lv_manip.c */ -typedef enum { - ALLOC_INVALID, - ALLOC_CONTIGUOUS, - ALLOC_CLING, - ALLOC_NORMAL, - ALLOC_ANYWHERE, - ALLOC_INHERIT -} alloc_policy_t; - -typedef enum { - AREA_UNASSIGNED, - AREA_PV, - AREA_LV -} area_type_t; - -struct cmd_context; -struct format_handler; -struct labeller; - -struct format_type { - struct list list; - struct cmd_context *cmd; - struct format_handler *ops; - struct labeller *labeller; - const char *name; - const char *alias; - uint32_t features; - void *library; - void *private; -}; - -struct pv_segment { - struct list list; /* Member of pv->segments: ordered list - * covering entire data area on this PV */ - - struct physical_volume *pv; - uint32_t pe; - uint32_t len; - - struct lv_segment *lvseg; /* NULL if free space */ - uint32_t lv_area; /* Index to area in LV segment */ -}; - -struct physical_volume { - struct id id; - struct device *dev; - const struct format_type *fmt; - const char *vg_name; - struct id vgid; - - uint32_t status; - uint64_t size; - - /* physical extents */ - uint32_t pe_size; - uint64_t pe_start; - uint32_t pe_count; - uint32_t pe_alloc_count; - - struct list segments; /* Ordered pv_segments covering complete PV */ - struct list tags; -}; - -typedef struct physical_volume pv_t; struct metadata_area; -struct format_instance; /* Per-format per-metadata area operations */ struct metadata_area_ops { @@ -198,142 +132,16 @@ void *metadata_locn; }; -struct format_instance { - const struct format_type *fmt; - struct list metadata_areas; /* e.g. metadata locations */ - void *private; -}; - -struct volume_group { - struct cmd_context *cmd; - struct format_instance *fid; - uint32_t seqno; /* Metadata sequence number */ - - struct id id; - char *name; - char *system_id; - - uint32_t status; - alloc_policy_t alloc; - - uint32_t extent_size; - uint32_t extent_count; - uint32_t free_count; - - uint32_t max_lv; - uint32_t max_pv; - - /* physical volumes */ - uint32_t pv_count; - struct list pvs; - - /* logical volumes */ - uint32_t lv_count; - uint32_t snapshot_count; - struct list lvs; - - struct list tags; -}; - -typedef struct volume_group vg_t; - -/* There will be one area for each stripe */ -struct lv_segment_area { - area_type_t type; - union { - struct { - struct pv_segment *pvseg; - } pv; - struct { - struct logical_volume *lv; - uint32_t le; - } lv; - } u; -}; - -struct segment_type; -struct lv_segment { - struct list list; - struct logical_volume *lv; - - const struct segment_type *segtype; - uint32_t le; - uint32_t len; - - uint32_t status; - - /* FIXME Fields depend on segment type */ - uint32_t stripe_size; - uint32_t area_count; - uint32_t area_len; - struct logical_volume *origin; - struct logical_volume *cow; - struct list origin_list; - uint32_t chunk_size; /* For snapshots - in sectors */ - uint32_t region_size; /* For mirrors - in sectors */ - uint32_t extents_copied; - struct logical_volume *log_lv; - struct lv_segment *mirror_seg; - - struct list tags; - - struct lv_segment_area *areas; -}; - -#define seg_type(seg, s) (seg)->areas[(s)].type #define seg_pvseg(seg, s) (seg)->areas[(s)].u.pv.pvseg -#define seg_pv(seg, s) (seg)->areas[(s)].u.pv.pvseg->pv #define seg_dev(seg, s) (seg)->areas[(s)].u.pv.pvseg->pv->dev #define seg_pe(seg, s) (seg)->areas[(s)].u.pv.pvseg->pe -#define seg_lv(seg, s) (seg)->areas[(s)].u.lv.lv #define seg_le(seg, s) (seg)->areas[(s)].u.lv.le -struct logical_volume { - union lvid lvid; - char *name; - - struct volume_group *vg; - - uint32_t status; - alloc_policy_t alloc; - uint32_t read_ahead; - int32_t major; - int32_t minor; - - uint64_t size; /* Sectors */ - uint32_t le_count; - - uint32_t origin_count; - struct list snapshot_segs; - struct lv_segment *snapshot; - - struct list segments; - struct list tags; -}; - struct name_list { struct list list; char *name; }; -struct pe_range { - struct list list; - uint32_t start; /* PEs */ - uint32_t count; /* PEs */ -}; - -struct pv_list { - struct list list; - struct physical_volume *pv; - struct list *mdas; /* Metadata areas */ - struct list *pe_ranges; /* Ranges of PEs e.g. for allocation */ -}; - -struct lv_list { - struct list list; - struct logical_volume *lv; -}; - struct mda_list { struct list list; struct device_area mda; @@ -421,80 +229,8 @@ */ unsigned long pe_align(void); int vg_validate(struct volume_group *vg); -int vg_write(struct volume_group *vg); -int vg_commit(struct volume_group *vg); -int vg_revert(struct volume_group *vg); -struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, - const char *vgid, int *consistent); -struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name, - struct list *mdas, uint64_t *label_sector, - int warnings); -struct list *get_pvs(struct cmd_context *cmd); - -/* Set full_scan to 1 to re-read every (filtered) device label */ -struct list *get_vgs(struct cmd_context *cmd, int full_scan); -struct list *get_vgids(struct cmd_context *cmd, int full_scan); -int pv_write(struct cmd_context *cmd, struct physical_volume *pv, - struct list *mdas, int64_t label_sector); int pv_write_orphan(struct cmd_context *cmd, struct physical_volume *pv); -int is_orphan(pv_t *pv); - -/* pe_start and pe_end relate to any existing data so that new metadata - * areas can avoid overlap */ -pv_t *pv_create(const struct format_type *fmt, - struct device *dev, - struct id *id, - uint64_t size, - uint64_t pe_start, - uint32_t existing_extent_count, - uint32_t existing_extent_size, - int pvmetadatacopies, - uint64_t pvmetadatasize, struct list *mdas); -int pv_resize(struct physical_volume *pv, struct volume_group *vg, - uint32_t new_pe_count); -int pv_analyze(struct cmd_context *cmd, const char *pv_name, - int64_t label_sector); - -struct volume_group *vg_create(struct cmd_context *cmd, const char *name, - uint32_t extent_size, uint32_t max_pv, - uint32_t max_lv, alloc_policy_t alloc, - int pv_count, char **pv_names); -int vg_remove(struct volume_group *vg); -int vg_rename(struct cmd_context *cmd, struct volume_group *vg, - const char *new_name); -int vg_extend(struct volume_group *vg, 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, - const char *name, - union lvid *lvid, - uint32_t status, - alloc_policy_t alloc, - int import, - struct volume_group *vg); - -/* Reduce the size of an LV by extents */ -int lv_reduce(struct logical_volume *lv, uint32_t extents); - -/* Empty an LV prior to deleting it */ -int lv_empty(struct logical_volume *lv); - -/* Entry point for all LV extent allocations */ -int lv_extend(struct logical_volume *lv, - const struct segment_type *segtype, - uint32_t stripes, uint32_t stripe_size, - uint32_t mirrors, uint32_t extents, - struct physical_volume *mirrored_pv, uint32_t mirrored_pe, - uint32_t status, struct list *allocatable_pvs, - alloc_policy_t alloc); - -/* lv must be part of lv->vg->lvs */ -int lv_remove(struct logical_volume *lv); /* Manipulate PV structures */ int pv_add(struct volume_group *vg, struct physical_volume *pv); @@ -502,14 +238,10 @@ struct physical_volume *pv_find(struct volume_group *vg, const char *pv_name); /* Find a PV within a given VG */ -struct pv_list *find_pv_in_vg(struct volume_group *vg, const char *pv_name); -pv_t *find_pv_in_vg_by_uuid(struct volume_group *vg, struct id *id); int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name, const char *vgid, const char *pvid, struct physical_volume *pv); -/* Find an LV within a given VG */ -struct lv_list *find_lv_in_vg(struct volume_group *vg, const char *lv_name); struct lv_list *find_lv_in_vg_by_lvid(struct volume_group *vg, const union lvid *lvid); @@ -524,13 +256,9 @@ /* FIXME Merge these functions with ones above */ struct physical_volume *find_pv(struct volume_group *vg, struct device *dev); -struct logical_volume *find_lv(struct volume_group *vg, const char *lv_name); -struct physical_volume *find_pv_by_name(struct cmd_context *cmd, - const char *pv_name); /* Find LV segment containing given LE */ struct lv_segment *find_seg_by_le(struct logical_volume *lv, uint32_t le); -struct lv_segment *first_seg(struct logical_volume *lv); /* Find PV segment containing given LE */ struct pv_segment *find_peg_by_pe(struct physical_volume *pv, uint32_t pe); @@ -559,100 +287,26 @@ int lv_split_segment(struct logical_volume *lv, uint32_t le); /* - * Useful functions for managing snapshots. - */ -int lv_is_origin(const struct logical_volume *lv); -int lv_is_cow(const struct logical_volume *lv); -int lv_is_visible(const struct logical_volume *lv); - -int pv_is_in_vg(struct volume_group *vg, struct physical_volume *pv); - -/* Given a cow LV, return return the snapshot lv_segment that uses it */ -struct lv_segment *find_cow(const struct logical_volume *lv); - -/* Given a cow LV, return its origin */ -struct logical_volume *origin_from_cow(const struct logical_volume *lv); - -int vg_add_snapshot(struct format_instance *fid, const char *name, - struct logical_volume *origin, struct logical_volume *cow, - union lvid *lvid, uint32_t extent_count, - uint32_t chunk_size); - -int vg_remove_snapshot(struct logical_volume *cow); - -int vg_check_status(struct volume_group *vg, uint32_t status); - -/* * Mirroring functions */ -struct alloc_handle; -uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents, - uint32_t region_size); -int create_mirror_layers(struct alloc_handle *ah, - uint32_t first_area, - uint32_t num_mirrors, - struct logical_volume *lv, - const struct segment_type *segtype, - uint32_t status, - uint32_t region_size, - struct logical_volume *log_lv); int add_mirror_layers(struct alloc_handle *ah, uint32_t num_mirrors, uint32_t existing_mirrors, struct logical_volume *lv, const struct segment_type *segtype); -int remove_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, - struct list *removable_pvs, int remove_log); -int reconfigure_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors, - struct list *removable_pvs, int remove_log); /* * Given mirror image or mirror log segment, find corresponding mirror segment */ struct lv_segment *find_mirror_seg(struct lv_segment *seg); int fixup_imported_mirrors(struct volume_group *vg); -int insert_pvmove_mirrors(struct cmd_context *cmd, - struct logical_volume *lv_mirr, - struct list *source_pvl, - struct logical_volume *lv, - struct list *allocatable_pvs, - alloc_policy_t alloc, - struct list *lvs_changed); -int remove_pvmove_mirrors(struct volume_group *vg, - struct logical_volume *lv_mirr); -struct logical_volume *find_pvmove_lv(struct volume_group *vg, - struct device *dev, uint32_t lv_type); -struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd, - struct volume_group *vg, - const char *name, - uint32_t lv_type); -const char *get_pvmove_pvname_from_lv(struct logical_volume *lv); -const char *get_pvmove_pvname_from_lv_mirr(struct logical_volume *lv_mirr); -float copy_percent(struct logical_volume *lv_mirr); -struct list *lvs_using_lv(struct cmd_context *cmd, struct volume_group *vg, - struct logical_volume *lv); - -uint32_t find_free_lvnum(struct logical_volume *lv); -char *generate_lv_name(struct volume_group *vg, const char *format, - char *buffer, size_t len); - /* * Begin skeleton for external LVM library */ struct id pv_id(pv_t *pv); const struct format_type *pv_format_type(pv_t *pv); struct id pv_vgid(pv_t *pv); -struct device *pv_dev(pv_t *pv); -const char *pv_vg_name(pv_t *pv); -uint64_t pv_size(pv_t *pv); -uint32_t pv_status(pv_t *pv); -uint32_t pv_pe_size(pv_t *pv); -uint64_t pv_pe_start(pv_t *pv); -uint32_t pv_pe_count(pv_t *pv); -uint32_t pv_pe_alloc_count(pv_t *pv); - -uint32_t vg_status(vg_t *vg); pv_t *pv_by_path(struct cmd_context *cmd, const char *pv_name); int add_pv_to_vg(struct volume_group *vg, const char *pv_name, --- LVM2/lib/report/report.h 2005/04/19 20:58:25 1.3 +++ LVM2/lib/report/report.h 2007/07/18 15:38:58 1.4 @@ -16,7 +16,7 @@ #ifndef _LVM_REPORT_H #define _LVM_REPORT_H -#include "metadata.h" +#include "metadata-exported.h" typedef enum { LVS = 1, PVS = 2, VGS = 4, SEGS = 8, PVSEGS = 16 } report_type_t; --- LVM2/lib/striped/striped.c 2006/10/18 18:01:52 1.20 +++ LVM2/lib/striped/striped.c 2007/07/18 15:38:58 1.21 @@ -25,6 +25,7 @@ #include "lvm-string.h" #include "activate.h" #include "pv_alloc.h" +#include "metadata.h" static const char *_striped_name(const struct lv_segment *seg) { --- LVM2/lib/zero/zero.c 2006/10/18 18:01:52 1.11 +++ LVM2/lib/zero/zero.c 2007/07/18 15:38:58 1.12 @@ -23,6 +23,7 @@ #include "targets.h" #include "lvm-string.h" #include "activate.h" +#include "metadata.h" static const char *_zero_name(const struct lv_segment *seg) { --- LVM2/tools/polldaemon.h 2004/05/05 17:56:20 1.1 +++ LVM2/tools/polldaemon.h 2007/07/18 15:38:58 1.2 @@ -16,7 +16,7 @@ #ifndef _LVM_TOOL_POLLDAEMON_H #define _LVM_TOOL_POLLDAEMON_H -#include "metadata.h" +#include "metadata-exported.h" struct poll_functions { const char *(*get_copy_name_from_lv) (struct logical_volume * lv_mirr); --- LVM2/tools/toollib.h 2007/03/26 16:10:10 1.46 +++ LVM2/tools/toollib.h 2007/07/18 15:38:58 1.47 @@ -16,7 +16,7 @@ #ifndef _LVM_TOOLLIB_H #define _LVM_TOOLLIB_H -#include "metadata.h" +#include "metadata-exported.h" int autobackup_set(void); int autobackup_init(const char *backup_dir, int keep_days, int keep_number, --- LVM2/tools/tools.h 2006/09/26 09:35:43 1.52 +++ LVM2/tools/tools.h 2007/07/18 15:38:58 1.53 @@ -38,8 +38,7 @@ #include "filter-composite.h" #include "filter-persistent.h" #include "filter-regex.h" -#include "format-text.h" -#include "metadata.h" +#include "metadata-exported.h" #include "list.h" #include "locking.h" #include "lvm-exec.h" From pcaulfield@sourceware.org Thu Jul 19 07:06:00 2007 From: pcaulfield@sourceware.org (pcaulfield@sourceware.org) Date: Thu, 19 Jul 2007 07:06:00 -0000 Subject: LVM2 ./WHATS_NEW lib/filters/filter.c Message-ID: <20070719070647.31485.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: pcaulfield@sourceware.org 2007-07-19 07:06:47 Modified files: . : WHATS_NEW lib/filters : filter.c Log message: Add SUN's LDOM virtual block device to filters Thanks to Fabio Massimo Di Nitto Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.660&r2=1.661 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter.c.diff?cvsroot=lvm2&r1=1.39&r2=1.40 --- LVM2/WHATS_NEW 2007/07/18 15:38:57 1.660 +++ LVM2/WHATS_NEW 2007/07/19 07:06:47 1.661 @@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Add SUN's LDOM virtual block device to filters Split metadata-external.h out from metadata.h for the tools to use. Version 2.02.27 - 17th July 2007 --- LVM2/lib/filters/filter.c 2007/01/25 23:03:48 1.39 +++ LVM2/lib/filters/filter.c 2007/07/19 07:06:47 1.40 @@ -75,6 +75,7 @@ {"aoe", 16}, /* ATA over Ethernet */ {"device-mapper", 1}, /* Other mapped devices */ {"xvd", 16}, /* Xen virtual block device */ + {"vdisk", 8}, /* SUN's LDOM virtual block device */ {NULL, 0} }; From meyering@sourceware.org Fri Jul 20 12:12:00 2007 From: meyering@sourceware.org (meyering@sourceware.org) Date: Fri, 20 Jul 2007 12:12:00 -0000 Subject: LVM2 ./WHATS_NEW lib/locking/file_locking.c Message-ID: <20070720121253.12048.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: meyering@sourceware.org 2007-07-20 12:12:52 Modified files: . : WHATS_NEW lib/locking : file_locking.c Log message: Don't leak a file descriptor in _lock_file when flock fails. * lib/locking/file_locking.c (_lock_file): Close fd upon flock failure. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.661&r2=1.662 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27 --- LVM2/WHATS_NEW 2007/07/19 07:06:47 1.661 +++ LVM2/WHATS_NEW 2007/07/20 12:12:52 1.662 @@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Don't leak a file descriptor in _lock_file(), when flock fails. Add SUN's LDOM virtual block device to filters Split metadata-external.h out from metadata.h for the tools to use. @@ -928,7 +929,7 @@ You need to update libdevmapper before using 'vgmknodes' or 'vgscan --mknodes'. If your root filesystem is on an LV, you should run one of those two -commands to fix up the special files in /dev in your real root filesystem +commands to fix up the special files in /dev in your real root filesystem after finishing with your initrd. Also, remember you can use 'vgchange --ignorelockingfailure' on your initrd if the tool fails because it can't write a lock file to a read-only filesystem. @@ -938,7 +939,7 @@ A pvmove implementation is now available for the new metadata format. When running a command that allocates space (e.g. lvcreate), you can now -restrict not only which disk(s) may be used but also the Physical Extents +restrict not only which disk(s) may be used but also the Physical Extents on those disks. e.g. lvcreate -L 10 vg1 /dev/hda6:1000-2000:3000-4000 @@ -950,12 +951,12 @@ It's more compact and supports transactional changes and replication. Should things go wrong on a system, it's human-readable (and editable). -Please report any problems you find to the mailing list, +Please report any problems you find to the mailing list, linux-lvm@sistina.com. The software has NOT yet been thoroughly tested and so quite possibly there'll still be some bugs in it. Be aware of the disclaimer in the COPYING file. -While testing, we recommend turning logging on in the configuration file +While testing, we recommend turning logging on in the configuration file to provide us with diagnostic information: log { file="/tmp/lvm2.log" @@ -966,7 +967,7 @@ You should schedule regular backups of your configuration file and metadata backups and archives (normally kept under /etc/lvm). -Please read docs/example.conf and "man lvm.conf" to find out more about +Please read docs/example.conf and "man lvm.conf" to find out more about the configuration file. To convert an existing volume group called vg1 to the new format using @@ -995,7 +996,7 @@ LVM2 maintains a backup of the current metadata for each volume group in /etc/lvm/backup, and puts copies of previous versions in /etc/lvm/archive. "vgcfgbackup" and "vgcfgrestore" can be used to -create and restore from these files. If you fully understand what +create and restore from these files. If you fully understand what you're doing, metadata can be changed by editing a copy of a current backup file and using vgcfgrestore to reload it. @@ -1012,8 +1013,8 @@ The internal cache. If you turn on debugging output you'll see lots of repeated messages, many of which will eventually get optimised out. ---test sometimes causes a command to fail (e.g. vgconvert --test) even -though the real command would work: again, fixing this is waiting for +--test sometimes causes a command to fail (e.g. vgconvert --test) even +though the real command would work: again, fixing this is waiting for the work on the cache. Several of the tools do not yet contain the logic to handle full @@ -1026,4 +1027,3 @@ Recovery tools to salvage "lost" metadata directly from the disks: but we hope the new format will mean such tools are hardly ever needed! - --- LVM2/lib/locking/file_locking.c 2007/01/25 14:37:48 1.26 +++ LVM2/lib/locking/file_locking.c 2007/07/20 12:12:52 1.27 @@ -185,6 +185,7 @@ if (r) { errno = old_errno; log_sys_error("flock", ll->res); + close(ll->lf); goto err; } From meyering@sourceware.org Fri Jul 20 15:22:00 2007 From: meyering@sourceware.org (meyering@sourceware.org) Date: Fri, 20 Jul 2007 15:22:00 -0000 Subject: LVM2 ./WHATS_NEW lib/filters/filter-persistent ... Message-ID: <20070720152247.5091.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: meyering@sourceware.org 2007-07-20 15:22:46 Modified files: . : WHATS_NEW lib/filters : filter-persistent.c lib/locking : file_locking.c lib/misc : lvm-file.h Log message: Introduce is_same_inode macro, now including a comparison of st_dev. * lib/misc/lvm-file.h (is_same_inode): Define. * lib/filters/filter-persistent.c (persistent_filter_dump): Use is_same_inode in place of a direct st_ino-only comparison. * lib/locking/file_locking.c (_release_lock, _lock_file): Likewise. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.662&r2=1.663 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter-persistent.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.h.diff?cvsroot=lvm2&r1=1.8&r2=1.9 --- LVM2/WHATS_NEW 2007/07/20 12:12:52 1.662 +++ LVM2/WHATS_NEW 2007/07/20 15:22:45 1.663 @@ -1,5 +1,5 @@ Version 2.02.28 - -================================ + Introduce is_same_inode macro, now including a comparison of st_dev. Don't leak a file descriptor in _lock_file(), when flock fails. Add SUN's LDOM virtual block device to filters Split metadata-external.h out from metadata.h for the tools to use. --- LVM2/lib/filters/filter-persistent.c 2007/04/26 16:44:58 1.30 +++ LVM2/lib/filters/filter-persistent.c 2007/07/20 15:22:45 1.31 @@ -208,7 +208,7 @@ goto out; } - if (!memcmp(&info.st_ino, &info2.st_ino, sizeof(ino_t))) + if (is_same_inode(info, info2)) break; fcntl_unlock_file(lockfd); --- LVM2/lib/locking/file_locking.c 2007/07/20 12:12:52 1.27 +++ LVM2/lib/locking/file_locking.c 2007/07/20 15:22:46 1.28 @@ -64,7 +64,7 @@ if (!flock(ll->lf, LOCK_NB | LOCK_EX) && !stat(ll->res, &buf1) && !fstat(ll->lf, &buf2) && - !memcmp(&buf1.st_ino, &buf2.st_ino, sizeof(ino_t))) + is_same_inode(buf1, buf2)) if (unlink(ll->res)) log_sys_error("unlink", ll->res); @@ -190,7 +190,7 @@ } if (!stat(ll->res, &buf1) && !fstat(ll->lf, &buf2) && - !memcmp(&buf1.st_ino, &buf2.st_ino, sizeof(ino_t))) + is_same_inode(buf1, buf2)) break; } while (!(flags & LCK_NONBLOCK)); --- LVM2/lib/misc/lvm-file.h 2006/11/04 03:34:10 1.8 +++ LVM2/lib/misc/lvm-file.h 2007/07/20 15:22:46 1.9 @@ -52,4 +52,8 @@ int fcntl_lock_file(const char *file, short lock_type, int warn_if_read_only); void fcntl_unlock_file(int lockfd); +#define is_same_inode(buf1, buf2) \ + ((buf1).st_ino == (buf2).st_ino && \ + (buf1).st_dev == (buf2).st_dev) + #endif From meyering@sourceware.org Fri Jul 20 15:26:00 2007 From: meyering@sourceware.org (meyering@sourceware.org) Date: Fri, 20 Jul 2007 15:26:00 -0000 Subject: LVM2 ./WHATS_NEW lib/config/config.c Message-ID: <20070720152640.7952.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: meyering@sourceware.org 2007-07-20 15:26:39 Modified files: . : WHATS_NEW lib/config : config.c Log message: In _line_append, use "sizeof buf - 1" rather than equivalent "4095" * lib/config/config.c: Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.663&r2=1.664 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.60&r2=1.61 --- LVM2/WHATS_NEW 2007/07/20 15:22:45 1.663 +++ LVM2/WHATS_NEW 2007/07/20 15:26:39 1.664 @@ -1,4 +1,5 @@ Version 2.02.28 - + In _line_append, use "sizeof buf - 1" rather than equivalent "4095" Introduce is_same_inode macro, now including a comparison of st_dev. Don't leak a file descriptor in _lock_file(), when flock fails. Add SUN's LDOM virtual block device to filters --- LVM2/lib/config/config.c 2007/07/08 22:51:20 1.60 +++ LVM2/lib/config/config.c 2007/07/20 15:26:39 1.61 @@ -367,8 +367,8 @@ int n; va_start(ap, fmt); - n = vsnprintf(&buf[0], 4095, fmt, ap); - if (n < 0 || n > 4095) { + n = vsnprintf(&buf[0], sizeof buf - 1, fmt, ap); + if (n < 0 || n > sizeof buf - 1) { log_error("vsnprintf failed for config line"); return 0; } From meyering@sourceware.org Fri Jul 20 15:38:00 2007 From: meyering@sourceware.org (meyering@sourceware.org) Date: Fri, 20 Jul 2007 15:38:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd.h lib/con ... Message-ID: <20070720153820.13860.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: meyering@sourceware.org 2007-07-20 15:38:20 Modified files: . : WHATS_NEW daemons/clvmd : clvmd.h lib/config : config.c lib/misc : lvm-string.h Log message: Use gcc's printf attribute wherever possible. * daemons/clvmd/clvmd.h (debuglog): Add __attribute__((printf)). * lib/config/config.c (_line_append): Likewise. * lib/misc/lvm-string.h (emit_to_buffer): Likewise. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.664&r2=1.665 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.h.diff?cvsroot=lvm2&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.61&r2=1.62 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-string.h.diff?cvsroot=lvm2&r1=1.14&r2=1.15 --- LVM2/WHATS_NEW 2007/07/20 15:26:39 1.664 +++ LVM2/WHATS_NEW 2007/07/20 15:38:19 1.665 @@ -1,4 +1,5 @@ Version 2.02.28 - + Use gcc's printf attribute wherever possible. In _line_append, use "sizeof buf - 1" rather than equivalent "4095" Introduce is_same_inode macro, now including a comparison of st_dev. Don't leak a file descriptor in _lock_file(), when flock fails. --- LVM2/daemons/clvmd/clvmd.h 2007/05/02 12:22:40 1.9 +++ LVM2/daemons/clvmd/clvmd.h 2007/07/20 15:38:19 1.10 @@ -115,7 +115,8 @@ extern void clvmd_cluster_init_completed(void); extern void process_message(struct local_client *client, const char *buf, int len, const char *csid); -extern void debuglog(const char *fmt, ... ); +extern void debuglog(const char *fmt, ... ) + __attribute__ ((format(printf, 1, 2))); int sync_lock(const char *resource, int mode, int flags, int *lockid); int sync_unlock(const char *resource, int lockid); --- LVM2/lib/config/config.c 2007/07/20 15:26:39 1.61 +++ LVM2/lib/config/config.c 2007/07/20 15:38:19 1.62 @@ -361,6 +361,8 @@ } static int _line_append(struct output_line *outline, const char *fmt, ...) + __attribute__ ((format(printf, 2, 3))); +static int _line_append(struct output_line *outline, const char *fmt, ...) { char buf[4096]; va_list ap; --- LVM2/lib/misc/lvm-string.h 2007/04/25 18:24:19 1.14 +++ LVM2/lib/misc/lvm-string.h 2007/07/20 15:38:19 1.15 @@ -23,7 +23,8 @@ struct pool; -int emit_to_buffer(char **buffer, size_t *size, const char *fmt, ...); +int emit_to_buffer(char **buffer, size_t *size, const char *fmt, ...) + __attribute__ ((format(printf, 3, 4))); char *build_dm_name(struct dm_pool *mem, const char *vg, const char *lv, const char *layer); From meyering@sourceware.org Fri Jul 20 15:48:00 2007 From: meyering@sourceware.org (meyering@sourceware.org) Date: Fri, 20 Jul 2007 15:48:00 -0000 Subject: LVM2 ./WHATS_NEW include/.symlinks lib/Makefil ... Message-ID: <20070720154840.19510.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: meyering@sourceware.org 2007-07-20 15:48:40 Modified files: . : WHATS_NEW include : .symlinks lib : Makefile.in lib/misc : lib.h tools : lvmcmdline.c tools/fsadm : fsadm.c Added files: lib/misc : util.c util.h Log message: Eliminate uses of strdup+basename. Use last_path_component instead. * lib/misc/util.c, lib/misc/util.h (last_path_component): New files. * lib/Makefile.in (SOURCES): Add misc/util.c. * lib/misc/lib.h: Include "util.h". * tools/fsadm/fsadm.c: Include "util.h". (_usage): Use last_path_component, not basename. * tools/lvmcmdline.c (_find_command, lvm2_main): Likewise. * include/.symlinks: Add lib/misc/util.h. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.665&r2=1.666 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/include/.symlinks.diff?cvsroot=lvm2&r1=1.45&r2=1.46 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/Makefile.in.diff?cvsroot=lvm2&r1=1.81&r2=1.82 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/util.c.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/util.h.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lib.h.diff?cvsroot=lvm2&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.44&r2=1.45 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/fsadm/fsadm.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2 --- LVM2/WHATS_NEW 2007/07/20 15:38:19 1.665 +++ LVM2/WHATS_NEW 2007/07/20 15:48:39 1.666 @@ -1,4 +1,5 @@ Version 2.02.28 - + Eliminate uses of strdup+basename. Use last_path_component instead. Use gcc's printf attribute wherever possible. In _line_append, use "sizeof buf - 1" rather than equivalent "4095" Introduce is_same_inode macro, now including a comparison of st_dev. --- LVM2/include/.symlinks 2007/07/18 15:38:57 1.45 +++ LVM2/include/.symlinks 2007/07/20 15:48:39 1.46 @@ -38,6 +38,7 @@ ../lib/misc/configure.h ../lib/misc/crc.h ../lib/misc/intl.h +../lib/misc/util.h ../lib/misc/lib.h ../lib/misc/lvm-exec.h ../lib/misc/lvm-file.h --- LVM2/lib/Makefile.in 2007/04/27 18:52:05 1.81 +++ LVM2/lib/Makefile.in 2007/07/20 15:48:39 1.82 @@ -80,6 +80,7 @@ misc/lvm-string.c \ misc/lvm-wrappers.c \ misc/timestamp.c \ + misc/util.c \ mm/memlock.c \ report/report.c \ striped/striped.c \ /cvs/lvm2/LVM2/lib/misc/util.c,v --> standard output revision 1.1 --- LVM2/lib/misc/util.c +++ - 2007-07-20 15:48:40.520121000 +0000 @@ -0,0 +1,24 @@ +/* + * 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 + */ + +/* + * Return the address of the last file name component of NAME. + * If NAME ends in a slash, return the empty string. + */ +char *last_path_component(char const *name) +{ + char const *slash = strrchr (name, '/'); + char const *res = slash ? slash + 1 : name; + return (char *) res; +} /cvs/lvm2/LVM2/lib/misc/util.h,v --> standard output revision 1.1 --- LVM2/lib/misc/util.h +++ - 2007-07-20 15:48:40.598043000 +0000 @@ -0,0 +1,20 @@ +/* + * 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 + */ + +#ifndef _LVM_UTIL_H +#define _LVM_UTIL_H + +char *last_path_component(char const *name); + +#endif --- LVM2/lib/misc/lib.h 2007/04/27 17:46:16 1.11 +++ LVM2/lib/misc/lib.h 2007/07/20 15:48:39 1.12 @@ -29,6 +29,7 @@ #include "intl.h" #include "lvm-types.h" #include "lvm-wrappers.h" +#include "util.h" #include --- LVM2/tools/lvmcmdline.c 2007/06/28 17:33:44 1.44 +++ LVM2/tools/lvmcmdline.c 2007/07/20 15:48:39 1.45 @@ -479,18 +479,15 @@ static struct command *_find_command(const char *name) { int i; - char *namebase, *base; + char *base; - namebase = strdup(name); - base = basename(namebase); + base = last_path_component(name); for (i = 0; i < _cmdline.num_commands; i++) { if (!strcmp(base, _cmdline.commands[i].name)) break; } - free(namebase); - if (i >= _cmdline.num_commands) return 0; @@ -1138,14 +1135,13 @@ int lvm2_main(int argc, char **argv, unsigned is_static) { - char *namebase, *base; + char *base; int ret, alias = 0; struct cmd_context *cmd; _close_stray_fds(); - namebase = strdup(argv[0]); - base = basename(namebase); + base = last_path_component(argv[0]); while (*base == '/') base++; if (strcmp(base, "lvm") && strcmp(base, "lvm.static") && @@ -1160,8 +1156,6 @@ unsetenv("LVM_DID_EXEC"); } - free(namebase); - if (!(cmd = init_lvm(is_static))) return -1; --- LVM2/tools/fsadm/fsadm.c 2004/06/15 17:29:20 1.1 +++ LVM2/tools/fsadm/fsadm.c 2007/07/20 15:48:39 1.2 @@ -32,6 +32,8 @@ #include #include +#include "util.h" + #define log_error(str, x...) fprintf(stderr, "%s(%u): " str "\n", __FILE__, __LINE__, x) /* Filesystem related information */ @@ -45,7 +47,7 @@ static void _usage(const char *cmd) { log_error("Usage: %s [check | resize ]", - basename(cmd)); + last_path_component(cmd)); } /* FIXME Make this more robust - /proc, multiple mounts, TMPDIR + security etc. */ From mbroz@sourceware.org Mon Jul 23 10:41:00 2007 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 23 Jul 2007 10:41:00 -0000 Subject: LVM2/lib/misc util.c Message-ID: <20070723104119.6688.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2007-07-23 10:41:19 Modified files: lib/misc : util.c Log message: Fix compilation warning in util.c. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/util.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2 --- LVM2/lib/misc/util.c 2007/07/20 15:48:39 1.1 +++ LVM2/lib/misc/util.c 2007/07/23 10:41:19 1.2 @@ -16,6 +16,9 @@ * Return the address of the last file name component of NAME. * If NAME ends in a slash, return the empty string. */ + +#include "lib.h" + char *last_path_component(char const *name) { char const *slash = strrchr (name, '/'); From mbroz@sourceware.org Mon Jul 23 10:45:00 2007 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 23 Jul 2007 10:45:00 -0000 Subject: LVM2 ./WHATS_NEW lib/commands/toolcontext.c li ... Message-ID: <20070723104550.7325.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2007-07-23 10:45:49 Modified files: . : WHATS_NEW lib/commands : toolcontext.c lib/device : dev-cache.c Log message: Fix loading of persistent cache if cache_dir is used. (2.02.23) Move lstat warning in _compare_paths to verbose output only. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.666&r2=1.667 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49 --- LVM2/WHATS_NEW 2007/07/20 15:48:39 1.666 +++ LVM2/WHATS_NEW 2007/07/23 10:45:49 1.667 @@ -1,4 +1,6 @@ Version 2.02.28 - +================================ + Fix loading of persistent cache if cache_dir is used. (2.02.23) Eliminate uses of strdup+basename. Use last_path_component instead. Use gcc's printf attribute wherever possible. In _line_append, use "sizeof buf - 1" rather than equivalent "4095" --- LVM2/lib/commands/toolcontext.c 2007/06/28 17:33:44 1.51 +++ LVM2/lib/commands/toolcontext.c 2007/07/23 10:45:49 1.52 @@ -611,7 +611,10 @@ return 0; } - if (!(f4 = persistent_filter_create(f3, dev_cache ? : cache_file))) { + if (!dev_cache) + dev_cache = cache_file; + + if (!(f4 = persistent_filter_create(f3, dev_cache))) { log_error("Failed to create persistent device filter"); return 0; } --- LVM2/lib/device/dev-cache.c 2007/04/27 18:52:05 1.48 +++ LVM2/lib/device/dev-cache.c 2007/07/23 10:45:49 1.49 @@ -205,11 +205,11 @@ *s1 = '\0'; } if (lstat(p0, &stat0)) { - log_sys_error("lstat", p0); + log_sys_very_verbose("lstat", p0); return 1; } if (lstat(p1, &stat1)) { - log_sys_error("lstat", p1); + log_sys_very_verbose("lstat", p1); return 0; } if (S_ISLNK(stat0.st_mode) && !S_ISLNK(stat1.st_mode)) From wysochanski@sourceware.org Mon Jul 23 17:27:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 23 Jul 2007 17:27:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ... Message-ID: <20070723172755.15375.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-23 17:27:55 Modified files: . : WHATS_NEW lib/metadata : metadata-exported.h metadata.c tools : pvmove.c vgextend.c vgmerge.c vgsplit.c Log message: Add vg_lock_and_read() external library function. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.667&r2=1.668 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.127&r2=1.128 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32 --- LVM2/WHATS_NEW 2007/07/23 10:45:49 1.667 +++ LVM2/WHATS_NEW 2007/07/23 17:27:54 1.668 @@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Add vg_lock_and_read() external library function. Fix loading of persistent cache if cache_dir is used. (2.02.23) Eliminate uses of strdup+basename. Use last_path_component instead. Use gcc's printf attribute wherever possible. --- LVM2/lib/metadata/metadata-exported.h 2007/07/18 15:38:58 1.1 +++ LVM2/lib/metadata/metadata-exported.h 2007/07/23 17:27:54 1.2 @@ -292,6 +292,8 @@ int pv_write(struct cmd_context *cmd, struct physical_volume *pv, struct list *mdas, int64_t label_sector); int is_orphan(pv_t *pv); +vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name, + uint32_t lock_flags, uint32_t status_flags); /* pe_start and pe_end relate to any existing data so that new metadata * areas can avoid overlap */ --- LVM2/lib/metadata/metadata.c 2007/07/12 15:38:53 1.127 +++ LVM2/lib/metadata/metadata.c 2007/07/23 17:27:54 1.128 @@ -1792,6 +1792,41 @@ return 1; } +/** + * vg_lock_and_read - Attempt to lock a volume group, read, and check status + * @cmd - command context + * @vg_name - name of the volume group to lock and read + * @lock_flags - locking flags to use + * @status_flags - status flags to check + * + * Returns: + * NULL - failure + * non-NULL - success; volume group handle + */ +vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name, + uint32_t lock_flags, uint32_t status_flags) +{ + struct volume_group *vg; + int consistent = 1; + + if (!lock_vol(cmd, vg_name, lock_flags)) { + log_error("Can't get lock for %s", vg_name); + return NULL; + } + + if (!(vg = vg_read(cmd, vg_name, NULL, &consistent)) || !consistent) { + log_error("Volume group \"%s\" not found", vg_name); + unlock_vg(cmd, vg_name); + return NULL; + } + + if (!vg_check_status(vg, status_flags)) { + unlock_vg(cmd, vg_name); + return NULL; + } + return vg; +} + /* * Gets/Sets for external LVM library --- LVM2/tools/pvmove.c 2007/06/15 22:16:55 1.38 +++ LVM2/tools/pvmove.c 2007/07/23 17:27:55 1.39 @@ -50,26 +50,13 @@ static struct volume_group *_get_vg(struct cmd_context *cmd, const char *vgname) { - int consistent = 1; struct volume_group *vg; dev_close_all(); - if (!lock_vol(cmd, vgname, LCK_VG_WRITE)) { - log_error("Can't get lock for %s", vgname); - return NULL; - } - - if (!(vg = vg_read(cmd, vgname, NULL, &consistent)) || !consistent) { - log_error("Volume group \"%s\" doesn't exist", vgname); - unlock_vg(cmd, vgname); - return NULL; - } - - if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE)) { - unlock_vg(cmd, vgname); - return NULL; - } + if (!(vg = vg_lock_and_read(cmd, vgname, LCK_VG_WRITE, + CLUSTERED | EXPORTED_VG | LVM_WRITE))) + return NULL; return vg; } --- LVM2/tools/vgextend.c 2007/06/19 00:33:43 1.31 +++ LVM2/tools/vgextend.c 2007/07/23 17:27:55 1.32 @@ -19,7 +19,6 @@ { char *vg_name; struct volume_group *vg = NULL; - int consistent = 1; if (!argc) { log_error("Please enter volume group name and " @@ -48,21 +47,12 @@ } log_verbose("Checking for volume group \"%s\"", vg_name); - if (!lock_vol(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) { - unlock_vg(cmd, ORPHAN); - log_error("Can't get lock for %s", vg_name); - goto error; - } - - if (!(vg = vg_read(cmd, vg_name, NULL, &consistent)) || !consistent) { - log_error("Volume group \"%s\" not found.", vg_name); - goto error; - } - - if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | - LVM_WRITE | RESIZEABLE_VG)) - goto error; - + if (!(vg = vg_lock_and_read(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK, + CLUSTERED | EXPORTED_VG | + LVM_WRITE | RESIZEABLE_VG))) { + unlock_vg(cmd, ORPHAN); + return ECMD_FAILED; + } /********** FIXME log_print("maximum logical volume size is %s", (dummy = lvm_show_size(LVM_LV_SIZE_MAX(vg) / 2, LONG))); --- LVM2/tools/vgmerge.c 2007/06/06 19:40:28 1.37 +++ LVM2/tools/vgmerge.c 2007/07/23 17:27:55 1.38 @@ -22,7 +22,6 @@ struct lv_list *lvl1, *lvl2; struct pv_list *pvl; int active; - int consistent = 1; if (!strcmp(vg_name_to, vg_name_from)) { log_error("Duplicate volume group name \"%s\"", vg_name_from); @@ -30,38 +29,18 @@ } log_verbose("Checking for volume group \"%s\"", vg_name_to); - if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE)) { - log_error("Can't get lock for %s", vg_name_to); - return ECMD_FAILED; - } - - if (!(vg_to = vg_read(cmd, vg_name_to, NULL, &consistent)) || !consistent) { - log_error("Volume group \"%s\" doesn't exist", vg_name_to); - unlock_vg(cmd, vg_name_to); - return ECMD_FAILED; - } - - if (!vg_check_status(vg_to, CLUSTERED | EXPORTED_VG | LVM_WRITE)) { - unlock_vg(cmd, vg_name_to); - return ECMD_FAILED; - } + if (!(vg_to = vg_lock_and_read(cmd, vg_name_to, LCK_VG_WRITE, + CLUSTERED | EXPORTED_VG | LVM_WRITE))) + return ECMD_FAILED; log_verbose("Checking for volume group \"%s\"", vg_name_from); - if (!lock_vol(cmd, vg_name_from, LCK_VG_WRITE | LCK_NONBLOCK)) { - log_error("Can't get lock for %s", vg_name_from); + if (!(vg_from = vg_lock_and_read(cmd, vg_name_from, + LCK_VG_WRITE | LCK_NONBLOCK, + CLUSTERED | EXPORTED_VG | LVM_WRITE))) { unlock_vg(cmd, vg_name_to); return ECMD_FAILED; } - consistent = 1; - if (!(vg_from = vg_read(cmd, vg_name_from, NULL, &consistent)) || !consistent) { - log_error("Volume group \"%s\" doesn't exist", vg_name_from); - goto error; - } - - if (!vg_check_status(vg_from, CLUSTERED | EXPORTED_VG | LVM_WRITE)) - goto error; - if ((active = lvs_in_vg_activated(vg_from))) { log_error("Logical volumes in \"%s\" must be inactive", vg_name_from); --- LVM2/tools/vgsplit.c 2007/06/28 17:59:34 1.31 +++ LVM2/tools/vgsplit.c 2007/07/23 17:27:55 1.32 @@ -240,22 +240,10 @@ } log_verbose("Checking for volume group \"%s\"", vg_name_from); - if (!lock_vol(cmd, vg_name_from, LCK_VG_WRITE)) { - log_error("Can't get lock for %s", vg_name_from); - return ECMD_FAILED; - } - - if (!(vg_from = vg_read(cmd, vg_name_from, NULL, &consistent)) || !consistent) { - log_error("Volume group \"%s\" doesn't exist", vg_name_from); - unlock_vg(cmd, vg_name_from); - return ECMD_FAILED; - } - - if (!vg_check_status(vg_from, CLUSTERED | EXPORTED_VG | - RESIZEABLE_VG | LVM_WRITE)) { - unlock_vg(cmd, vg_name_from); - return ECMD_FAILED; - } + if (!(vg_to = vg_lock_and_read(cmd, vg_name_from, LCK_VG_WRITE, + CLUSTERED | EXPORTED_VG | + RESIZEABLE_VG | LVM_WRITE))) + return ECMD_FAILED; log_verbose("Checking for volume group \"%s\"", vg_name_to); if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE | LCK_NONBLOCK)) { From wysochanski@sourceware.org Mon Jul 23 21:03:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 23 Jul 2007 21:03:00 -0000 Subject: LVM2 lib/metadata/metadata-exported.h lib/meta ... Message-ID: <20070723210343.7626.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-23 21:03:42 Modified files: lib/metadata : metadata-exported.h metadata.c tools : pvmove.c vgextend.c vgmerge.c vgsplit.c Log message: Add CORRECT_INCONSISTENT and FAIL_INCONSISTENT flags to vg_lock_and_read Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.128&r2=1.129 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.39&r2=1.40 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33 --- LVM2/lib/metadata/metadata-exported.h 2007/07/23 17:27:54 1.2 +++ LVM2/lib/metadata/metadata-exported.h 2007/07/23 21:03:42 1.3 @@ -83,6 +83,10 @@ #define FMT_RESIZE_PV 0x00000080U /* Supports pvresize? */ #define FMT_UNLIMITED_STRIPESIZE 0x00000100U /* Unlimited stripe size? */ +/* LVM2 external library flags */ +#define CORRECT_INCONSISTENT 0x00000001U /* Correct inconsistent metadata */ +#define FAIL_INCONSISTENT 0x00000002U /* Fail if metadata inconsistent */ + /* Ordered list - see lv_manip.c */ typedef enum { ALLOC_INVALID, @@ -293,7 +297,8 @@ struct list *mdas, int64_t label_sector); int is_orphan(pv_t *pv); vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name, - uint32_t lock_flags, uint32_t status_flags); + uint32_t lock_flags, uint32_t status_flags, + uint32_t misc_flags); /* pe_start and pe_end relate to any existing data so that new metadata * areas can avoid overlap */ --- LVM2/lib/metadata/metadata.c 2007/07/23 17:27:54 1.128 +++ LVM2/lib/metadata/metadata.c 2007/07/23 21:03:42 1.129 @@ -1798,23 +1798,29 @@ * @vg_name - name of the volume group to lock and read * @lock_flags - locking flags to use * @status_flags - status flags to check + * @misc_flags - function modifier flags * * Returns: * NULL - failure * non-NULL - success; volume group handle */ vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name, - uint32_t lock_flags, uint32_t status_flags) + uint32_t lock_flags, uint32_t status_flags, + uint32_t misc_flags) { struct volume_group *vg; int consistent = 1; - + + if (!(misc_flags & CORRECT_INCONSISTENT)) + consistent = 0; + if (!lock_vol(cmd, vg_name, lock_flags)) { log_error("Can't get lock for %s", vg_name); return NULL; } - if (!(vg = vg_read(cmd, vg_name, NULL, &consistent)) || !consistent) { + if (!(vg = vg_read(cmd, vg_name, NULL, &consistent)) || + ((misc_flags & FAIL_INCONSISTENT) && !consistent)) { log_error("Volume group \"%s\" not found", vg_name); unlock_vg(cmd, vg_name); return NULL; --- LVM2/tools/pvmove.c 2007/07/23 17:27:55 1.39 +++ LVM2/tools/pvmove.c 2007/07/23 21:03:42 1.40 @@ -55,7 +55,8 @@ dev_close_all(); if (!(vg = vg_lock_and_read(cmd, vgname, LCK_VG_WRITE, - CLUSTERED | EXPORTED_VG | LVM_WRITE))) + CLUSTERED | EXPORTED_VG | LVM_WRITE, + CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) return NULL; return vg; --- LVM2/tools/vgextend.c 2007/07/23 17:27:55 1.32 +++ LVM2/tools/vgextend.c 2007/07/23 21:03:42 1.33 @@ -49,7 +49,8 @@ log_verbose("Checking for volume group \"%s\"", vg_name); if (!(vg = vg_lock_and_read(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK, CLUSTERED | EXPORTED_VG | - LVM_WRITE | RESIZEABLE_VG))) { + LVM_WRITE | RESIZEABLE_VG, + CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) { unlock_vg(cmd, ORPHAN); return ECMD_FAILED; } --- LVM2/tools/vgmerge.c 2007/07/23 17:27:55 1.38 +++ LVM2/tools/vgmerge.c 2007/07/23 21:03:42 1.39 @@ -30,13 +30,15 @@ log_verbose("Checking for volume group \"%s\"", vg_name_to); if (!(vg_to = vg_lock_and_read(cmd, vg_name_to, LCK_VG_WRITE, - CLUSTERED | EXPORTED_VG | LVM_WRITE))) + CLUSTERED | EXPORTED_VG | LVM_WRITE, + CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) return ECMD_FAILED; log_verbose("Checking for volume group \"%s\"", vg_name_from); if (!(vg_from = vg_lock_and_read(cmd, vg_name_from, LCK_VG_WRITE | LCK_NONBLOCK, - CLUSTERED | EXPORTED_VG | LVM_WRITE))) { + CLUSTERED | EXPORTED_VG | LVM_WRITE, + CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) { unlock_vg(cmd, vg_name_to); return ECMD_FAILED; } --- LVM2/tools/vgsplit.c 2007/07/23 17:27:55 1.32 +++ LVM2/tools/vgsplit.c 2007/07/23 21:03:42 1.33 @@ -242,7 +242,8 @@ log_verbose("Checking for volume group \"%s\"", vg_name_from); if (!(vg_to = vg_lock_and_read(cmd, vg_name_from, LCK_VG_WRITE, CLUSTERED | EXPORTED_VG | - RESIZEABLE_VG | LVM_WRITE))) + RESIZEABLE_VG | LVM_WRITE, + CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) return ECMD_FAILED; log_verbose("Checking for volume group \"%s\"", vg_name_to); From wysochanski@sourceware.org Mon Jul 23 21:10:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 23 Jul 2007 21:10:00 -0000 Subject: LVM2/tools vgsplit.c Message-ID: <20070723211037.18068.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-23 21:10:36 Modified files: tools : vgsplit.c Log message: Fix error introduced with previous checkin Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34 --- LVM2/tools/vgsplit.c 2007/07/23 21:03:42 1.33 +++ LVM2/tools/vgsplit.c 2007/07/23 21:10:36 1.34 @@ -240,7 +240,7 @@ } log_verbose("Checking for volume group \"%s\"", vg_name_from); - if (!(vg_to = vg_lock_and_read(cmd, vg_name_from, LCK_VG_WRITE, + if (!(vg_from = vg_lock_and_read(cmd, vg_name_from, LCK_VG_WRITE, CLUSTERED | EXPORTED_VG | RESIZEABLE_VG | LVM_WRITE, CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) From wysochanski@sourceware.org Mon Jul 23 22:20:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 23 Jul 2007 22:20:00 -0000 Subject: LVM2/tools lvconvert.c lvrename.c Message-ID: <20070723222043.16274.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-23 22:20:42 Modified files: tools : lvconvert.c lvrename.c Log message: Update lvconvert and lvrename to use vg_lock_and_read Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvrename.c.diff?cvsroot=lvm2&r1=1.43&r2=1.44 --- LVM2/tools/lvconvert.c 2007/06/28 17:33:44 1.28 +++ LVM2/tools/lvconvert.c 2007/07/23 22:20:41 1.29 @@ -534,7 +534,6 @@ int lvconvert(struct cmd_context * cmd, int argc, char **argv) { - int consistent = 1; struct volume_group *vg; struct lv_list *lvl; struct lvconvert_params lp; @@ -547,18 +546,10 @@ log_verbose("Checking for existing volume group \"%s\"", lp.vg_name); - if (!lock_vol(cmd, lp.vg_name, LCK_VG_WRITE)) { - log_error("Can't get lock for %s", lp.vg_name); + if (!(vg = vg_lock_and_read(cmd, lp.vg_name, LCK_VG_WRITE, + CLUSTERED | EXPORTED_VG | LVM_WRITE, + CORRECT_INCONSISTENT))) return ECMD_FAILED; - } - - if (!(vg = vg_read(cmd, lp.vg_name, NULL, &consistent))) { - log_error("Volume group \"%s\" doesn't exist", lp.vg_name); - goto error; - } - - if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE)) - goto error; if (!(lvl = find_lv_in_vg(vg, lp.lv_name))) { log_error("Logical volume \"%s\" not found in " --- LVM2/tools/lvrename.c 2007/06/06 19:40:28 1.43 +++ LVM2/tools/lvrename.c 2007/07/23 22:20:42 1.44 @@ -22,7 +22,6 @@ char *lv_name_old, *lv_name_new; const char *vg_name, *vg_name_new, *vg_name_old; char *st; - int consistent = 1; struct volume_group *vg; struct logical_volume *lv; @@ -99,18 +98,10 @@ log_verbose("Checking for existing volume group \"%s\"", vg_name); - if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) { - log_error("Can't get lock for %s", vg_name); + if (!(vg = vg_lock_and_read(cmd, vg_name, LCK_VG_WRITE, + CLUSTERED | EXPORTED_VG | LVM_WRITE, + CORRECT_INCONSISTENT))) return ECMD_FAILED; - } - - if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) { - log_error("Volume group \"%s\" doesn't exist", vg_name); - goto error; - } - - if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE)) - goto error; if (find_lv_in_vg(vg, lv_name_new)) { log_error("Logical volume \"%s\" already exists in " From wysochanski@sourceware.org Tue Jul 24 10:58:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Tue, 24 Jul 2007 10:58:00 -0000 Subject: LVM2 man/lvdisplay.8 ./WHATS_NEW Message-ID: <20070724105801.22255.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-24 10:58:01 Modified files: man : lvdisplay.8 . : WHATS_NEW Log message: Trivial fix to lvdisplay man pg to correct volume size units Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvdisplay.8.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.668&r2=1.669 --- LVM2/man/lvdisplay.8 2005/12/02 20:35:06 1.4 +++ LVM2/man/lvdisplay.8 2007/07/24 10:58:01 1.5 @@ -29,7 +29,7 @@ * logical volume status * internal logical volume number * open count of logical volume -* logical volume size in kilobytes +* logical volume size in sectors * current logical extents associated to logical volume * allocated logical extents of logical volume * allocation policy of logical volume --- LVM2/WHATS_NEW 2007/07/23 17:27:54 1.668 +++ LVM2/WHATS_NEW 2007/07/24 10:58:01 1.669 @@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Trivial fix to lvdisplay man page. Add vg_lock_and_read() external library function. Fix loading of persistent cache if cache_dir is used. (2.02.23) Eliminate uses of strdup+basename. Use last_path_component instead. From wysochanski@sourceware.org Tue Jul 24 11:29:00 2007 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Tue, 24 Jul 2007 11:29:00 -0000 Subject: LVM2/man lvdisplay.8 Message-ID: <20070724112955.14179.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-24 11:29:55 Modified files: man : lvdisplay.8 Log message: Trivial fix to lvdisplay man pg to recommend lvs Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvdisplay.8.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/man/lvdisplay.8 2007/07/24 10:58:01 1.5 +++ LVM2/man/lvdisplay.8 2007/07/24 11:29:55 1.6 @@ -12,7 +12,9 @@ like size, read/write status, snapshot information etc. .P \fBlvs\fP (8) is an alternative that provides the same information -in the style of \fBps\fP (1). +in the style of \fBps\fP (1). \fBlvs\fP is recommended over +\fBlvdisplay\fP. + .SH OPTIONS See \fBlvm\fP for common options. .TP From mbroz@sourceware.org Tue Jul 24 15:35:00 2007 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 24 Jul 2007 15:35:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd-gulm.c da ... Message-ID: <20070724153512.24229.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2007-07-24 15:35:11 Modified files: . : WHATS_NEW daemons/clvmd : clvmd-gulm.c clvmd-gulm.h tcp-comms.c tcp-comms.h Log message: Fix clvmd if compiled with gulm support. (2.02.26) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.669&r2=1.670 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-gulm.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-gulm.h.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/tcp-comms.c.diff?cvsroot=lvm2&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/tcp-comms.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/WHATS_NEW 2007/07/24 10:58:01 1.669 +++ LVM2/WHATS_NEW 2007/07/24 15:35:11 1.670 @@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Fix clvmd if compiled with gulm support. (2.02.26) Trivial fix to lvdisplay man page. Add vg_lock_and_read() external library function. Fix loading of persistent cache if cache_dir is used. (2.02.23) --- LVM2/daemons/clvmd/clvmd-gulm.c 2007/04/27 17:46:16 1.21 +++ LVM2/daemons/clvmd/clvmd-gulm.c 2007/07/24 15:35:11 1.22 @@ -86,12 +86,12 @@ }; /* Forward */ -static int read_from_core_sock(struct local_client *client, char *buf, int len, char *csid, +static int read_from_core_sock(struct local_client *client, char *buf, int len, const char *csid, struct local_client **new_client); -static int read_from_lock_sock(struct local_client *client, char *buf, int len, char *csid, +static int read_from_lock_sock(struct local_client *client, char *buf, int len, const char *csid, struct local_client **new_client); static int get_all_cluster_nodes(void); -static int _csid_from_name(char *csid, char *name); +static int _csid_from_name(char *csid, const char *name); static void _cluster_closedown(void); /* In tcp-comms.c */ @@ -278,7 +278,7 @@ } -static int read_from_core_sock(struct local_client *client, char *buf, int len, char *csid, +static int read_from_core_sock(struct local_client *client, char *buf, int len, const char *csid, struct local_client **new_client) { int status; @@ -288,7 +288,7 @@ return status<0 ? status : 1; } -static int read_from_lock_sock(struct local_client *client, char *buf, int len, char *csid, +static int read_from_lock_sock(struct local_client *client, char *buf, int len, const char *csid, struct local_client **new_client) { int status; @@ -582,7 +582,7 @@ return 1; } -int gulm_name_from_csid(char *csid, char *name) +int gulm_name_from_csid(const char *csid, char *name) { struct node_info *ninfo; @@ -598,7 +598,7 @@ } -static int _csid_from_name(char *csid, char *name) +static int _csid_from_name(char *csid, const char *name) { struct dm_hash_node *hn; struct node_info *ninfo; @@ -622,7 +622,7 @@ } /* Node is now known to be running a clvmd */ -void gulm_add_up_node(char *csid) +void gulm_add_up_node(const char *csid) { struct node_info *ninfo; @@ -661,7 +661,7 @@ /* Call a callback for each node, so the caller knows whether it's up or down */ static int _cluster_do_node_callback(struct local_client *master_client, - void (*callback)(struct local_client *, char *csid, int node_up)) + void (*callback)(struct local_client *, const char *csid, int node_up)) { struct dm_hash_node *hn; struct node_info *ninfo; @@ -965,14 +965,14 @@ return get_main_gulm_cluster_fd(); } -static int _cluster_fd_callback(struct local_client *fd, char *buf, int len, char *csid, struct local_client **new_client) +static int _cluster_fd_callback(struct local_client *fd, char *buf, int len, const char *csid, struct local_client **new_client) { return cluster_fd_gulm_callback(fd, buf, len, csid, new_client); } -static int _cluster_send_message(void *buf, int msglen, char *csid, const char *errtext) +static int _cluster_send_message(const void *buf, int msglen, const char *csid, const char *errtext) { - return gulm_cluster_send_message(buf, msglen, csid, errtext); + return gulm_cluster_send_message((char *)buf, msglen, csid, errtext); } static int _get_cluster_name(char *buf, int buflen) --- LVM2/daemons/clvmd/clvmd-gulm.h 2006/12/11 14:00:26 1.3 +++ LVM2/daemons/clvmd/clvmd-gulm.h 2007/07/24 15:35:11 1.4 @@ -5,9 +5,9 @@ extern int get_next_node_csid(void **context, char *csid); extern void add_down_node(char *csid); extern int gulm_fd(void); -extern int get_ip_address(char *node, char *addr); -extern void tcp_remove_client(char *csid); -extern int alloc_client(int fd, char *csid, struct local_client **new_client); +extern int get_ip_address(const char *node, char *addr); +extern void tcp_remove_client(const char *csid); +extern int alloc_client(int fd, const char *csid, struct local_client **new_client); -void gulm_add_up_node(char *csid); -int gulm_name_from_csid(char *csid, char *name); +void gulm_add_up_node(const char *csid); +int gulm_name_from_csid(const char *csid, char *name); --- LVM2/daemons/clvmd/tcp-comms.c 2007/05/02 12:22:40 1.17 +++ LVM2/daemons/clvmd/tcp-comms.c 2007/07/24 15:35:11 1.18 @@ -177,7 +177,7 @@ /* Read on main comms (listen) socket, accept it */ -int cluster_fd_gulm_callback(struct local_client *fd, char *buf, int len, char *csid, +int cluster_fd_gulm_callback(struct local_client *fd, char *buf, int len, const char *csid, struct local_client **new_client) { int newfd; @@ -390,7 +390,7 @@ } -int gulm_cluster_send_message(void *buf, int msglen, char *csid, const char *errtext) +int gulm_cluster_send_message(void *buf, int msglen, const char *csid, const char *errtext) { int status=0; --- LVM2/daemons/clvmd/tcp-comms.h 2007/05/02 12:22:40 1.5 +++ LVM2/daemons/clvmd/tcp-comms.h 2007/07/24 15:35:11 1.6 @@ -7,7 +7,7 @@ extern int init_comms(unsigned short); extern char *print_csid(const char *); int get_main_gulm_cluster_fd(void); -int cluster_fd_gulm_callback(struct local_client *fd, char *buf, int len, char *csid, struct local_client **new_client); -int gulm_cluster_send_message(void *buf, int msglen, char *csid, const char *errtext); +int cluster_fd_gulm_callback(struct local_client *fd, char *buf, int len, const char *csid, struct local_client **new_client); +int gulm_cluster_send_message(void *buf, int msglen, const char *csid, const char *errtext); void get_our_gulm_csid(char *csid); int gulm_connect_csid(const char *csid, struct local_client **newclient); From meyering@sourceware.org Tue Jul 24 17:48:00 2007 From: meyering@sourceware.org (meyering@sourceware.org) Date: Tue, 24 Jul 2007 17:48:00 -0000 Subject: LVM2 ./WHATS_NEW lib/config/config.c lib/filte ... Message-ID: <20070724174809.31459.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: meyering@sourceware.org 2007-07-24 17:48:08 Modified files: . : WHATS_NEW lib/config : config.c lib/filters : filter-persistent.c lib/format_text: archive.c format-text.c lib/log : log.c lib/misc : lvm-file.c lvm-file.h Log message: Detect stream write failure reliably; new fn: lvm_fclose; use dm_fclose * lib/misc/lvm-file.c (lvm_fclose): New function. * lib/misc/lvm-file.h (lvm_fclose): Declare it. * lib/config/config.c (write_config_file): Use the new function to detect and diagnose unlikely write failure. * lib/filters/filter-persistent.c (persistent_filter_dump): Likewise. * lib/format_text/archive.c (archive_vg): Likewise. * lib/format_text/format-text.c (_vg_write_file): Likewise. * lib/log/log.c (fin_log): Similar, but use dm_fclose directly. Include "\n" at end of each fprintf format string. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.670&r2=1.671 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.62&r2=1.63 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter-persistent.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/archive.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.77&r2=1.78 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.39&r2=1.40 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.h.diff?cvsroot=lvm2&r1=1.9&r2=1.10 --- LVM2/WHATS_NEW 2007/07/24 15:35:11 1.670 +++ LVM2/WHATS_NEW 2007/07/24 17:48:07 1.671 @@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Detect stream write failure reliably; new fn: lvm_fclose; use dm_fclose Fix clvmd if compiled with gulm support. (2.02.26) Trivial fix to lvdisplay man page. Add vg_lock_and_read() external library function. --- LVM2/lib/config/config.c 2007/07/20 15:38:19 1.62 +++ LVM2/lib/config/config.c 2007/07/24 17:48:07 1.63 @@ -20,6 +20,7 @@ #include "str_list.h" #include "toolcontext.h" #include "lvm-string.h" +#include "lvm-file.h" #include #include @@ -520,8 +521,8 @@ argv++; } - if (outline.fp && fclose(outline.fp)) { - log_sys_error("fclose", file); + if (outline.fp && lvm_fclose(outline.fp, file)) { + stack; r = 0; } --- LVM2/lib/filters/filter-persistent.c 2007/07/20 15:22:45 1.31 +++ LVM2/lib/filters/filter-persistent.c 2007/07/24 17:48:08 1.32 @@ -239,10 +239,8 @@ /* _write_array(pf, fp, "invalid_devices", PF_BAD_DEVICE); */ fprintf(fp, "}\n"); - if (fclose(fp)) { - log_sys_error("fclose", tmp_file); - goto out; - } + if (lvm_fclose(fp, tmp_file)) + goto_out; if (rename(tmp_file, pf->file)) log_error("%s: rename to %s failed: %s", tmp_file, pf->file, --- LVM2/lib/format_text/archive.c 2007/07/02 11:17:21 1.27 +++ LVM2/lib/format_text/archive.c 2007/07/24 17:48:08 1.28 @@ -261,11 +261,8 @@ return 0; } - if (fclose(fp)) { - log_sys_error("fclose", temp_file); - /* Leave file behind as evidence of failure */ - return 0; - } + if (lvm_fclose(fp, temp_file)) + return_0; /* Leave file behind as evidence of failure */ /* * Now we want to rename this file to _index.vg. --- LVM2/lib/format_text/format-text.c 2007/07/02 11:17:21 1.77 +++ LVM2/lib/format_text/format-text.c 2007/07/24 17:48:08 1.78 @@ -892,10 +892,8 @@ return 0; } - if (fclose(fp)) { - log_sys_error("fclose", tc->path_edit); - return 0; - } + if (lvm_fclose(fp, tc->path_edit)) + return_0; if (rename(temp_file, tc->path_edit)) { log_debug("Renaming %s to %s", temp_file, tc->path_edit); --- LVM2/lib/log/log.c 2007/06/28 17:33:44 1.39 +++ LVM2/lib/log/log.c 2007/07/24 17:48:08 1.40 @@ -17,6 +17,7 @@ #include "device.h" #include "memlock.h" #include "lvm-string.h" +#include "lvm-file.h" #include "defaults.h" #include @@ -121,8 +122,14 @@ } if (_log_to_file) { - if (fclose(_log_file)) - fprintf(stderr, "fclose() on log file failed: %s", strerror(errno)); + if (dm_fclose(_log_file)) { + if (errno) + fprintf(stderr, "failed to write log file: %s\n", + strerror(errno)); + else + fprintf(stderr, "failed to write log file\n"); + + } _log_to_file = 0; } } --- LVM2/lib/misc/lvm-file.c 2007/04/26 16:44:59 1.20 +++ LVM2/lib/misc/lvm-file.c 2007/07/24 17:48:08 1.21 @@ -321,3 +321,13 @@ strerror(errno)); } +int lvm_fclose(FILE *fp, const char *filename) +{ + if (!dm_fclose(fp)) + return 0; + if (errno == 0) + log_error("%s: write error", filename); + else + log_sys_error("write error", filename); + return EOF; +} --- LVM2/lib/misc/lvm-file.h 2007/07/20 15:22:46 1.9 +++ LVM2/lib/misc/lvm-file.h 2007/07/24 17:48:08 1.10 @@ -56,4 +56,13 @@ ((buf1).st_ino == (buf2).st_ino && \ (buf1).st_dev == (buf2).st_dev) +/* + * Close the specified stream, taking care to detect and diagnose any write + * error. If there is an error, use the supplied file name in a diagnostic + * that is reported via log_error or log_sys_error, as appropriate. + * Use this function to close a stream when you've written data to it via + * unchecked fprintf, fputc, etc. calls. Return 0 on success, EOF on failure. + */ +int lvm_fclose(FILE *fp, const char *filename); + #endif From agk@sourceware.org Thu Jul 26 13:28:00 2007 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 26 Jul 2007 13:28:00 -0000 Subject: LVM2 ./WHATS_NEW lib/filters/filter.c Message-ID: <20070726132833.28636.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2007-07-26 13:28:32 Modified files: . : WHATS_NEW lib/filters : filter.c Log message: Add ps3disk devices. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.671&r2=1.672 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41 --- LVM2/WHATS_NEW 2007/07/24 17:48:07 1.671 +++ LVM2/WHATS_NEW 2007/07/26 13:28:32 1.672 @@ -10,7 +10,7 @@ In _line_append, use "sizeof buf - 1" rather than equivalent "4095" Introduce is_same_inode macro, now including a comparison of st_dev. Don't leak a file descriptor in _lock_file(), when flock fails. - Add SUN's LDOM virtual block device to filters + Add SUN's LDOM virtual block device (vdisk) and ps3disk to filters. Split metadata-external.h out from metadata.h for the tools to use. Version 2.02.27 - 17th July 2007 --- LVM2/lib/filters/filter.c 2007/07/19 07:06:47 1.40 +++ LVM2/lib/filters/filter.c 2007/07/26 13:28:32 1.41 @@ -76,6 +76,7 @@ {"device-mapper", 1}, /* Other mapped devices */ {"xvd", 16}, /* Xen virtual block device */ {"vdisk", 8}, /* SUN's LDOM virtual block device */ + {"ps3disk", 16}, /* PlayStation 3 internal disk */ {NULL, 0} }; From meyering@sourceware.org Sat Jul 28 12:26:00 2007 From: meyering@sourceware.org (meyering@sourceware.org) Date: Sat, 28 Jul 2007 12:26:00 -0000 Subject: LVM2 ./WHATS_NEW lib/commands/toolcontext.c li ... Message-ID: <20070728122622.24978.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: meyering@sourceware.org 2007-07-28 12:26:21 Modified files: . : WHATS_NEW lib/commands : toolcontext.c lib/format_text: archiver.c format-text.c lib/locking : file_locking.c lib/misc : lvm-file.c lvm-file.h Log message: Remove create_dir function; use now-equivalent dm_create_dir instead. * lib/misc/lvm-file.c (_create_dir_recursive, create_dir): Remove functions. * lib/misc/lvm-file.h (create_dir): Remove declaration. * lib/commands/toolcontext.c (create_toolcontext): s/create_dir/dm_create_dir/ * lib/format_text/archiver.c (archive, backup): Likewise. * lib/format_text/format-text.c (_add_dir): Likewise. * lib/locking/file_locking.c (init_file_locking): Likewise. Patch by Jun'ichi Nomura. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.672&r2=1.673 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/archiver.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.78&r2=1.79 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.h.diff?cvsroot=lvm2&r1=1.10&r2=1.11 --- LVM2/WHATS_NEW 2007/07/26 13:28:32 1.672 +++ LVM2/WHATS_NEW 2007/07/28 12:26:21 1.673 @@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Remove create_dir function; use now-equivalent dm_create_dir instead Detect stream write failure reliably; new fn: lvm_fclose; use dm_fclose Fix clvmd if compiled with gulm support. (2.02.26) Trivial fix to lvdisplay man page. --- LVM2/lib/commands/toolcontext.c 2007/07/23 10:45:49 1.52 +++ LVM2/lib/commands/toolcontext.c 2007/07/28 12:26:21 1.53 @@ -939,7 +939,7 @@ goto error; /* Create system directory if it doesn't already exist */ - if (*cmd->sys_dir && !create_dir(cmd->sys_dir)) { + if (*cmd->sys_dir && !dm_create_dir(cmd->sys_dir)) { log_error("Failed to create LVM2 system dir for metadata backups, config " "files and internal cache."); log_error("Set environment variable LVM_SYSTEM_DIR to alternative location " --- LVM2/lib/format_text/archiver.c 2007/06/28 17:33:44 1.7 +++ LVM2/lib/format_text/archiver.c 2007/07/28 12:26:21 1.8 @@ -117,7 +117,7 @@ return 1; } - if (!create_dir(vg->cmd->archive_params->dir)) + if (!dm_create_dir(vg->cmd->archive_params->dir)) return 0; /* Trap a read-only file system */ @@ -223,7 +223,7 @@ return 1; } - if (!create_dir(vg->cmd->backup_params->dir)) + if (!dm_create_dir(vg->cmd->backup_params->dir)) return 0; /* Trap a read-only file system */ --- LVM2/lib/format_text/format-text.c 2007/07/24 17:48:08 1.78 +++ LVM2/lib/format_text/format-text.c 2007/07/28 12:26:21 1.79 @@ -1856,7 +1856,7 @@ { struct dir_list *dl; - if (create_dir(dir)) { + if (dm_create_dir(dir)) { if (!(dl = dm_malloc(sizeof(struct list) + strlen(dir) + 1))) { log_error("_add_dir allocation failed"); return 0; --- LVM2/lib/locking/file_locking.c 2007/07/20 15:22:46 1.28 +++ LVM2/lib/locking/file_locking.c 2007/07/28 12:26:21 1.29 @@ -284,7 +284,7 @@ DEFAULT_LOCK_DIR), sizeof(_lock_dir)); - if (!create_dir(_lock_dir)) + if (!dm_create_dir(_lock_dir)) return 0; /* Trap a read-only file system */ --- LVM2/lib/misc/lvm-file.c 2007/07/24 17:48:08 1.21 +++ LVM2/lib/misc/lvm-file.c 2007/07/28 12:26:21 1.22 @@ -140,56 +140,6 @@ return 1; } -static int _create_dir_recursive(const char *dir) -{ - char *orig, *s; - int rc; - - log_verbose("Creating directory \"%s\"", dir); - /* Create parent directories */ - orig = s = dm_strdup(dir); - while ((s = strchr(s, '/')) != NULL) { - *s = '\0'; - if (*orig) { - rc = mkdir(orig, 0777); - if (rc < 0 && errno != EEXIST) { - if (errno != EROFS) - log_sys_error("mkdir", orig); - dm_free(orig); - return 0; - } - } - *s++ = '/'; - } - dm_free(orig); - - /* Create final directory */ - rc = mkdir(dir, 0777); - if (rc < 0 && errno != EEXIST) { - if (errno != EROFS) - log_sys_error("mkdir", dir); - return 0; - } - return 1; -} - -int create_dir(const char *dir) -{ - struct stat info; - - if (!*dir) - return 1; - - if (stat(dir, &info) < 0) - return _create_dir_recursive(dir); - - if (S_ISDIR(info.st_mode)) - return 1; - - log_error("Directory \"%s\" not found", dir); - return 0; -} - int is_empty_dir(const char *dir) { struct dirent *dirent; @@ -273,7 +223,7 @@ if ((c = strrchr(dir, '/'))) *c = '\0'; - if (!create_dir(dir)) { + if (!dm_create_dir(dir)) { dm_free(dir); return -1; } --- LVM2/lib/misc/lvm-file.h 2007/07/24 17:48:08 1.10 +++ LVM2/lib/misc/lvm-file.h 2007/07/28 12:26:21 1.11 @@ -39,12 +39,6 @@ */ int is_empty_dir(const char *dir); -/* - * Create directory (recursively) if necessary. Return 1 - * if directory was successfully created (or already exists), else 0. - */ -int create_dir(const char *dir); - /* Sync directory changes */ void sync_dir(const char *file); From meyering@sourceware.org Sat Jul 28 15:20:00 2007 From: meyering@sourceware.org (meyering@sourceware.org) Date: Sat, 28 Jul 2007 15:20:00 -0000 Subject: LVM2 ./WHATS_NEW lib/misc/lvm-file.c Message-ID: <20070728152037.21872.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: meyering@sourceware.org 2007-07-28 15:20:36 Modified files: . : WHATS_NEW lib/misc : lvm-file.c Log message: Don't leak a file descriptor in fcntl_lock_file(), when fcntl fails. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.673&r2=1.674 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.c.diff?cvsroot=lvm2&r1=1.22&r2=1.23 --- LVM2/WHATS_NEW 2007/07/28 12:26:21 1.673 +++ LVM2/WHATS_NEW 2007/07/28 15:20:36 1.674 @@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Don't leak a file descriptor in fcntl_lock_file(), when fcntl fails. Remove create_dir function; use now-equivalent dm_create_dir instead Detect stream write failure reliably; new fn: lvm_fclose; use dm_fclose Fix clvmd if compiled with gulm support. (2.02.26) --- LVM2/lib/misc/lvm-file.c 2007/07/28 12:26:21 1.22 +++ LVM2/lib/misc/lvm-file.c 2007/07/28 15:20:36 1.23 @@ -245,6 +245,7 @@ if (fcntl(lockfd, F_SETLKW, &lock)) { log_sys_error("fcntl", file); + close(lockfd); return -1; }