From prajnoha@sourceware.org Fri Apr 1 13:44:00 2011 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 01 Apr 2011 13:44:00 -0000 Subject: LVM2/liblvm lvm_vg.c Message-ID: <20110401134452.31221.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2011-04-01 13:44:51 Modified files: liblvm : lvm_vg.c Log message: Finalize PV format instances properly in lvm_vg_write fn. lvm_vg_write fn reinitializes the vg->removed_pvs list. We have to finalize all PV format instances attached to PVs found in the original list. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_vg.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52 --- LVM2/liblvm/lvm_vg.c 2011/02/18 14:47:30 1.51 +++ LVM2/liblvm/lvm_vg.c 2011/04/01 13:44:51 1.52 @@ -147,6 +147,7 @@ if (! dm_list_empty(&vg->removed_pvs)) { dm_list_iterate_items(pvl, &vg->removed_pvs) { pv_write_orphan(vg->cmd, pvl->pv); + pv_set_fid(pvl->pv, NULL); /* FIXME: do pvremove / label_remove()? */ } dm_list_init(&vg->removed_pvs); From prajnoha@sourceware.org Fri Apr 1 14:54:00 2011 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 01 Apr 2011 14:54:00 -0000 Subject: LVM2/lib/metadata metadata.c Message-ID: <20110401145421.8740.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2011-04-01 14:54:21 Modified files: lib/metadata : metadata.c Log message: Cleanup fid finalization code in free_vg and allow exactly the same fid to be set again for a PV/VG. Actually, we can call vg_set_fid(vg, NULL) instead of calling destroy_instance for all PV structs and a VG struct - it's the same code we already have in the vg_set_fid. Also, allow exactly the same fid to be set again for the same PV/VG Before, this could end up with the fid destroyed because we destroyed existing fid first and then we used the new one and we didn't care whether existing one == new one by chance. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.452&r2=1.453 --- LVM2/lib/metadata/metadata.c 2011/03/30 13:35:51 1.452 +++ LVM2/lib/metadata/metadata.c 2011/04/01 14:54:20 1.453 @@ -3243,19 +3243,10 @@ void free_vg(struct volume_group *vg) { - struct pv_list *pvl; - if (!vg) return; - dm_list_iterate_items(pvl, &vg->pvs) - pvl->pv->fid->fmt->ops->destroy_instance(pvl->pv->fid); - - dm_list_iterate_items(pvl, &vg->removed_pvs) - pvl->pv->fid->fmt->ops->destroy_instance(pvl->pv->fid); - - if (vg->fid) - vg->fid->fmt->ops->destroy_instance(vg->fid); + vg_set_fid(vg, NULL); if (vg->cmd && vg->vgmem == vg->cmd->mem) { log_error(INTERNAL_ERROR "global memory pool used for VG %s", @@ -4048,12 +4039,13 @@ void pv_set_fid(struct physical_volume *pv, struct format_instance *fid) { + if (fid) + fid->ref_count++; + if (pv->fid) pv->fid->fmt->ops->destroy_instance(pv->fid); pv->fid = fid; - if (fid) - fid->ref_count++; } void vg_set_fid(struct volume_group *vg, @@ -4061,15 +4053,19 @@ { struct pv_list *pvl; - if (vg->fid) - vg->fid->fmt->ops->destroy_instance(vg->fid); - - vg->fid = fid; if (fid) fid->ref_count++; dm_list_iterate_items(pvl, &vg->pvs) pv_set_fid(pvl->pv, fid); + + dm_list_iterate_items(pvl, &vg->removed_pvs) + pv_set_fid(pvl->pv, fid); + + if (vg->fid) + vg->fid->fmt->ops->destroy_instance(vg->fid); + + vg->fid = fid; } static int _convert_key_to_string(const char *key, size_t key_len, From mornfall@sourceware.org Mon Apr 4 16:11:00 2011 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Mon, 04 Apr 2011 16:11:00 -0000 Subject: LVM2/daemons/dmeventd .exported_symbols dmeven ... Message-ID: <20110404161111.11125.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-04-04 16:11:10 Modified files: daemons/dmeventd: .exported_symbols dmeventd.c dmeventd.h libdevmapper-event.c libdevmapper-event.h Log message: Add rudimentary versioning to the dmevend protocol, allowing us to detect the (protocol) version of the running dmeventd on the client side. Right now this is only used in dmeventd -R. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/.exported_symbols.diff?cvsroot=lvm2&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.79&r2=1.80 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.h.diff?cvsroot=lvm2&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/libdevmapper-event.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/libdevmapper-event.h.diff?cvsroot=lvm2&r1=1.15&r2=1.16 --- LVM2/daemons/dmeventd/.exported_symbols 2010/10/20 15:12:12 1.11 +++ LVM2/daemons/dmeventd/.exported_symbols 2011/04/04 16:11:09 1.12 @@ -1,3 +1,4 @@ init_fifos fini_fifos daemon_talk +dm_event_get_version --- LVM2/daemons/dmeventd/dmeventd.c 2011/03/29 21:53:46 1.79 +++ LVM2/daemons/dmeventd/dmeventd.c 2011/04/04 16:11:09 1.80 @@ -1424,8 +1424,9 @@ ret = 0; answer = msg->data; if (answer) { - msg->size = dm_asprintf(&(msg->data), "%s %s", answer, - msg->cmd == DM_EVENT_CMD_DIE ? "DYING" : "HELLO"); + msg->size = dm_asprintf(&(msg->data), "%s %s %d", answer, + msg->cmd == DM_EVENT_CMD_DIE ? "DYING" : "HELLO", + DM_EVENT_PROTOCOL_VERSION); dm_free(answer); } else { msg->size = 0; @@ -1704,6 +1705,7 @@ int i, count = 0; char *message; int length; + int version; /* Get the list of registrations from the running daemon. */ @@ -1712,12 +1714,19 @@ return; } - if (daemon_talk(&fifos, &msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0)) { + if (!dm_event_get_version(&fifos, &version)) { fprintf(stderr, "WARNING: Could not communicate with existing dmeventd.\n"); fini_fifos(&fifos); return; } + if (version < 1) { + fprintf(stderr, "WARNING: The running dmeventd instance is too old.\n" + "Protocol version %d (required: 1). Action cancelled.\n", + version); + exit(EXIT_FAILURE); + } + if (daemon_talk(&fifos, &msg, DM_EVENT_CMD_GET_STATUS, "-", "-", 0, 0)) { exit(EXIT_FAILURE); } --- LVM2/daemons/dmeventd/dmeventd.h 2011/01/17 19:02:44 1.8 +++ LVM2/daemons/dmeventd/dmeventd.h 2011/04/04 16:11:09 1.9 @@ -69,5 +69,6 @@ enum dm_event_mask evmask, uint32_t timeout); int init_fifos(struct dm_event_fifos *fifos); void fini_fifos(struct dm_event_fifos *fifos); +int dm_event_get_version(struct dm_event_fifos *fifos, int *version); #endif /* __DMEVENTD_DOT_H__ */ --- LVM2/daemons/dmeventd/libdevmapper-event.c 2011/03/01 20:17:56 1.40 +++ LVM2/daemons/dmeventd/libdevmapper-event.c 2011/04/04 16:11:09 1.41 @@ -782,6 +782,36 @@ return ret; } +/* + * You can (and have to) call this at the stage of the protocol where + * daemon_talk(fifos, &msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0) + * + * would be normally sent. This call will parse the version reply from + * dmeventd, in addition to above call. It is not safe to call this at any + * other place in the protocol. + * + * This is an internal function, not exposed in the public API. + */ + +int dm_event_get_version(struct dm_event_fifos *fifos, int *version) { + char *p; + struct dm_event_daemon_message msg = { 0, 0, NULL }; + + if (daemon_talk(fifos, &msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0)) + return 0; + p = msg.data; + *version = 0; + + p = strchr(p, ' ') + 1; /* Message ID */ + if (!p) return 0; + p = strchr(p, ' ') + 1; /* HELLO */ + if (!p) return 0; + p = strchr(p, ' '); /* HELLO, once more */ + if (p) + *version = atoi(p); + return 1; +} + #if 0 /* left out for now */ static char *_skip_string(char *src, const int delimiter) --- LVM2/daemons/dmeventd/libdevmapper-event.h 2010/08/16 22:54:36 1.15 +++ LVM2/daemons/dmeventd/libdevmapper-event.h 2011/04/04 16:11:09 1.16 @@ -46,6 +46,7 @@ }; #define DM_EVENT_ALL_ERRORS DM_EVENT_ERROR_MASK +#define DM_EVENT_PROTOCOL_VERSION 1 struct dm_event_handler; From jbrassow@sourceware.org Wed Apr 6 21:32:00 2011 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Wed, 06 Apr 2011 21:32:00 -0000 Subject: LVM2 lib/metadata/lv_manip.c lib/metadata/meta ... Message-ID: <20110406213222.10912.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2011-04-06 21:32:21 Modified files: lib/metadata : lv_manip.c metadata-exported.h mirror.c tools : lvresize.c Log message: This patch adds the ability to extend 0 length layered LVs. This allows us to allocate all images of a mirror (or RAID array) at one time during create. The current mirror implementation still requires a separate allocation for the log, however. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.254&r2=1.255 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.188&r2=1.189 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.146&r2=1.147 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.129&r2=1.130 --- LVM2/lib/metadata/lv_manip.c 2011/03/29 20:19:04 1.254 +++ LVM2/lib/metadata/lv_manip.c 2011/04/06 21:32:20 1.255 @@ -2106,29 +2106,87 @@ 0, status, 0); } -static int _lv_extend_mirror(struct alloc_handle *ah, - struct logical_volume *lv, - uint32_t extents, uint32_t first_area, - uint32_t stripes, uint32_t stripe_size) +static int _lv_insert_empty_sublvs(struct logical_volume *lv, + const struct segment_type *segtype, + uint32_t region_size, + uint32_t devices) +{ + struct logical_volume *sub_lv; + uint32_t i; + uint64_t status = 0; + char *img_name; + size_t len; + struct lv_segment *mapseg; + + if (lv->le_count || first_seg(lv)) { + log_error(INTERNAL_ERROR + "Non-empty LV passed to _lv_insert_empty_sublv"); + return 0; + } + + if (!segtype_is_mirrored(segtype)) + return_0; + lv->status |= MIRRORED; + + /* + * First, create our top-level segment for our top-level LV + */ + if (!(mapseg = alloc_lv_segment(lv->vg->cmd->mem, segtype, + lv, 0, 0, lv->status, 0, NULL, + devices, 0, 0, region_size, 0, NULL))) { + log_error("Failed to create mapping segment for %s", lv->name); + return 0; + } + + /* + * Next, create all of our sub_lv's and link them in. + */ + len = strlen(lv->name) + 32; + if (!(img_name = dm_pool_alloc(lv->vg->cmd->mem, len))) + return_0; + if (dm_snprintf(img_name, len, "%s%s", lv->name, "_mimage_%d") < 0) + return_0; + + for (i = 0; i < devices; i++) { + sub_lv = lv_create_empty(img_name, NULL, + MIRROR_IMAGE, lv->alloc, lv->vg); + if (!sub_lv) + return_0; + if (!set_lv_segment_area_lv(mapseg, i, sub_lv, 0, status)) + return_0; + } + dm_list_add(&lv->segments, &mapseg->list); + + dm_pool_free(lv->vg->cmd->mem, img_name); + return 1; +} + +static int _lv_extend_layered_lv(struct alloc_handle *ah, + struct logical_volume *lv, + uint32_t extents, uint32_t first_area, + uint32_t stripes, uint32_t stripe_size) { + struct logical_volume *sub_lv; struct lv_segment *seg; uint32_t m, s; seg = first_seg(lv); for (m = first_area, s = 0; s < seg->area_count; s++) { if (is_temporary_mirror_layer(seg_lv(seg, s))) { - if (!_lv_extend_mirror(ah, seg_lv(seg, s), extents, m, stripes, stripe_size)) + if (!_lv_extend_layered_lv(ah, seg_lv(seg, s), extents, + m, stripes, stripe_size)) return_0; m += lv_mirror_count(seg_lv(seg, s)); continue; } - if (!lv_add_segment(ah, m, stripes, seg_lv(seg, s), + sub_lv = seg_lv(seg, s); + if (!lv_add_segment(ah, m, stripes, sub_lv, get_segtype_from_string(lv->vg->cmd, "striped"), - stripe_size, 0, 0)) { - log_error("Aborting. Failed to extend %s.", - seg_lv(seg, s)->name); + stripe_size, sub_lv->status, 0)) { + log_error("Aborting. Failed to extend %s in %s.", + sub_lv->name, lv->name); return 0; } m += stripes; @@ -2147,28 +2205,35 @@ 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 __attribute__((unused)), - uint32_t mirrored_pe __attribute__((unused)), - uint64_t status, struct dm_list *allocatable_pvs, - alloc_policy_t alloc) + uint32_t mirrors, uint32_t region_size, + uint32_t extents, + struct dm_list *allocatable_pvs, alloc_policy_t alloc) { int r = 1; struct alloc_handle *ah; if (segtype_is_virtual(segtype)) - return lv_add_virtual_segment(lv, status, extents, segtype); + return lv_add_virtual_segment(lv, 0u, extents, segtype); if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors, 0, 0, extents, allocatable_pvs, alloc, NULL))) return_0; - if (mirrors < 2) + if (!segtype_is_mirrored(segtype)) r = lv_add_segment(ah, 0, ah->area_count, lv, segtype, - stripe_size, status, 0); - else - r = _lv_extend_mirror(ah, lv, extents, 0, stripes, stripe_size); + stripe_size, 0u, 0); + else { + if (!lv->le_count && + !_lv_insert_empty_sublvs(lv, segtype, + region_size, mirrors)) { + log_error("Failed to insert layer for %s", lv->name); + alloc_destroy(ah); + return 0; + } + r = _lv_extend_layered_lv(ah, lv, extents, 0, + stripes, stripe_size); + } alloc_destroy(ah); return r; } @@ -3389,7 +3454,7 @@ ALLOC_INHERIT, vg))) return_NULL; - if (!lv_extend(lv, segtype, 1, 0, 1, voriginextents, NULL, 0u, 0u, + if (!lv_extend(lv, segtype, 1, 0, 1, 0, voriginextents, NULL, ALLOC_INHERIT)) return_NULL; @@ -3588,6 +3653,10 @@ "Don't read what you didn't write!"); status |= LV_NOTSYNCED; } + + lp->segtype = get_segtype_from_string(cmd, "mirror"); + if (!lp->segtype) + return_0; } if (!(lv = lv_create_empty(lp->lv_name ? lp->lv_name : "lvol%d", NULL, @@ -3611,19 +3680,17 @@ dm_list_splice(&lv->tags, &lp->tags); if (!lv_extend(lv, lp->segtype, lp->stripes, lp->stripe_size, - 1, lp->extents, NULL, 0u, 0u, lp->pvh, lp->alloc)) + lp->mirrors, + adjusted_mirror_region_size(vg->extent_size, + lp->extents, + lp->region_size), + lp->extents, lp->pvh, lp->alloc)) return_0; - if (lp->mirrors > 1) { - if (!lv_add_mirrors(cmd, lv, lp->mirrors - 1, lp->stripes, - lp->stripe_size, - adjusted_mirror_region_size( - vg->extent_size, - lv->le_count, - lp->region_size), - lp->log_count, lp->pvh, lp->alloc, - MIRROR_BY_LV | - (lp->nosync ? MIRROR_SKIP_INIT_SYNC : 0))) { + if ((lp->mirrors > 1) && lp->log_count) { + if (!add_mirror_log(cmd, lv, lp->log_count, + first_seg(lv)->region_size, + lp->pvh, lp->alloc)) { stack; goto revert_new_lv; } --- LVM2/lib/metadata/metadata-exported.h 2011/03/29 12:51:57 1.188 +++ LVM2/lib/metadata/metadata-exported.h 2011/04/06 21:32:20 1.189 @@ -500,10 +500,9 @@ 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, - uint64_t status, struct dm_list *allocatable_pvs, - alloc_policy_t alloc); + uint32_t mirrors, uint32_t region_size, + uint32_t extents, + struct dm_list *allocatable_pvs, alloc_policy_t alloc); /* lv must be part of lv->vg->lvs */ int lv_remove(struct logical_volume *lv); --- LVM2/lib/metadata/mirror.c 2011/03/29 12:51:57 1.146 +++ LVM2/lib/metadata/mirror.c 2011/04/06 21:32:20 1.147 @@ -1899,8 +1899,9 @@ } /* check sync status */ - if (lv_mirror_percent(cmd, lv, 0, &sync_percent, NULL) && - (sync_percent == PERCENT_100)) + if (mirror_in_sync() || + (lv_mirror_percent(cmd, lv, 0, &sync_percent, NULL) && + (sync_percent == PERCENT_100))) in_sync = 1; else in_sync = 0; --- LVM2/tools/lvresize.c 2011/03/02 16:56:07 1.129 +++ LVM2/tools/lvresize.c 2011/04/06 21:32:21 1.130 @@ -670,10 +670,11 @@ return ECMD_FAILED; } } else if ((lp->extents > lv->le_count) && /* Ensure we extend */ - !lv_extend(lv, lp->segtype, lp->stripes, - lp->stripe_size, lp->mirrors, + !lv_extend(lv, lp->segtype, + lp->stripes, lp->stripe_size, + lp->mirrors, first_seg(lv)->region_size, lp->extents - lv->le_count, - NULL, 0u, 0u, pvh, alloc)) { + pvh, alloc)) { stack; return ECMD_FAILED; } From jbrassow@sourceware.org Thu Apr 7 21:49:00 2011 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 07 Apr 2011 21:49:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c Message-ID: <20110407214931.10279.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2011-04-07 21:49:30 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c Log message: Thanks to Zdenek Kabelac (kabi) for pointing out that I was using dm_pool_free incorrectly. This check-in fixes that incorrect usage. I've also added a WHATS_NEW line to reflect the changes I made to allow lv_extend to operate on 0 length intrinsically layered LVs (i.e mirrors and RAID). I forgot that in the last commit. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1967&r2=1.1968 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.255&r2=1.256 --- LVM2/WHATS_NEW 2011/03/30 13:14:34 1.1967 +++ LVM2/WHATS_NEW 2011/04/07 21:49:29 1.1968 @@ -1,5 +1,6 @@ Version 2.02.85 - =================================== + Allow lv_extend() to work on zero length intrinsically layered LVs. Keep the cache content when the exported vg buffer is matching. Extend the set of memory regions, that are not locked to memory. Enhance usability with the valgrind memcheck tool. --- LVM2/lib/metadata/lv_manip.c 2011/04/06 21:32:20 1.255 +++ LVM2/lib/metadata/lv_manip.c 2011/04/07 21:49:29 1.256 @@ -2114,8 +2114,8 @@ struct logical_volume *sub_lv; uint32_t i; uint64_t status = 0; - char *img_name; - size_t len; + size_t len = strlen(lv->name) + 32; + char img_name[len]; struct lv_segment *mapseg; if (lv->le_count || first_seg(lv)) { @@ -2141,9 +2141,6 @@ /* * Next, create all of our sub_lv's and link them in. */ - len = strlen(lv->name) + 32; - if (!(img_name = dm_pool_alloc(lv->vg->cmd->mem, len))) - return_0; if (dm_snprintf(img_name, len, "%s%s", lv->name, "_mimage_%d") < 0) return_0; @@ -2157,7 +2154,6 @@ } dm_list_add(&lv->segments, &mapseg->list); - dm_pool_free(lv->vg->cmd->mem, img_name); return 1; } From zkabelac@sourceware.org Fri Apr 8 14:11:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Fri, 08 Apr 2011 14:11:00 -0000 Subject: LVM2/lib/misc util.h Message-ID: <20110408141141.8674.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-08 14:11:40 Modified files: lib/misc : util.h Log message: Newer gcc doesn't need this trick In fact it now generates an opposite warning about using undefined variable. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/util.h.diff?cvsroot=lvm2&r1=1.7&r2=1.8 --- LVM2/lib/misc/util.h 2010/10/26 10:04:34 1.7 +++ LVM2/lib/misc/util.h 2011/04/08 14:11:40 1.8 @@ -25,7 +25,7 @@ (void) (&_a == &_b); \ _a > _b ? _a : _b; }) -#ifdef __clang__ +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) #define uninitialized_var(x) x #else #define uninitialized_var(x) x = x From zkabelac@sourceware.org Fri Apr 8 14:13:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Fri, 08 Apr 2011 14:13:00 -0000 Subject: LVM2/lib locking/file_locking.c log/log.c Message-ID: <20110408141308.10185.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-08 14:13:08 Modified files: lib/locking : file_locking.c lib/log : log.c Log message: Fix some forgotten -Wold-style-definition gcc warnings Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.62&r2=1.63 --- LVM2/lib/locking/file_locking.c 2011/02/18 00:36:05 1.58 +++ LVM2/lib/locking/file_locking.c 2011/04/08 14:13:08 1.59 @@ -334,11 +334,12 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd) { + int r; + locking->lock_resource = _file_lock_resource; locking->reset_locking = _reset_file_locking; locking->fin_locking = _fin_file_locking; locking->flags = 0; - int r; /* Get lockfile directory from config file */ strncpy(_lock_dir, find_config_tree_str(cmd, "global/locking_dir", --- LVM2/lib/log/log.c 2011/03/30 12:53:04 1.62 +++ LVM2/lib/log/log.c 2011/04/08 14:13:08 1.63 @@ -127,7 +127,7 @@ } } -void fin_syslog() +void fin_syslog(void) { if (_syslog) closelog(); From zkabelac@sourceware.org Fri Apr 8 14:14:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Fri, 08 Apr 2011 14:14:00 -0000 Subject: LVM2/lib/datastruct btree.c Message-ID: <20110408141458.10572.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-08 14:14:58 Modified files: lib/datastruct : btree.c Log message: Better const cast logic (although still gcc gives const violation warning) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/datastruct/btree.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15 --- LVM2/lib/datastruct/btree.c 2010/12/20 13:19:13 1.14 +++ LVM2/lib/datastruct/btree.c 2011/04/08 14:14:57 1.15 @@ -55,7 +55,7 @@ #endif } -static struct node **_lookup(struct node *const *c, uint32_t key, +static struct node *const *_lookup(struct node *const *c, uint32_t key, struct node **p) { *p = NULL; @@ -71,20 +71,20 @@ c = &(*c)->r; } - return (struct node **)c; + return c; } void *btree_lookup(const struct btree *t, uint32_t k) { uint32_t key = _shuffle(k); - struct node *p, **c = _lookup(&t->root, key, &p); + struct node *p, *const *c = _lookup(&t->root, key, &p); return (*c) ? (*c)->data : NULL; } int btree_insert(struct btree *t, uint32_t k, void *data) { uint32_t key = _shuffle(k); - struct node *p, **c = _lookup(&t->root, key, &p), *n; + struct node *p, **c = (struct node **) _lookup(&t->root, key, &p), *n; if (!*c) { if (!(n = dm_pool_alloc(t->mem, sizeof(*n)))) From zkabelac@sourceware.org Fri Apr 8 14:18:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Fri, 08 Apr 2011 14:18:00 -0000 Subject: LVM2/daemons/dmeventd/plugins/snapshot dmevent ... Message-ID: <20110408141841.13859.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-08 14:18:40 Modified files: daemons/dmeventd/plugins/snapshot: dmeventd_snapshot.c Log message: Use dm_snprintf and fix differently signed comparation. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15 --- LVM2/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c 2011/02/14 14:26:36 1.14 +++ LVM2/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c 2011/04/08 14:18:40 1.15 @@ -125,8 +125,8 @@ syslog(LOG_ERR, "Unable to determine VG name from %s.", device); return 0; } - if (sizeof(cmd_str) <= snprintf(cmd_str, sizeof(cmd_str), - "lvextend --use-policies %s/%s", vg, lv)) { + if (dm_snprintf(cmd_str, sizeof(cmd_str), + "lvextend --use-policies %s/%s", vg, lv) < 0) { syslog(LOG_ERR, "Unable to form LVM command: Device name too long."); return 0; } From zkabelac@sourceware.org Fri Apr 8 14:21:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Fri, 08 Apr 2011 14:21:00 -0000 Subject: LVM2/lib/format_text export.c Message-ID: <20110408142135.14536.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-08 14:21:35 Modified files: lib/format_text: export.c Log message: Add missing printf attributes These attributes were missing in previous patch, that was adding instrumentation for printf formating string parameter. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/export.c.diff?cvsroot=lvm2&r1=1.80&r2=1.81 --- LVM2/lib/format_text/export.c 2010/11/29 12:19:58 1.80 +++ LVM2/lib/format_text/export.c 2011/04/08 14:21:34 1.81 @@ -27,6 +27,7 @@ #include struct formatter; +__attribute__((format(printf, 3, 0))) typedef int (*out_with_comment_fn) (struct formatter * f, const char *comment, const char *fmt, va_list ap); typedef int (*nl_fn) (struct formatter * f); @@ -147,6 +148,7 @@ } #define COMMENT_TAB 6 +__attribute__((format(printf, 3, 0))) static int _out_with_comment_file(struct formatter *f, const char *comment, const char *fmt, va_list ap) { @@ -182,6 +184,7 @@ return 1; } +__attribute__((format(printf, 3, 0))) static int _out_with_comment_raw(struct formatter *f, const char *comment __attribute__((unused)), const char *fmt, va_list ap) From zkabelac@sourceware.org Fri Apr 8 14:40:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Fri, 08 Apr 2011 14:40:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd-command.c ... Message-ID: <20110408144024.11943.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-08 14:40:21 Modified files: . : WHATS_NEW daemons/clvmd : clvmd-command.c clvmd.c refresh_clvmd.c lib/activate : fs.c lib/device : dev-swap.c lib/locking : cluster_locking.c lib/metadata : lv_manip.c metadata.c mirror.c lib/misc : lvm-string.c lib/mm : memlock.c libdm : libdm-file.c libdm-report.c libdm/regex : matcher.c tools : dmsetup.c lvconvert.c lvmcmdline.c Log message: Fix some unmatching sign comparation gcc warnings Simple replacement for unsigned type - usually in for() loops. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1968&r2=1.1969 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.53&r2=1.54 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.103&r2=1.104 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/refresh_clvmd.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.c.diff?cvsroot=lvm2&r1=1.61&r2=1.62 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-swap.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.256&r2=1.257 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.453&r2=1.454 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.147&r2=1.148 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-string.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mm/memlock.c.diff?cvsroot=lvm2&r1=1.39&r2=1.40 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-file.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-report.c.diff?cvsroot=lvm2&r1=1.43&r2=1.44 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/regex/matcher.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.158&r2=1.159 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.159&r2=1.160 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.137&r2=1.138 --- LVM2/WHATS_NEW 2011/04/07 21:49:29 1.1968 +++ LVM2/WHATS_NEW 2011/04/08 14:40:18 1.1969 @@ -1,5 +1,6 @@ Version 2.02.85 - =================================== + Fix some unmatching sign comparation gcc warnings in the code. Allow lv_extend() to work on zero length intrinsically layered LVs. Keep the cache content when the exported vg buffer is matching. Extend the set of memory regions, that are not locked to memory. --- LVM2/daemons/clvmd/clvmd-command.c 2011/02/18 16:17:56 1.53 +++ LVM2/daemons/clvmd/clvmd-command.c 2011/04/08 14:40:18 1.54 @@ -377,7 +377,7 @@ /* Propogate debug options */ if (clvmd_get_debug()) { if (!(debug_arg = malloc(16)) || - dm_snprintf(debug_arg, 16, "-d%d", (int)clvmd_get_debug()) < 0) + dm_snprintf(debug_arg, 16, "-d%u", clvmd_get_debug()) < 0) goto_out; argv[argc++] = debug_arg; debug_arg = NULL; --- LVM2/daemons/clvmd/clvmd.c 2011/03/30 12:48:16 1.103 +++ LVM2/daemons/clvmd/clvmd.c 2011/04/08 14:40:18 1.104 @@ -2157,7 +2157,7 @@ { struct local_client *thisfd; for (thisfd = &local_client_head; thisfd != NULL; thisfd = thisfd->next) { - if (thisfd->fd == ntohl(clientid)) + if (thisfd->fd == (int)ntohl(clientid)) return thisfd; } return NULL; --- LVM2/daemons/clvmd/refresh_clvmd.c 2011/03/29 21:05:39 1.14 +++ LVM2/daemons/clvmd/refresh_clvmd.c 2011/04/08 14:40:18 1.15 @@ -80,7 +80,7 @@ char outbuf[PIPE_BUF]; struct clvm_header *outheader = (struct clvm_header *) outbuf; int len; - int off; + unsigned off; int buflen; int err; --- LVM2/lib/activate/fs.c 2011/02/18 14:16:11 1.61 +++ LVM2/lib/activate/fs.c 2011/04/08 14:40:19 1.62 @@ -327,7 +327,7 @@ /* Check if there is other the type of fs operation stacked */ static int _other_fs_ops(fs_op_t type) { - int i; + unsigned i; for (i = 0; i < NUM_FS_OPS; i++) if (type != i && _count_fs_ops[i]) --- LVM2/lib/device/dev-swap.c 2010/08/19 23:05:45 1.2 +++ LVM2/lib/device/dev-swap.c 2011/04/08 14:40:19 1.3 @@ -42,7 +42,8 @@ { char buf[10]; uint64_t size; - int page, ret = 0; + unsigned page; + int ret = 0; if (!dev_get_size(dev, &size)) { stack; --- LVM2/lib/locking/cluster_locking.c 2011/03/29 21:05:39 1.54 +++ LVM2/lib/locking/cluster_locking.c 2011/04/08 14:40:19 1.55 @@ -100,7 +100,7 @@ char outbuf[PIPE_BUF] __attribute__((aligned(8))); struct clvm_header *outheader = (struct clvm_header *) outbuf; int len; - int off; + unsigned off; int buflen; int err; --- LVM2/lib/metadata/lv_manip.c 2011/04/07 21:49:29 1.256 +++ LVM2/lib/metadata/lv_manip.c 2011/04/08 14:40:19 1.257 @@ -976,7 +976,7 @@ (le - seg->le) / area_multiple, area_len, NULL, max_seg_len, 0, (stripes_per_mimage == 1) && only_single_area_segments ? 1U : 0U, - top_level_area_index != -1 ? top_level_area_index : (int) s * stripes_per_mimage, + (top_level_area_index != -1) ? top_level_area_index : (int) (s * stripes_per_mimage), only_single_area_segments, fn, data))) stack; --- LVM2/lib/metadata/metadata.c 2011/04/01 14:54:20 1.453 +++ LVM2/lib/metadata/metadata.c 2011/04/08 14:40:20 1.454 @@ -1987,7 +1987,7 @@ int (*fn)(struct logical_volume *lv, void *data), void *data) { - int i, s; + unsigned i, s; struct lv_segment *lvseg; struct logical_volume *deps[] = { @@ -2111,7 +2111,7 @@ static int _lv_mark_if_partial_single(struct logical_volume *lv, void *data) { - int s; + unsigned s; struct _lv_mark_if_partial_baton baton; struct lv_segment *lvseg; @@ -2200,7 +2200,7 @@ struct validate_hash *vhash = data; struct lv_segment *lvseg; struct physical_volume *pv; - int s; + unsigned s; int r = 1; if (lv != dm_hash_lookup_binary(vhash->lvid, &lv->lvid.id[1], --- LVM2/lib/metadata/mirror.c 2011/04/06 21:32:20 1.147 +++ LVM2/lib/metadata/mirror.c 2011/04/08 14:40:20 1.148 @@ -200,7 +200,7 @@ */ int shift_mirror_images(struct lv_segment *mirrored_seg, unsigned mimage) { - int i; + unsigned i; struct lv_segment_area area; if (mimage >= mirrored_seg->area_count) { @@ -1836,7 +1836,7 @@ int in_sync; struct logical_volume *log_lv; struct lvinfo info; - int old_log_count; + unsigned old_log_count; int r = 0; if (dm_list_size(&lv->segments) != 1) { --- LVM2/lib/misc/lvm-string.c 2011/03/13 23:18:30 1.26 +++ LVM2/lib/misc/lvm-string.c 2011/04/08 14:40:20 1.27 @@ -144,7 +144,7 @@ * process several characters in one go. */ static void _unquote_characters(char *src, const char *orig_chars, - const int num_orig_chars, + size_t num_orig_chars, const char quote_char, char *arr_substr_first_unquoted[]) { --- LVM2/lib/mm/memlock.c 2011/03/30 13:06:13 1.39 +++ LVM2/lib/mm/memlock.c 2011/04/08 14:40:20 1.40 @@ -151,7 +151,8 @@ { const struct config_value *cv; long from, to; - int pos, i; + int pos; + unsigned i; char fr, fw, fx, fp; size_t sz; --- LVM2/libdm/libdm-file.c 2010/10/20 15:12:12 1.14 +++ LVM2/libdm/libdm-file.c 2011/04/08 14:40:20 1.15 @@ -149,7 +149,7 @@ goto fail_close_unlink; } - if ((write_out == 0) || (write_out < bufferlen)) { + if ((write_out == 0) || ((size_t)write_out < bufferlen)) { log_error("Cannot write pid to pidfile [%s], shortwrite of" "[%" PRIsize_t "] bytes, expected [%" PRIsize_t "]\n", lockfile, write_out, bufferlen); --- LVM2/libdm/libdm-report.c 2011/02/18 23:09:55 1.43 +++ LVM2/libdm/libdm-report.c 2011/04/08 14:40:20 1.44 @@ -734,8 +734,8 @@ return 0; } - if ((strlen(field->report_string) > field->props->width)) - field->props->width = strlen(field->report_string); + if (((int) strlen(field->report_string) > field->props->width)) + field->props->width = (int) strlen(field->report_string); if ((rh->flags & RH_SORT_REQUIRED) && (field->props->flags & FLD_SORT_KEY)) { @@ -775,8 +775,8 @@ } dm_list_iterate_items(fp, &rh->field_props) { - if (buf_size < fp->width) - buf_size = fp->width; + if ((int) buf_size < fp->width) + buf_size = (size_t) fp->width; } /* Including trailing '\0'! */ buf_size++; --- LVM2/libdm/regex/matcher.c 2010/12/20 13:23:12 1.16 +++ LVM2/libdm/regex/matcher.c 2011/04/08 14:40:21 1.17 @@ -100,7 +100,7 @@ static void _create_bitsets(struct dm_regex *m) { - int i; + unsigned i; for (i = 0; i < m->num_nodes; i++) { struct rx_node *n = m->nodes[i]; @@ -112,7 +112,7 @@ static void _calc_functions(struct dm_regex *m) { - int i, j, final = 1; + unsigned i, j, final = 1; struct rx_node *rx, *c1, *c2; for (i = 0; i < m->num_nodes; i++) { @@ -253,7 +253,8 @@ { unsigned iwidth = (m->num_charsets / DM_BITS_PER_INT) + 1; struct dfa_state *dfa; - int i, a; + unsigned i; + int a; m->tt = ttree_create(m->scratch, iwidth); if (!m->tt) @@ -314,7 +315,7 @@ unsigned num_patterns) { char *all, *ptr; - int i; + unsigned i; size_t len = 0; struct rx_node *rx; struct dm_regex *m; --- LVM2/tools/dmsetup.c 2011/03/29 21:56:53 1.158 +++ LVM2/tools/dmsetup.c 2011/04/08 14:40:21 1.159 @@ -2412,7 +2412,7 @@ void *private) { const struct dm_deps *deps = data; - int i; + unsigned i; char buf[DM_MAX_TYPE_NAME], *repstr; if (!dm_pool_begin_object(mem, 16)) { --- LVM2/tools/lvconvert.c 2011/03/29 12:51:58 1.159 +++ LVM2/tools/lvconvert.c 2011/04/08 14:40:21 1.160 @@ -555,7 +555,7 @@ { struct lv_segment *lvseg; int ret = 0; - int s; + unsigned s; dm_list_iterate_items(lvseg, &lv->segments) { if (!seg_is_mirrored(lvseg)) --- LVM2/tools/lvmcmdline.c 2011/01/13 15:00:29 1.137 +++ LVM2/tools/lvmcmdline.c 2011/04/08 14:40:21 1.138 @@ -1274,7 +1274,7 @@ if (getenv("LVM_SUPPRESS_FD_WARNINGS")) suppress_warnings = 1; - for (fd = 3; fd < rlim.rlim_cur; fd++) + for (fd = 3; fd < (int)rlim.rlim_cur; fd++) _close_descriptor(fd, suppress_warnings, command, ppid, parent_cmdline); } From zkabelac@sourceware.org Sat Apr 9 19:05:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Sat, 09 Apr 2011 19:05:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c lib/m ... Message-ID: <20110409190526.30443.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-09 19:05:24 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c mirror.c tools : lvconvert.c Log message: Fix incorrect tests for dm_snprintf() failure As the memory is preallocated based on arg size in these cases, the error would be quite hard to trigger here anyway. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1969&r2=1.1970 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.257&r2=1.258 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.148&r2=1.149 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.160&r2=1.161 --- LVM2/WHATS_NEW 2011/04/08 14:40:18 1.1969 +++ LVM2/WHATS_NEW 2011/04/09 19:05:23 1.1970 @@ -1,5 +1,6 @@ Version 2.02.85 - =================================== + Fix incorrect tests for dm_snprintf() failure. Fix some unmatching sign comparation gcc warnings in the code. Allow lv_extend() to work on zero length intrinsically layered LVs. Keep the cache content when the exported vg buffer is matching. --- LVM2/lib/metadata/lv_manip.c 2011/04/08 14:40:19 1.257 +++ LVM2/lib/metadata/lv_manip.c 2011/04/09 19:05:24 1.258 @@ -2296,7 +2296,7 @@ log_error("Failed to allocate space for new name"); return 0; } - if (!dm_snprintf(new_name, len, "%s%s", lv_name_new, suffix)) { + if (dm_snprintf(new_name, len, "%s%s", lv_name_new, suffix) < 0) { log_error("Failed to create new name"); return 0; } --- LVM2/lib/metadata/mirror.c 2011/04/08 14:40:20 1.148 +++ LVM2/lib/metadata/mirror.c 2011/04/09 19:05:24 1.149 @@ -1787,7 +1787,7 @@ } else if ((lv_name = strstr(lv->name, MIRROR_SYNC_LAYER))) { len = lv_name - lv->name + 1; if (!(tmp_name = alloca(len)) || - !dm_snprintf(tmp_name, len, "%s", lv->name)) { + (dm_snprintf(tmp_name, len, "%s", lv->name) < 0)) { log_error("mirror log name allocation failed"); return 0; } --- LVM2/tools/lvconvert.c 2011/04/08 14:40:21 1.160 +++ LVM2/tools/lvconvert.c 2011/04/09 19:05:24 1.161 @@ -481,7 +481,7 @@ if (!uuid || !lv_full_name) return_0; - if (!dm_snprintf(lv_full_name, len, "%s/%s", lv->vg->name, lv->name)) + if (dm_snprintf(lv_full_name, len, "%s/%s", lv->vg->name, lv->name) < 0) return_0; memcpy(uuid, &lv->lvid, sizeof(lv->lvid)); From mornfall@sourceware.org Tue Apr 12 12:24:00 2011 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Tue, 12 Apr 2011 12:24:00 -0000 Subject: LVM2 lib/metadata/lv.c lib/metadata/lv.h lib/r ... Message-ID: <20110412122431.26467.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-04-12 12:24:30 Modified files: lib/metadata : lv.c lv.h lib/report : properties.c report.c test/api : test.c Log message: This patchset refactors some reporting code and completes the remaining lvseg properties for lvm2app, 'devices' and 'seg_pe_ranges'. Signed-off-by: Dave Wysochanski Reviewed-by: Petr Rockai Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.c.diff?cvsroot=lvm2&r1=1.23&r2=1.24 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.h.diff?cvsroot=lvm2&r1=1.19&r2=1.20 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.143&r2=1.144 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/test.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37 --- LVM2/lib/metadata/lv.c 2011/03/29 12:51:57 1.23 +++ LVM2/lib/metadata/lv.c 2011/04/12 12:24:29 1.24 @@ -21,6 +21,88 @@ #include "segtype.h" #include "str_list.h" +static char *_format_pvsegs(struct dm_pool *mem, const struct lv_segment *seg, + int range_format) +{ + unsigned int s; + const char *name = NULL; + uint32_t extent = 0; + char extent_str[32]; + + if (!dm_pool_begin_object(mem, 256)) { + log_error("dm_pool_begin_object failed"); + return NULL; + } + + for (s = 0; s < seg->area_count; s++) { + switch (seg_type(seg, s)) { + case AREA_LV: + name = seg_lv(seg, s)->name; + extent = seg_le(seg, s); + break; + case AREA_PV: + name = dev_name(seg_dev(seg, s)); + extent = seg_pe(seg, s); + break; + case AREA_UNASSIGNED: + name = "unassigned"; + extent = 0; + } + + if (!dm_pool_grow_object(mem, name, strlen(name))) { + log_error("dm_pool_grow_object failed"); + return NULL; + } + + if (dm_snprintf(extent_str, sizeof(extent_str), + "%s%" PRIu32 "%s", + range_format ? ":" : "(", extent, + range_format ? "-" : ")") < 0) { + log_error("Extent number dm_snprintf failed"); + return NULL; + } + if (!dm_pool_grow_object(mem, extent_str, strlen(extent_str))) { + log_error("dm_pool_grow_object failed"); + return NULL; + } + + if (range_format) { + if (dm_snprintf(extent_str, sizeof(extent_str), + "%" PRIu32, extent + seg->area_len - 1) < 0) { + log_error("Extent number dm_snprintf failed"); + return NULL; + } + if (!dm_pool_grow_object(mem, extent_str, strlen(extent_str))) { + log_error("dm_pool_grow_object failed"); + return NULL; + } + } + + if ((s != seg->area_count - 1) && + !dm_pool_grow_object(mem, range_format ? " " : ",", 1)) { + log_error("dm_pool_grow_object failed"); + return NULL; + } + } + + if (!dm_pool_grow_object(mem, "\0", 1)) { + log_error("dm_pool_grow_object failed"); + return NULL; + } + + return dm_pool_end_object(mem); +} + +char *lvseg_devices(struct dm_pool *mem, const struct lv_segment *seg) +{ + return _format_pvsegs(mem, seg, 0); +} + +char *lvseg_seg_pe_ranges(struct dm_pool *mem, const struct lv_segment *seg) +{ + return _format_pvsegs(mem, seg, 1); +} + char *lvseg_tags_dup(const struct lv_segment *seg) { return tags_format_and_copy(seg->lv->vg->vgmem, &seg->tags); --- LVM2/lib/metadata/lv.h 2011/03/05 12:14:00 1.19 +++ LVM2/lib/metadata/lv.h 2011/04/12 12:24:29 1.20 @@ -68,5 +68,7 @@ uint64_t lvseg_chunksize(const struct lv_segment *seg); char *lvseg_segtype_dup(struct dm_pool *mem, const struct lv_segment *seg); char *lvseg_tags_dup(const struct lv_segment *seg); +char *lvseg_devices(struct dm_pool *mem, const struct lv_segment *seg); +char *lvseg_seg_pe_ranges(struct dm_pool *mem, const struct lv_segment *seg); #endif /* _LVM_LV_H */ --- LVM2/lib/report/properties.c 2011/03/05 12:14:00 1.30 +++ LVM2/lib/report/properties.c 2011/04/12 12:24:29 1.31 @@ -249,9 +249,10 @@ #define _seg_size_set _not_implemented_set GET_LVSEG_STR_PROPERTY_FN(seg_tags, lvseg_tags_dup(lvseg)) #define _seg_tags_set _not_implemented_set -#define _seg_pe_ranges_get _not_implemented_get +GET_LVSEG_STR_PROPERTY_FN(seg_pe_ranges, + lvseg_seg_pe_ranges(lvseg->lv->vg->vgmem, lvseg)) #define _seg_pe_ranges_set _not_implemented_set -#define _devices_get _not_implemented_get +GET_LVSEG_STR_PROPERTY_FN(devices, lvseg_devices(lvseg->lv->vg->vgmem, lvseg)) #define _devices_set _not_implemented_set --- LVM2/lib/report/report.c 2011/03/05 12:14:00 1.143 +++ LVM2/lib/report/report.c 2011/04/12 12:24:29 1.144 @@ -56,93 +56,30 @@ return dm_report_field_string(rh, field, &name); } -static int _format_pvsegs(struct dm_pool *mem, struct dm_report_field *field, - const void *data, int range_format) +static int _devices_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private __attribute__((unused))) { - const struct lv_segment *seg = (const struct lv_segment *) data; - unsigned int s; - const char *name = NULL; - uint32_t extent = 0; - char extent_str[32]; - - if (!dm_pool_begin_object(mem, 256)) { - log_error("dm_pool_begin_object failed"); - return 0; - } - - for (s = 0; s < seg->area_count; s++) { - switch (seg_type(seg, s)) { - case AREA_LV: - name = seg_lv(seg, s)->name; - extent = seg_le(seg, s); - break; - case AREA_PV: - name = dev_name(seg_dev(seg, s)); - extent = seg_pe(seg, s); - break; - case AREA_UNASSIGNED: - name = "unassigned"; - extent = 0; - } - - if (!dm_pool_grow_object(mem, name, strlen(name))) { - log_error("dm_pool_grow_object failed"); - return 0; - } - - if (dm_snprintf(extent_str, sizeof(extent_str), - "%s%" PRIu32 "%s", - range_format ? ":" : "(", extent, - range_format ? "-" : ")") < 0) { - log_error("Extent number dm_snprintf failed"); - return 0; - } - if (!dm_pool_grow_object(mem, extent_str, strlen(extent_str))) { - log_error("dm_pool_grow_object failed"); - return 0; - } - - if (range_format) { - if (dm_snprintf(extent_str, sizeof(extent_str), - "%" PRIu32, extent + seg->area_len - 1) < 0) { - log_error("Extent number dm_snprintf failed"); - return 0; - } - if (!dm_pool_grow_object(mem, extent_str, strlen(extent_str))) { - log_error("dm_pool_grow_object failed"); - return 0; - } - } - - if ((s != seg->area_count - 1) && - !dm_pool_grow_object(mem, range_format ? " " : ",", 1)) { - log_error("dm_pool_grow_object failed"); - return 0; - } - } - - if (!dm_pool_grow_object(mem, "\0", 1)) { - log_error("dm_pool_grow_object failed"); + char *str; + if (!(str = lvseg_devices(mem, (const struct lv_segment *) data))) return 0; - } - dm_report_field_set_value(field, dm_pool_end_object(mem), NULL); + dm_report_field_set_value(field, str, NULL); return 1; } -static int _devices_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem, - struct dm_report_field *field, - const void *data, void *private __attribute__((unused))) -{ - return _format_pvsegs(mem, field, data, 0); -} - static int _peranges_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private __attribute__((unused))) { - return _format_pvsegs(mem, field, data, 1); + char *str; + if (!(str = lvseg_seg_pe_ranges(mem, (const struct lv_segment *) data))) + return 0; + + dm_report_field_set_value(field, str, NULL); + + return 1; } static int _tags_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem, --- LVM2/test/api/test.c 2011/03/01 23:29:14 1.36 +++ LVM2/test/api/test.c 2011/04/12 12:24:29 1.37 @@ -873,6 +873,10 @@ _print_property_value("seg_start_pe", v); v = lvm_lvseg_get_property(lvl->lvseg, "seg_size"); _print_property_value("seg_size", v); + v = lvm_lvseg_get_property(lvl->lvseg, "devices"); + _print_property_value("devices", v); + v = lvm_lvseg_get_property(lvl->lvseg, "seg_pe_ranges"); + _print_property_value("seg_pe_ranges", v); } } From mornfall@sourceware.org Tue Apr 12 12:39:00 2011 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Tue, 12 Apr 2011 12:39:00 -0000 Subject: LVM2/test t-lvconvert-repair-policy.sh lib/che ... Message-ID: <20110412123925.23986.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-04-12 12:39:25 Modified files: test : t-lvconvert-repair-policy.sh test/lib : check.sh Log message: Make the mirror log checks in t-lvconvert-repair-policy a bit more strict (i.e. accurate). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvconvert-repair-policy.sh.diff?cvsroot=lvm2&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/check.sh.diff?cvsroot=lvm2&r1=1.4&r2=1.5 --- LVM2/test/t-lvconvert-repair-policy.sh 2011/02/28 19:44:21 1.9 +++ LVM2/test/t-lvconvert-repair-policy.sh 2011/04/12 12:39:24 1.10 @@ -45,7 +45,7 @@ aux disable_dev $dev1 repair 'activation { mirror_image_fault_policy = "replace" mirror_log_fault_policy = "remove" }' check mirror $vg mirror -lvs | grep mirror_mlog +check active $vg mirror_mlog cleanup $dev1 # Fail a leg of a mirror. @@ -53,7 +53,7 @@ aux disable_dev $dev1 repair 'activation { mirror_image_fault_policy = "replace" }' check mirror $vg mirror -lvs | grep mirror_mlog +check active $vg mirror_mlog cleanup $dev1 # Fail a leg of a mirror (use old name for policy specification) @@ -61,7 +61,7 @@ aux disable_dev $dev1 repair 'activation { mirror_image_fault_policy = "replace" }' check mirror $vg mirror -lvs | grep mirror_mlog +check active $vg mirror_mlog cleanup $dev1 # Fail a leg of a mirror w/ no available spare @@ -70,7 +70,7 @@ aux disable_dev $dev2 $dev4 repair 'activation { mirror_image_fault_policy = "replace" }' check mirror $vg mirror -lvs | not grep mirror_mlog +not check lv_exists $vg mirror_mlog cleanup $dev2 $dev4 # Fail the log device of a mirror w/ no available spare @@ -78,7 +78,7 @@ aux disable_dev $dev3 $dev4 repair 'activation { mirror_image_fault_policy = "replace" }' $vg/mirror check mirror $vg mirror -lvs | not grep mirror_mlog +not check lv_exists $vg mirror_mlog cleanup $dev3 $dev4 # Fail the log device with a remove policy @@ -87,5 +87,5 @@ aux disable_dev $dev3 $dev4 repair 'activation { mirror_log_fault_policy = "remove" }' check mirror $vg mirror core -lvs | not grep mirror_mlog +not check lv_exists $vg mirror_mlog cleanup $dev3 $dev4 --- LVM2/test/lib/check.sh 2011/01/28 16:08:39 1.4 +++ LVM2/test/lib/check.sh 2011/04/12 12:39:24 1.5 @@ -209,6 +209,14 @@ } } +lv_exists() { + lv="$1/$2" + lvl "$lv" >& /dev/null || { + echo "$lv expected to exist but does not" + exit 1 + } +} + pv_field() { actual=$(trim $(pvs --noheadings $4 -o $2 $1)) From zkabelac@sourceware.org Tue Apr 12 14:13:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Tue, 12 Apr 2011 14:13:00 -0000 Subject: LVM2/lib/metadata mirror.c Message-ID: <20110412141318.7422.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-12 14:13:18 Modified files: lib/metadata : mirror.c Log message: Replace dm_snprintf with strncpy My previous patch fixed incorrect error check for dm_snprintf. However in this particular case - dm_snprintf has been used differently - just like strncpy + setting last char with '\0' - so the code had to return error - because the buffer was to short for whole string. Patch replaces it with real strncpy. Also test for alloca() failure is removed - as the program behaviour is rather undefined in this case - it never returns NULL. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.149&r2=1.150 --- LVM2/lib/metadata/mirror.c 2011/04/09 19:05:24 1.149 +++ LVM2/lib/metadata/mirror.c 2011/04/12 14:13:17 1.150 @@ -1785,13 +1785,10 @@ lv_name = lv->name; suffix = "_mlogtmp_%d"; } else if ((lv_name = strstr(lv->name, MIRROR_SYNC_LAYER))) { - len = lv_name - lv->name + 1; - if (!(tmp_name = alloca(len)) || - (dm_snprintf(tmp_name, len, "%s", lv->name) < 0)) { - log_error("mirror log name allocation failed"); - return 0; - } - lv_name = tmp_name; + len = lv_name - lv->name; + tmp_name = alloca(len + 1); + tmp_name[len] = '\0'; + lv_name = strncpy(tmp_name, lv->name, len); suffix = "_mlog"; } else { lv_name = lv->name; From snitzer@sourceware.org Tue Apr 12 20:44:00 2011 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Tue, 12 Apr 2011 20:44:00 -0000 Subject: LVM2/doc example.conf.in Message-ID: <20110412204442.10134.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2011-04-12 20:44:42 Modified files: doc : example.conf.in Log message: fix s/then/than/ typos in 'pv_min_size' section and fold floppy example into documentation preamble. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.19&r2=1.20 --- LVM2/doc/example.conf.in 2011/02/27 00:38:32 1.19 +++ LVM2/doc/example.conf.in 2011/04/12 20:44:41 1.20 @@ -147,11 +147,10 @@ # Minimal size (in KB) of the block device which can be used as a PV. # In clustered environment all nodes have to use the same value. - # Any value smaller then 512KB is ignored. - pv_min_size = 512 - - # Example: Ignore devices smaller then 2MB (i.e. floppy drives). + # Any value smaller than 512KB is ignored. + # Example: Ignore devices smaller than 2MB (i.e. floppy drives). # pv_min_size = 2048 + pv_min_size = 512 } # This section allows you to configure the way in which LVM selects From snitzer@sourceware.org Tue Apr 12 21:21:00 2011 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Tue, 12 Apr 2011 21:21:00 -0000 Subject: LVM2/man lvm.conf.5.in Message-ID: <20110412212108.27856.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2011-04-12 21:21:08 Modified files: man : lvm.conf.5.in Log message: fix s/then/than/ typo in lvm.conf.5.in Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvm.conf.5.in.diff?cvsroot=lvm2&r1=1.17&r2=1.18 --- LVM2/man/lvm.conf.5.in 2011/03/10 15:20:10 1.17 +++ LVM2/man/lvm.conf.5.in 2011/04/12 21:21:08 1.18 @@ -175,8 +175,8 @@ \fBpv_min_size\fP \(em Minimal size (in KB) of the block device which can be used as a PV. In clustered environment all nodes have to use the same value. -Any value smaller then 512KB is ignored. An example to -ignore devices smaller then 2MB (i.e. floppy drives): +Any value smaller than 512KB is ignored. An example to +ignore devices smaller than 2MB (i.e. floppy drives): .IP pv_min_size = 2048 .IP From snitzer@sourceware.org Tue Apr 12 21:59:00 2011 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Tue, 12 Apr 2011 21:59:00 -0000 Subject: LVM2 ./WHATS_NEW doc/example.conf.in lib/confi ... Message-ID: <20110412215905.28447.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2011-04-12 21:59:02 Modified files: . : WHATS_NEW doc : example.conf.in lib/config : defaults.h lib/device : dev-io.c device.c device.h lib/metadata : pv_manip.c man : lvm.conf.5.in Log message: Add "devices/issue_discards" to lvm.conf. Issue discards on lvremove if enabled and both storage and kernel have support. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1970&r2=1.1971 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.20&r2=1.21 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.72&r2=1.73 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-io.c.diff?cvsroot=lvm2&r1=1.75&r2=1.76 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.h.diff?cvsroot=lvm2&r1=1.47&r2=1.48 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_manip.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvm.conf.5.in.diff?cvsroot=lvm2&r1=1.18&r2=1.19 --- LVM2/WHATS_NEW 2011/04/09 19:05:23 1.1970 +++ LVM2/WHATS_NEW 2011/04/12 21:59:01 1.1971 @@ -1,5 +1,7 @@ Version 2.02.85 - =================================== + Add "devices/issue_discards" to lvm.conf. + Issue discards on lvremove if enabled and both storage and kernel have support. Fix incorrect tests for dm_snprintf() failure. Fix some unmatching sign comparation gcc warnings in the code. Allow lv_extend() to work on zero length intrinsically layered LVs. --- LVM2/doc/example.conf.in 2011/04/12 20:44:41 1.20 +++ LVM2/doc/example.conf.in 2011/04/12 21:59:01 1.21 @@ -151,6 +151,14 @@ # Example: Ignore devices smaller than 2MB (i.e. floppy drives). # pv_min_size = 2048 pv_min_size = 512 + + # Issue discards to an LV's underlying PV(s) when the LV is removed. + # Discards inform the storage that a region is no longer in use. If set + # to 1, discards will only be issued if both the storage and kernel provide + # support. Not all storage will support or benefit from discards but SSDs + # or thinly provisioned LUNs generally do. + # 1 enables; 0 disables. + issue_discards = 0 } # This section allows you to configure the way in which LVM selects --- LVM2/lib/config/defaults.h 2011/02/27 00:38:32 1.72 +++ LVM2/lib/config/defaults.h 2011/04/12 21:59:01 1.73 @@ -37,6 +37,7 @@ #define DEFAULT_REQUIRE_RESTOREFILE_WITH_UUID 1 #define DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION 1 #define DEFAULT_DATA_ALIGNMENT_DETECTION 1 +#define DEFAULT_ISSUE_DISCARDS 0 #define DEFAULT_LOCKING_LIB "liblvm2clusterlock.so" #define DEFAULT_FALLBACK_TO_LOCAL_LOCKING 1 --- LVM2/lib/device/dev-io.c 2011/03/29 20:19:03 1.75 +++ LVM2/lib/device/dev-io.c 2011/04/12 21:59:01 1.76 @@ -36,6 +36,9 @@ # ifndef BLKGETSIZE64 /* fs.h out-of-date */ # define BLKGETSIZE64 _IOR(0x12, 114, size_t) # endif /* BLKGETSIZE64 */ +# ifndef BLKDISCARD +# define BLKDISCARD _IO(0x12,119) +# endif #else # include # define BLKBSZGET DKIOCGETBLOCKSIZE @@ -301,6 +304,33 @@ return 1; } +static int _dev_discard_blocks(struct device *dev, uint64_t offset_bytes, uint64_t size_bytes) +{ + uint64_t discard_range[2]; + + if (!dev_open(dev)) + return_0; + + discard_range[0] = offset_bytes; + discard_range[1] = size_bytes; + + log_debug("Discarding %" PRIu64 " bytes offset %" PRIu64 " bytes on %s.", + size_bytes, offset_bytes, dev_name(dev)); + if (ioctl(dev->fd, BLKDISCARD, &discard_range) < 0) { + log_error("%s: BLKDISCARD ioctl at offset %" PRIu64 " size %" PRIu64 " failed: %s.", + dev_name(dev), offset_bytes, size_bytes, strerror(errno)); + if (!dev_close(dev)) + stack; + /* It doesn't matter if discard failed, so return success. */ + return 1; + } + + if (!dev_close(dev)) + stack; + + return 1; +} + /*----------------------------------------------------------------- * Public functions *---------------------------------------------------------------*/ @@ -329,6 +359,17 @@ return _dev_read_ahead_dev(dev, read_ahead); } +int dev_discard_blocks(struct device *dev, uint64_t offset_bytes, uint64_t size_bytes) +{ + if (!dev) + return 0; + + if (dev->flags & DEV_REGULAR) + return 1; + + return _dev_discard_blocks(dev, offset_bytes, size_bytes); +} + /* FIXME Unused int dev_get_sectsize(struct device *dev, uint32_t *size) { --- LVM2/lib/device/device.c 2011/03/13 22:52:20 1.37 +++ LVM2/lib/device/device.c 2011/04/12 21:59:01 1.38 @@ -455,6 +455,20 @@ sysfs_dir, dev); } +unsigned long dev_discard_max_bytes(const char *sysfs_dir, + struct device *dev) +{ + return _dev_topology_attribute("queue/discard_max_bytes", + sysfs_dir, dev); +} + +unsigned long dev_discard_granularity(const char *sysfs_dir, + struct device *dev) +{ + return _dev_topology_attribute("queue/discard_granularity", + sysfs_dir, dev); +} + #else int get_primary_dev(const char *sysfs_dir, @@ -481,4 +495,16 @@ return 0UL; } +unsigned long dev_discard_max_bytes(const char *sysfs_dir, + struct device *dev) +{ + return 0UL; +} + +unsigned long dev_discard_granularity(const char *sysfs_dir, + struct device *dev) +{ + return 0UL; +} + #endif --- LVM2/lib/device/device.h 2011/02/18 23:09:55 1.47 +++ LVM2/lib/device/device.h 2011/04/12 21:59:01 1.48 @@ -68,6 +68,7 @@ int dev_get_size(const struct device *dev, uint64_t *size); int dev_get_sectsize(struct device *dev, uint32_t *size); int dev_get_read_ahead(struct device *dev, uint32_t *read_ahead); +int dev_discard_blocks(struct device *dev, uint64_t offset_bytes, uint64_t size_bytes); /* Use quiet version if device number could change e.g. when opening LV */ int dev_open(struct device *dev); @@ -115,4 +116,10 @@ unsigned long dev_optimal_io_size(const char *sysfs_dir, struct device *dev); +unsigned long dev_discard_max_bytes(const char *sysfs_dir, + struct device *dev); + +unsigned long dev_discard_granularity(const char *sysfs_dir, + struct device *dev); + #endif --- LVM2/lib/metadata/pv_manip.c 2011/03/29 20:19:04 1.28 +++ LVM2/lib/metadata/pv_manip.c 2011/04/12 21:59:01 1.29 @@ -20,6 +20,7 @@ #include "archiver.h" #include "locking.h" #include "lvmcache.h" +#include "defaults.h" static struct pv_segment *_alloc_pv_segment(struct dm_pool *mem, struct physical_volume *pv, @@ -190,12 +191,38 @@ int release_pv_segment(struct pv_segment *peg, uint32_t area_reduction) { + uint64_t discard_offset; + uint64_t pe_start = peg->pv->pe_start; + uint64_t discard_area_reduction = area_reduction; + if (!peg->lvseg) { log_error("release_pv_segment with unallocated segment: " "%s PE %" PRIu32, pv_dev_name(peg->pv), peg->pe); return 0; } + /* + * Only issue discards if enabled in lvm.conf and both + * the device and kernel (>= 2.6.35) supports discards. + */ + if (find_config_tree_bool(peg->pv->fmt->cmd, + "devices/issue_discards", DEFAULT_ISSUE_DISCARDS) && + dev_discard_max_bytes(peg->pv->fmt->cmd->sysfs_dir, peg->pv->dev) && + dev_discard_granularity(peg->pv->fmt->cmd->sysfs_dir, peg->pv->dev)) { + if (!pe_start) { + /* skip the first extent */ + pe_start = peg->pv->vg->extent_size; + discard_area_reduction--; + } + discard_offset = peg->pe + peg->lvseg->area_len - area_reduction; + discard_offset = (discard_offset * peg->pv->vg->extent_size) + pe_start; + log_debug("Discarding %" PRIu32 " extents offset %" PRIu64 " sectors on %s.", + discard_area_reduction, discard_offset, dev_name(peg->pv->dev)); + if (!dev_discard_blocks(peg->pv->dev, discard_offset << SECTOR_SHIFT, + discard_area_reduction * peg->pv->vg->extent_size * SECTOR_SIZE)) + return_0; + } + if (peg->lvseg->area_len == area_reduction) { peg->pv->pe_alloc_count -= area_reduction; peg->lvseg->lv->vg->free_count += area_reduction; --- LVM2/man/lvm.conf.5.in 2011/04/12 21:21:08 1.18 +++ LVM2/man/lvm.conf.5.in 2011/04/12 21:59:02 1.19 @@ -180,6 +180,13 @@ .IP pv_min_size = 2048 .IP +\fBissue_discards\fP \(em +Issue discards to an LV's underlying PV(s) when the LV is removed. Discards +inform the storage that a region is no longer in use. If set to 1, discards will +only be issued if both the storage and kernel provide support. Not all storage +will support or benefit from discards but SSDs or thinly provisioned LUNs +generally do. +.IP .TP \fBallocation\fP \(em Space allocation policies .IP From snitzer@sourceware.org Tue Apr 12 22:04:00 2011 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Tue, 12 Apr 2011 22:04:00 -0000 Subject: LVM2/lib/metadata pv_manip.c Message-ID: <20110412220405.29632.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2011-04-12 22:04:04 Modified files: lib/metadata : pv_manip.c Log message: Use uint32_t rather than uint64_t. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_manip.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30 --- LVM2/lib/metadata/pv_manip.c 2011/04/12 21:59:01 1.29 +++ LVM2/lib/metadata/pv_manip.c 2011/04/12 22:04:04 1.30 @@ -193,7 +193,7 @@ { uint64_t discard_offset; uint64_t pe_start = peg->pv->pe_start; - uint64_t discard_area_reduction = area_reduction; + uint32_t discard_area_reduction = area_reduction; if (!peg->lvseg) { log_error("release_pv_segment with unallocated segment: " From snitzer@sourceware.org Wed Apr 13 18:26:00 2011 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Wed, 13 Apr 2011 18:26:00 -0000 Subject: LVM2 ./WHATS_NEW doc/example.conf.in lib/metad ... Message-ID: <20110413182640.13819.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2011-04-13 18:26:39 Modified files: . : WHATS_NEW doc : example.conf.in lib/metadata : pv_manip.c man : lvm.conf.5.in Log message: Improve the discard documentation. Also improve discard code in pv_manip.c to properly account for case when pe_start=0 and the first physical extent is to be released (currently skip the first extent to avoid discarding the PV label). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1971&r2=1.1972 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.21&r2=1.22 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_manip.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvm.conf.5.in.diff?cvsroot=lvm2&r1=1.19&r2=1.20 --- LVM2/WHATS_NEW 2011/04/12 21:59:01 1.1971 +++ LVM2/WHATS_NEW 2011/04/13 18:26:39 1.1972 @@ -1,7 +1,7 @@ Version 2.02.85 - =================================== Add "devices/issue_discards" to lvm.conf. - Issue discards on lvremove if enabled and both storage and kernel have support. + Issue discards on lvremove, lvreduce, etc if enabled and supported. Fix incorrect tests for dm_snprintf() failure. Fix some unmatching sign comparation gcc warnings in the code. Allow lv_extend() to work on zero length intrinsically layered LVs. --- LVM2/doc/example.conf.in 2011/04/12 21:59:01 1.21 +++ LVM2/doc/example.conf.in 2011/04/13 18:26:39 1.22 @@ -152,11 +152,15 @@ # pv_min_size = 2048 pv_min_size = 512 - # Issue discards to an LV's underlying PV(s) when the LV is removed. - # Discards inform the storage that a region is no longer in use. If set + # Issue discards to a logical volumes's underlying physical volume(s) when + # the logical volume is no longer using the physical volumes' space (e.g. + # lvremove, lvreduce, etc). Discards inform the storage that a region is + # no longer in use. Storage that supports discards advertise the protocol + # specific way discards should be issued by the kernel (TRIM, UNMAP, or + # WRITE SAME with UNMAP bit set). Not all storage will support or benefit + # from discards but SSDs and thinly provisioned LUNs generally do. If set # to 1, discards will only be issued if both the storage and kernel provide - # support. Not all storage will support or benefit from discards but SSDs - # or thinly provisioned LUNs generally do. + # support. # 1 enables; 0 disables. issue_discards = 0 } --- LVM2/lib/metadata/pv_manip.c 2011/04/12 22:04:04 1.30 +++ LVM2/lib/metadata/pv_manip.c 2011/04/13 18:26:39 1.31 @@ -191,9 +191,9 @@ int release_pv_segment(struct pv_segment *peg, uint32_t area_reduction) { - uint64_t discard_offset; + uint64_t discard_offset_sectors; uint64_t pe_start = peg->pv->pe_start; - uint32_t discard_area_reduction = area_reduction; + uint64_t discard_area_reduction = area_reduction; if (!peg->lvseg) { log_error("release_pv_segment with unallocated segment: " @@ -209,16 +209,20 @@ "devices/issue_discards", DEFAULT_ISSUE_DISCARDS) && dev_discard_max_bytes(peg->pv->fmt->cmd->sysfs_dir, peg->pv->dev) && dev_discard_granularity(peg->pv->fmt->cmd->sysfs_dir, peg->pv->dev)) { - if (!pe_start) { - /* skip the first extent */ - pe_start = peg->pv->vg->extent_size; + discard_offset_sectors = (peg->pe + peg->lvseg->area_len - area_reduction) * + peg->pv->vg->extent_size + pe_start; + if (!discard_offset_sectors) { + /* + * pe_start=0 and the PV's first extent contains the label. + * Must skip past the first extent. + */ + discard_offset_sectors = peg->pv->vg->extent_size; discard_area_reduction--; } - discard_offset = peg->pe + peg->lvseg->area_len - area_reduction; - discard_offset = (discard_offset * peg->pv->vg->extent_size) + pe_start; - log_debug("Discarding %" PRIu32 " extents offset %" PRIu64 " sectors on %s.", - discard_area_reduction, discard_offset, dev_name(peg->pv->dev)); - if (!dev_discard_blocks(peg->pv->dev, discard_offset << SECTOR_SHIFT, + log_debug("Discarding %" PRIu64 " extents offset %" PRIu64 " sectors on %s.", + discard_area_reduction, discard_offset_sectors, dev_name(peg->pv->dev)); + if (discard_area_reduction && + !dev_discard_blocks(peg->pv->dev, discard_offset_sectors << SECTOR_SHIFT, discard_area_reduction * peg->pv->vg->extent_size * SECTOR_SIZE)) return_0; } --- LVM2/man/lvm.conf.5.in 2011/04/12 21:59:02 1.19 +++ LVM2/man/lvm.conf.5.in 2011/04/13 18:26:39 1.20 @@ -181,11 +181,14 @@ pv_min_size = 2048 .IP \fBissue_discards\fP \(em -Issue discards to an LV's underlying PV(s) when the LV is removed. Discards -inform the storage that a region is no longer in use. If set to 1, discards will -only be issued if both the storage and kernel provide support. Not all storage -will support or benefit from discards but SSDs or thinly provisioned LUNs -generally do. +Issue discards to a logical volumes's underlying physical volume(s) when the +logical volume is no longer using the physical volumes' space (e.g. lvremove, +lvreduce, etc). Discards inform the storage that a region is no longer in use. +Storage that supports discards advertise the protocol specific way discards +should be issued by the kernel (TRIM, UNMAP, or WRITE SAME with UNMAP bit set). +Not all storage will support or benefit from discards but SSDs and thinly +provisioned LUNs generally do. If set to 1, discards will only be issued if +both the storage and kernel provide support. .IP .TP \fBallocation\fP \(em Space allocation policies From mornfall@sourceware.org Tue Apr 19 15:28:00 2011 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Tue, 19 Apr 2011 15:28:00 -0000 Subject: LVM2/test Makefile.in Message-ID: <20110419152817.12327.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-04-19 15:28:17 Modified files: test : Makefile.in Log message: Always copy all tests to builddir regardless of T/S, since subsequent runs (possibly with different T or S) skip that step. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/Makefile.in.diff?cvsroot=lvm2&r1=1.53&r2=1.54 --- LVM2/test/Makefile.in 2011/01/17 15:18:10 1.53 +++ LVM2/test/Makefile.in 2011/04/19 15:28:17 1.54 @@ -29,6 +29,7 @@ T ?= . S ?= @ # never match anything by default VERBOSE ?= 0 +ALL = $(shell find $(srcdir) \( -name t-\*.sh -or -path */api/\*.sh \) | sort) RUN = $(shell find $(srcdir) -regextype posix-egrep \( -name t-\*.sh -or -path */api/\*.sh \) -and -regex "$(srcdir)/.*($(T)).*" -and -not -regex "$(srcdir)/.*($(S)).*" | sort) RUN_BASE = $(shell echo $(RUN) | xargs -n 1 echo | sed -e s,^$(srcdir)/,,) @@ -80,10 +81,10 @@ lib/check lib/aux lib/test lib/utils lib/get lib/lvm-wrapper \ lib/paths -.tests-stamp: $(RUN) $(LIB) +.tests-stamp: $(ALL) $(LIB) @if test "$(srcdir)" != . ; then \ echo "Copying tests to builddir."; \ - for f in $(RUN); do cp $$f `echo $$f | sed -e s,^$(srcdir)/,,`; done; \ + for f in $(ALL); do cp $$f `echo $$f | sed -e s,^$(srcdir)/,,`; done; \ fi touch .tests-stamp From zkabelac@sourceware.org Thu Apr 21 13:13:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Thu, 21 Apr 2011 13:13:00 -0000 Subject: LVM2 ./WHATS_NEW lib/format_text/format-text.c ... Message-ID: <20110421131342.20708.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-21 13:13:41 Modified files: . : WHATS_NEW lib/format_text: format-text.c lib/metadata : metadata.c Added files: test : t-pv-duplicate.sh Log message: Fix use of released vgname and vgid Avoid using of already released memory when duplicated MDA is found. As get_pv_from_vg_by_id() may call lvmcache_label_scan() use the local copy of the vgname and vgid on the stack as vginfo may dissapear and code was then accessing garbage in memory. i.e. pvs /dev/loop0 (when /dev/loop0 and /dev/loop1 has same MDA content) Invalid read of size 1 at 0x523C986: dm_hash_lookup (hash.c:325) by 0x440C8C: vginfo_from_vgname (lvmcache.c:399) by 0x4605C0: _create_vg_text_instance (format-text.c:1882) by 0x46140D: _text_create_text_instance (format-text.c:2243) by 0x47EB49: _vg_read (metadata.c:2887) by 0x47FBD8: vg_read_internal (metadata.c:3231) by 0x477594: get_pv_from_vg_by_id (metadata.c:344) by 0x45F07A: _get_pv_if_in_vg (format-text.c:1400) by 0x45F0B9: _populate_pv_fields (format-text.c:1414) by 0x45F40F: _text_pv_read (format-text.c:1493) by 0x480431: _pv_read (metadata.c:3500) by 0x4802B2: pv_read (metadata.c:3462) Address 0x652ab80 is 0 bytes inside a block of size 4 free'd at 0x4C2756E: free (vg_replace_malloc.c:366) by 0x442277: _free_vginfo (lvmcache.c:963) by 0x44235E: _drop_vginfo (lvmcache.c:992) by 0x442B23: _lvmcache_update_vgname (lvmcache.c:1165) by 0x443449: lvmcache_update_vgname_and_id (lvmcache.c:1358) by 0x443C07: lvmcache_add (lvmcache.c:1492) by 0x46588C: _text_read (text_label.c:271) by 0x466A65: label_read (label.c:289) by 0x4413FC: lvmcache_label_scan (lvmcache.c:635) by 0x4605AD: _create_vg_text_instance (format-text.c:1881) by 0x46140D: _text_create_text_instance (format-text.c:2243) by 0x47EB49: _vg_read (metadata.c:2887) Add testing script Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1972&r2=1.1973 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.178&r2=1.179 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.454&r2=1.455 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pv-duplicate.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1 --- LVM2/WHATS_NEW 2011/04/13 18:26:39 1.1972 +++ LVM2/WHATS_NEW 2011/04/21 13:13:40 1.1973 @@ -1,5 +1,6 @@ Version 2.02.85 - =================================== + Fix use of released memory when duplicate PV is found. Add "devices/issue_discards" to lvm.conf. Issue discards on lvremove, lvreduce, etc if enabled and supported. Fix incorrect tests for dm_snprintf() failure. --- LVM2/lib/format_text/format-text.c 2011/03/11 15:10:17 1.178 +++ LVM2/lib/format_text/format-text.c 2011/04/21 13:13:40 1.179 @@ -1395,11 +1395,23 @@ static int _get_pv_if_in_vg(struct lvmcache_info *info, struct physical_volume *pv) { + char vgname[NAME_LEN + 1]; + char vgid[ID_LEN + 1]; + if (info->vginfo && info->vginfo->vgname && - !is_orphan_vg(info->vginfo->vgname) && - get_pv_from_vg_by_id(info->fmt, info->vginfo->vgname, - info->vginfo->vgid, info->dev->pvid, pv)) - return 1; + !is_orphan_vg(info->vginfo->vgname)) { + /* + * get_pv_from_vg_by_id() may call + * lvmcache_label_scan() and drop cached + * vginfo so make a local copy of string. + */ + strcpy(vgname, info->vginfo->vgname); + memcpy(vgid, info->vginfo->vgid, sizeof(vgid)); + + if (get_pv_from_vg_by_id(info->fmt, vgname, vgid, + info->dev->pvid, pv)) + return 1; + } return 0; } --- LVM2/lib/metadata/metadata.c 2011/04/08 14:40:20 1.454 +++ LVM2/lib/metadata/metadata.c 2011/04/21 13:13:40 1.455 @@ -2771,6 +2771,9 @@ * If precommitted is set, use precommitted metadata if present. * * Either of vgname or vgid may be NULL. + * + * Note: vginfo structs must not be held or used as parameters + * across the call to this function. */ static struct volume_group *_vg_read(struct cmd_context *cmd, const char *vgname, /cvs/lvm2/LVM2/test/t-pv-duplicate.sh,v --> standard output revision 1.1 --- LVM2/test/t-pv-duplicate.sh +++ - 2011-04-21 13:13:42.016714000 +0000 @@ -0,0 +1,25 @@ +#!/bin/sh +# Copyright (C) 2011 Red Hat, Inc. All rights reserved. +# +# 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 + +# 'Exercise duplicate metadata diagnostics' + +. lib/test + +aux prepare_devs 3 + +vgcreate -c n --metadatasize 128k $vg1 $dev1 + +# copy mda +dd if=$dev1 of=$dev2 bs=256K count=1 +dd if=$dev1 of=$dev3 bs=256K count=1 + +pvs $dev1 +vgs $vg1 From zkabelac@sourceware.org Thu Apr 21 13:15:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Thu, 21 Apr 2011 13:15:00 -0000 Subject: LVM2/lib/cache lvmcache.c Message-ID: <20110421131526.21574.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-21 13:15:26 Modified files: lib/cache : lvmcache.c Log message: Skip check for NULL before dm_free dm_free makes this test itself. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.109&r2=1.110 --- LVM2/lib/cache/lvmcache.c 2011/03/30 13:14:34 1.109 +++ LVM2/lib/cache/lvmcache.c 2011/04/21 13:15:26 1.110 @@ -857,11 +857,8 @@ } while ((vginfo2 = vginfo2->next)); - if (vginfo->vgname) - dm_free(vginfo->vgname); - - if (vginfo->creation_host) - dm_free(vginfo->creation_host); + dm_free(vginfo->vgname); + dm_free(vginfo->creation_host); if (*vginfo->vgid && _vgid_hash && vginfo_from_vgid(vginfo->vgid) == vginfo) From wysochanski@sourceware.org Thu Apr 21 17:03:00 2011 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 21 Apr 2011 17:03:00 -0000 Subject: LVM2 ./WHATS_NEW test/t-vgimportclone.sh Message-ID: <20110421170339.31530.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2011-04-21 17:03:39 Modified files: . : WHATS_NEW Added files: test : t-vgimportclone.sh Log message: Add nightly test for vgimportclone and querying of vgnames with duplicate pvs. Related to rhbz 697959. This test fails prior to these two commits: commit af112eb2c9a62c5d794df920218bd3ee291d5b25 Author: Zdenek Kabelac Date: Thu Apr 21 13:15:26 2011 +0000 Skip check for NULL before dm_free dm_free makes this test itself. commit 91419c3e86bf9666aab2aa631faae1ba73e8d745 Author: Zdenek Kabelac Date: Thu Apr 21 13:13:40 2011 +0000 Fix use of released vgname and vgid Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgimportclone.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1973&r2=1.1974 /cvs/lvm2/LVM2/test/t-vgimportclone.sh,v --> standard output revision 1.1 --- LVM2/test/t-vgimportclone.sh +++ - 2011-04-21 17:03:39.444919000 +0000 @@ -0,0 +1,35 @@ +# Copyright (C) 2010 Red Hat, Inc. All rights reserved. +# +# 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 + +. lib/test + +aux prepare_devs 2 + +pvcreate $dev1 $dev2 +vgcreate $vg1 $dev1 +lvcreate -l100%FREE -n $lv1 $vg1 + +# Clone the LUN +dd if=$dev1 of=$dev2 + +# Verify pvs works on each device to give us vgname +pvs --noheadings -o vg_name $dev1 1>err +grep $vg1 err +pvs --noheadings -o vg_name $dev2 1>err +grep $vg1 err + +# Import the cloned PV to a new VG +vgimportclone --basevgname $vg2 $dev2 + +# Verify we can activate / deactivate the LV from both VGs +lvchange -ay $vg1/$lv1 +lvchange -ay $vg2/$lv1 +vgchange -an $vg1 +vgchange -an $vg2 --- LVM2/WHATS_NEW 2011/04/21 13:13:40 1.1973 +++ LVM2/WHATS_NEW 2011/04/21 17:03:38 1.1974 @@ -1,5 +1,6 @@ Version 2.02.85 - =================================== + Add nightly test for vgimportclone and querying of vgnames with duplicate pvs. Fix use of released memory when duplicate PV is found. Add "devices/issue_discards" to lvm.conf. Issue discards on lvremove, lvreduce, etc if enabled and supported. From wysochanski@sourceware.org Thu Apr 21 17:42:00 2011 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 21 Apr 2011 17:42:00 -0000 Subject: LVM2/test Makefile.in Message-ID: <20110421174259.3152.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2011-04-21 17:42:58 Modified files: test : Makefile.in Log message: Add vgimportclone symlink for nightly test. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/Makefile.in.diff?cvsroot=lvm2&r1=1.54&r2=1.55 --- LVM2/test/Makefile.in 2011/04/19 15:28:17 1.54 +++ LVM2/test/Makefile.in 2011/04/21 17:42:58 1.55 @@ -99,6 +99,7 @@ ln -s "$(abs_top_builddir)/tools/dmsetup" lib/dmsetup ln -s "$(abs_top_builddir)/daemons/clvmd/clvmd" lib/clvmd ln -s "$(abs_top_builddir)/daemons/dmeventd/dmeventd" lib/dmeventd + ln -s "$(abs_top_builddir)/scripts/vgimportclone.sh" lib/vgimportclone touch $@ clean: From wysochanski@sourceware.org Thu Apr 21 19:06:00 2011 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 21 Apr 2011 19:06:00 -0000 Subject: LVM2/test t-vgimportclone.sh Message-ID: <20110421190601.12970.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2011-04-21 19:06:00 Modified files: test : t-vgimportclone.sh Log message: Disable nightly test for vgimportclone until proper fix is made. This fails on lenny buildslave for some reason. For now disable the vgimportclone part of the test until proper fix. Let the first part of the test still run though, which shows pvs working with duplicate pvs. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgimportclone.sh.diff?cvsroot=lvm2&r1=1.1&r2=1.2 --- LVM2/test/t-vgimportclone.sh 2011/04/21 17:03:38 1.1 +++ LVM2/test/t-vgimportclone.sh 2011/04/21 19:06:00 1.2 @@ -26,10 +26,11 @@ grep $vg1 err # Import the cloned PV to a new VG -vgimportclone --basevgname $vg2 $dev2 +# FIXME: this fails on lenny buildslave, I think we need proper wrapper +# vgimportclone --basevgname $vg2 $dev2 # Verify we can activate / deactivate the LV from both VGs -lvchange -ay $vg1/$lv1 -lvchange -ay $vg2/$lv1 -vgchange -an $vg1 -vgchange -an $vg2 +# lvchange -ay $vg1/$lv1 +# lvchange -ay $vg2/$lv1 +# vgchange -an $vg1 +# vgchange -an $vg2 From prajnoha@sourceware.org Fri Apr 22 11:56:00 2011 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 22 Apr 2011 11:56:00 -0000 Subject: LVM2 ./WHATS_NEW_DM ./configure.in libdm/libdm ... Message-ID: <20110422115642.17063.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2011-04-22 11:56:41 Modified files: . : WHATS_NEW_DM configure.in libdm : libdm-common.c tools : dmsetup.c lvmcmdline.c Log message: Require libudev >= 143 when compiling with udev support. Old versions of libudev < 143 were experimental and unstable. Require recent and stable versions only (version 143 is old enough anyway). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.461&r2=1.462 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.160&r2=1.161 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.116&r2=1.117 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.159&r2=1.160 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.138&r2=1.139 --- LVM2/WHATS_NEW_DM 2011/03/30 12:57:03 1.461 +++ LVM2/WHATS_NEW_DM 2011/04/22 11:56:41 1.462 @@ -1,5 +1,6 @@ Version 1.02.64 - =================================== + Require libudev >= 143 when compiling with udev support. Use word alignment for dm_pool_strdup() and dm_pool_strndup(). Use dm_snprintf() to fix signess warning in dm_set_dev_dir(). Use unsigned loop counter to fix signess warning in _other_node_ops(). --- LVM2/configure.in 2011/02/04 22:17:54 1.160 +++ LVM2/configure.in 2011/04/22 11:56:41 1.161 @@ -803,9 +803,7 @@ AC_MSG_RESULT($UDEV_SYNC) if test x$UDEV_SYNC = xyes; then - AC_CHECK_LIB(udev, udev_queue_get_udev_is_active, - [UDEV_PC="libudev"; UDEV_LIBS="-ludev"], - [AC_MSG_ERROR([bailing out... libudev library is required])]) + PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"]) AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.]) fi --- LVM2/libdm/libdm-common.c 2011/03/30 12:14:36 1.116 +++ LVM2/libdm/libdm-common.c 2011/04/22 11:56:41 1.117 @@ -29,7 +29,6 @@ # include # include # include -# define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE # include #endif --- LVM2/tools/dmsetup.c 2011/04/08 14:40:21 1.159 +++ LVM2/tools/dmsetup.c 2011/04/22 11:56:41 1.160 @@ -45,7 +45,6 @@ # include # include # include -# define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE # include #endif --- LVM2/tools/lvmcmdline.c 2011/04/08 14:40:21 1.138 +++ LVM2/tools/lvmcmdline.c 2011/04/22 11:56:41 1.139 @@ -43,7 +43,6 @@ #endif #ifdef UDEV_SYNC_SUPPORT -# define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE # include #endif From prajnoha@sourceware.org Fri Apr 22 12:00:00 2011 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 22 Apr 2011 12:00:00 -0000 Subject: LVM2 ./make.tmpl.in lib/misc/lvm-wrappers.c li ... Message-ID: <20110422120000.18331.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2011-04-22 12:00:00 Modified files: . : make.tmpl.in lib/misc : lvm-wrappers.c lvm-wrappers.h Log message: Move common libudev code to lvm-wrappers.[ch]. ...so we can use it throughout. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/make.tmpl.in.diff?cvsroot=lvm2&r1=1.116&r2=1.117 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-wrappers.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-wrappers.h.diff?cvsroot=lvm2&r1=1.4&r2=1.5 --- LVM2/make.tmpl.in 2011/02/18 23:09:55 1.116 +++ LVM2/make.tmpl.in 2011/04/22 11:59:59 1.117 @@ -38,7 +38,7 @@ LDDEPS += @LDDEPS@ LDFLAGS += @LDFLAGS@ LIB_SUFFIX = @LIB_SUFFIX@ -LVMINTERNAL_LIBS = -llvm-internal $(DL_LIBS) +LVMINTERNAL_LIBS = -llvm-internal $(UDEV_LIBS) $(DL_LIBS) DL_LIBS = @DL_LIBS@ PTHREAD_LIBS = @PTHREAD_LIBS@ READLINE_LIBS = @READLINE_LIBS@ --- LVM2/lib/misc/lvm-wrappers.c 2008/12/07 04:23:37 1.3 +++ LVM2/lib/misc/lvm-wrappers.c 2011/04/22 12:00:00 1.4 @@ -17,6 +17,91 @@ #include #include +#ifdef UDEV_SYNC_SUPPORT +static const char _no_context_msg[] = "Udev library context not set."; +struct udev *_udev; + +int udev_init_library_context(void) +{ + if (_udev) + udev_unref(_udev); + + if (!(_udev = udev_new())) { + log_error("Failed to create udev library context."); + return 0; + } + + return 1; +} + +void udev_fin_library_context(void) +{ + udev_unref(_udev); + _udev = NULL; +} + +int udev_is_running(void) +{ + struct udev_queue *udev_queue; + int r; + + if (!_udev) { + log_debug(_no_context_msg); + goto bad; + } + + if (!(udev_queue = udev_queue_new(_udev))) { + log_debug("Could not get udev state."); + goto bad; + } + + r = udev_queue_get_udev_is_active(udev_queue); + udev_queue_unref(udev_queue); + + return r; + +bad: + log_debug("Assuming udev is not running."); + return 0; +} + +const char *udev_get_dev_dir(void) +{ + if (!_udev) { + log_debug(_no_context_msg); + return NULL; + } + + return udev_get_dev_path(_udev); +} + +struct udev* udev_get_library_context(void) +{ + return _udev; +} + +#else /* UDEV_SYNC_SUPPORT */ + +int udev_init_library_context(void) +{ + return 1; +} + +void udev_fin_library_context(void) +{ +} + +int udev_is_running(void) +{ + return 0; +} + +const char *udev_get_dev_dir(void) +{ + return NULL; +} +#endif + int lvm_getpagesize(void) { return getpagesize(); --- LVM2/lib/misc/lvm-wrappers.h 2009/09/28 21:23:02 1.4 +++ LVM2/lib/misc/lvm-wrappers.h 2011/04/22 12:00:00 1.5 @@ -16,6 +16,16 @@ #ifndef _LVM_WRAPPERS_H #define _LVM_WRAPPERS_H +#ifdef UDEV_SYNC_SUPPORT +#include +struct udev *udev_get_library_context(void); +#endif + +int udev_init_library_context(void); +void udev_fin_library_context(void); +int udev_is_running(void); +const char *udev_get_dev_dir(void); + int lvm_getpagesize(void); /* From prajnoha@sourceware.org Fri Apr 22 12:05:00 2011 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 22 Apr 2011 12:05:00 -0000 Subject: LVM2 ./WHATS_NEW doc/example.conf.in lib/comma ... Message-ID: <20110422120535.19597.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2011-04-22 12:05:33 Modified files: . : WHATS_NEW doc : example.conf.in lib/commands : toolcontext.c lib/config : defaults.h lib/device : dev-cache.c dev-cache.h lib/filters : filter-persistent.c lib/misc : lvm-globals.c lvm-globals.h tools : lvmcmdline.c Log message: Obtain device list from udev by default if LVM2 is compiled with udev support. Also, add a new 'obtain_device_list_from_udev' setting to lvm.conf with which we can turn this feature on or off if needed. If set, the cache of block device nodes with all associated symlinks will be constructed out of the existing udev database content. This avoids using and opening any inapplicable non-block devices or subdirectories found in the device directory. This setting is applied to udev-managed device directory only, other directories will be scanned fully. LVM2 needs to be compiled with udev support for this setting to take effect. N.B. Any device node or symlink not managed by udev in udev directory will be ignored with this setting on. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1974&r2=1.1975 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.22&r2=1.23 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.115&r2=1.116 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.73&r2=1.74 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.c.diff?cvsroot=lvm2&r1=1.63&r2=1.64 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.h.diff?cvsroot=lvm2&r1=1.13&r2=1.14 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter-persistent.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-globals.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-globals.h.diff?cvsroot=lvm2&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.139&r2=1.140 --- LVM2/WHATS_NEW 2011/04/21 17:03:38 1.1974 +++ LVM2/WHATS_NEW 2011/04/22 12:05:32 1.1975 @@ -1,5 +1,7 @@ Version 2.02.85 - =================================== + Add new obtain_device_list_from_udev setting to lvm.conf. + Obtain device list from udev by default if LVM2 is compiled with udev support. Add nightly test for vgimportclone and querying of vgnames with duplicate pvs. Fix use of released memory when duplicate PV is found. Add "devices/issue_discards" to lvm.conf. --- LVM2/doc/example.conf.in 2011/04/13 18:26:39 1.22 +++ LVM2/doc/example.conf.in 2011/04/22 12:05:32 1.23 @@ -19,6 +19,16 @@ # to use with LVM2. scan = [ "/dev" ] + # If set, the cache of block device nodes with all associated symlinks + # will be constructed out of the existing udev database content. + # This avoids using and opening any inapplicable non-block devices or + # subdirectories found in the device directory. This setting is applied + # to udev-managed device directory only, other directories will be scanned + # fully. LVM2 needs to be compiled with udev support for this setting to + # take effect. N.B. Any device node or symlink not managed by udev in + # udev directory will be ignored with this setting on. + # obtain_device_list_from_udev = 1 + # If several entries in the scanned directories correspond to the # same block device and the tools need to display a name for device, # all the pathnames are matched against each item in the following --- LVM2/lib/commands/toolcontext.c 2011/02/18 14:11:22 1.115 +++ LVM2/lib/commands/toolcontext.c 2011/04/22 12:05:32 1.116 @@ -573,6 +573,9 @@ { const struct config_node *cn; const struct config_value *cv; + size_t udev_dir_len, len; + int device_list_from_udev; + const char *udev_dir; init_dev_disable_after_error_count( find_config_tree_int(cmd, "devices/disable_after_error_count", @@ -581,6 +584,14 @@ if (!dev_cache_init(cmd)) return_0; + if ((device_list_from_udev = udev_is_running() ? + find_config_tree_bool(cmd, "devices/obtain_device_list_from_udev", + DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0)) { + udev_dir = udev_get_dev_dir(); + udev_dir_len = strlen(udev_dir); + } + init_obtain_device_list_from_udev(device_list_from_udev); + if (!(cn = find_config_tree_node(cmd, "devices/scan"))) { if (!dev_cache_add_dir("/dev")) { log_error("Failed to add /dev to internal " @@ -599,6 +610,16 @@ return 0; } + if (device_list_from_udev) { + len = strlen(cv->v.str); + len = udev_dir_len > len ? len : udev_dir_len; + if (strncmp(udev_dir, cv->v.str, len) || + udev_dir[len] != cv->v.str[len]) { + device_list_from_udev = 0; + init_obtain_device_list_from_udev(0); + } + } + if (!dev_cache_add_dir(cv->v.str)) { log_error("Failed to add %s to internal device cache", cv->v.str); --- LVM2/lib/config/defaults.h 2011/04/12 21:59:01 1.73 +++ LVM2/lib/config/defaults.h 2011/04/22 12:05:32 1.74 @@ -29,6 +29,7 @@ #define DEFAULT_DEV_DIR "/dev" #define DEFAULT_PROC_DIR "/proc" +#define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 1 #define DEFAULT_SYSFS_SCAN 1 #define DEFAULT_MD_COMPONENT_DETECTION 1 #define DEFAULT_MD_CHUNK_ALIGNMENT 1 --- LVM2/lib/device/dev-cache.c 2011/01/17 15:16:55 1.63 +++ LVM2/lib/device/dev-cache.c 2011/04/22 12:05:33 1.64 @@ -52,7 +52,7 @@ #define _free(x) dm_pool_free(_cache.mem, (x)) #define _strdup(x) dm_pool_strdup(_cache.mem, (x)) -static int _insert(const char *path, int rec); +static int _insert(const char *path, int rec, int check_with_udev_db); struct device *dev_create_file(const char *filename, struct device *dev, struct str_list *alias, int use_malloc) @@ -319,8 +319,7 @@ } } - if (!(sl->str = dm_pool_strdup(_cache.mem, path))) - return_0; + sl->str = path; if (!dm_list_empty(&dev->aliases)) { oldpath = dm_list_item(dev->aliases.n, struct str_list)->str; @@ -348,6 +347,7 @@ struct device *dev; static dev_t loopfile_count = 0; int loopfile = 0; + char *path_copy; /* Generate pretend device numbers for loopfiles */ if (!d) { @@ -374,12 +374,17 @@ } } - if (!loopfile && !_add_alias(dev, path)) { + if (!(path_copy = dm_pool_strdup(_cache.mem, path))) { + log_error("Failed to duplicate path string."); + return 0; + } + + if (!loopfile && !_add_alias(dev, path_copy)) { log_error("Couldn't add alias to dev cache."); return 0; } - if (!dm_hash_insert(_cache.names, path, dev)) { + if (!dm_hash_insert(_cache.names, path_copy, dev)) { log_error("Couldn't add name to hash in dev cache."); return 0; } @@ -437,7 +442,7 @@ return_0; _collapse_slashes(path); - r &= _insert(path, 1); + r &= _insert(path, 1, 0); dm_free(path); free(dirent[n]); @@ -468,7 +473,102 @@ return 1; } -static int _insert(const char *path, int rec) +#ifdef UDEV_SYNC_SUPPORT + +static int _device_in_udev_db(const dev_t d) +{ + struct udev *udev; + struct udev_device *udev_device; + + if (!(udev = udev_get_library_context())) + return_0; + + if ((udev_device = udev_device_new_from_devnum(udev, 'b', d))) { + udev_device_unref(udev_device); + return 1; + } + + return 0; +} + +static int _insert_udev_dir(struct udev *udev, const char *dir) +{ + struct udev_enumerate *udev_enum = NULL; + struct udev_list_entry *device_entry, *symlink_entry; + const char *node_name, *symlink_name; + struct udev_device *device; + int r = 1; + + if (!(udev_enum = udev_enumerate_new(udev))) + goto bad; + + if (udev_enumerate_add_match_subsystem(udev_enum, "block") || + udev_enumerate_scan_devices(udev_enum)) + goto bad; + + udev_list_entry_foreach(device_entry, udev_enumerate_get_list_entry(udev_enum)) { + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(device_entry)); + + node_name = udev_device_get_devnode(device); + r &= _insert(node_name, 0, 0); + + udev_list_entry_foreach(symlink_entry, udev_device_get_devlinks_list_entry(device)) { + symlink_name = udev_list_entry_get_name(symlink_entry); + r &= _insert(symlink_name, 0, 0); + } + + udev_device_unref(device); + } + + udev_enumerate_unref(udev_enum); + return r; + +bad: + log_error("Failed to enumerate udev device list."); + udev_enumerate_unref(udev_enum); + return 0; +} + +static void _insert_dirs(struct dm_list *dirs) +{ + struct dir_list *dl; + struct udev *udev; + int with_udev; + + with_udev = obtain_device_list_from_udev() && + (udev = udev_get_library_context()); + + dm_list_iterate_items(dl, &_cache.dirs) { + if (with_udev) { + if (!_insert_udev_dir(udev, dl->dir)) + log_debug("%s: Failed to insert devices from " + "udev-managed directory to device " + "cache fully", dl->dir); + } + else if (!_insert_dir(dl->dir)) + log_debug("%s: Failed to insert devices to" + "device cache fully", dl->dir); + } +} + +#else /* UDEV_SYNC_SUPPORT */ + +static int _device_in_udev_db(const dev_t d) +{ + return 0; +} + +static void _insert_dirs(struct dm_list *dirs) +{ + struct dir_list *dl; + + dm_list_iterate_items(dl, &_cache.dirs) + _insert_dir(dl->dir); +} + +#endif /* UDEV_SYNC_SUPPORT */ + +static int _insert(const char *path, int rec, int check_with_udev_db) { struct stat info; int r = 0; @@ -478,6 +578,11 @@ return 0; } + if (check_with_udev_db && !_device_in_udev_db(info.st_rdev)) { + log_very_verbose("%s: Not in udev db", path); + return 0; + } + if (S_ISDIR(info.st_mode)) { /* add a directory */ /* check it's not a symbolic link */ if (lstat(path, &info) < 0) { @@ -515,8 +620,7 @@ if (_cache.has_scanned && !dev_scan) return; - dm_list_iterate_items(dl, &_cache.dirs) - _insert_dir(dl->dir); + _insert_dirs(&_cache.dirs); dm_list_iterate_items(dl, &_cache.files) _insert_file(dl->dir); @@ -760,7 +864,7 @@ if (dm_list_size(&dev->aliases) > 1) { dm_list_del(dev->aliases.n); if (!r) - _insert(name, 0); + _insert(name, 0, obtain_device_list_from_udev()); continue; } @@ -788,7 +892,7 @@ } if (!d) { - _insert(name, 0); + _insert(name, 0, obtain_device_list_from_udev()); d = (struct device *) dm_hash_lookup(_cache.names, name); if (!d) { _full_scan(0); --- LVM2/lib/device/dev-cache.h 2010/10/13 15:40:39 1.13 +++ LVM2/lib/device/dev-cache.h 2011/04/22 12:05:33 1.14 @@ -17,6 +17,7 @@ #define _LVM_DEV_CACHE_H #include "device.h" +#include "lvm-wrappers.h" /* * predicate for devices. --- LVM2/lib/filters/filter-persistent.c 2011/01/06 15:29:24 1.48 +++ LVM2/lib/filters/filter-persistent.c 2011/04/22 12:05:33 1.49 @@ -103,6 +103,17 @@ struct stat info; int r = 0; + if (obtain_device_list_from_udev()) { + if (!stat(pf->file, &info)) { + log_very_verbose("Obtaining device list from " + "udev. Removing obolete %s.", + pf->file); + if (unlink(pf->file) < 0) + log_sys_error("unlink", pf->file); + } + return 1; + } + if (!stat(pf->file, &info)) pf->ctime = info.st_ctime; else { @@ -180,6 +191,9 @@ int lockfd; int r = 0; + if (obtain_device_list_from_udev()) + return 1; + if (!f) return_0; pf = (struct pfilter *) f->private; --- LVM2/lib/misc/lvm-globals.c 2011/03/29 20:30:08 1.10 +++ LVM2/lib/misc/lvm-globals.c 2011/04/22 12:05:33 1.11 @@ -28,6 +28,7 @@ static int _md_filtering = 0; static int _pvmove = 0; static int _full_scan_done = 0; /* Restrict to one full scan during each cmd */ +static int _obtain_device_list_from_udev = DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV; static int _trust_cache = 0; /* Don't scan when incomplete VGs encountered */ static int _debug_level = 0; static int _log_cmd_name = 0; @@ -72,6 +73,11 @@ _full_scan_done = level; } +void init_obtain_device_list_from_udev(int device_list_from_udev) +{ + _obtain_device_list_from_udev = device_list_from_udev; +} + void init_trust_cache(int trustcache) { _trust_cache = trustcache; @@ -185,6 +191,11 @@ return _full_scan_done; } +int obtain_device_list_from_udev() +{ + return _obtain_device_list_from_udev; +} + int trust_cache(void) { return _trust_cache; --- LVM2/lib/misc/lvm-globals.h 2011/02/18 14:11:23 1.9 +++ LVM2/lib/misc/lvm-globals.h 2011/04/22 12:05:33 1.10 @@ -25,6 +25,7 @@ void init_md_filtering(int level); void init_pvmove(int level); void init_full_scan_done(int level); +void init_obtain_device_list_from_udev(int device_list_from_udev); void init_trust_cache(int trustcache); void init_debug(int level); void init_cmd_name(int status); @@ -48,6 +49,7 @@ int md_filtering(void); int pvmove_mode(void); int full_scan_done(void); +int obtain_device_list_from_udev(void); int trust_cache(void); int verbose_level(void); int debug_level(void); --- LVM2/tools/lvmcmdline.c 2011/04/22 11:56:41 1.139 +++ LVM2/tools/lvmcmdline.c 2011/04/22 12:05:33 1.140 @@ -1282,6 +1282,9 @@ { struct cmd_context *cmd; + if (!udev_init_library_context()) + stack; + if (!(cmd = create_toolcontext(0, NULL))) return_NULL; @@ -1313,6 +1316,7 @@ { _fin_commands(); destroy_toolcontext(cmd); + udev_fin_library_context(); } static int _run_script(struct cmd_context *cmd, int argc, char **argv) From prajnoha@sourceware.org Fri Apr 22 12:07:00 2011 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 22 Apr 2011 12:07:00 -0000 Subject: LVM2/tools lvmcmdline.c Message-ID: <20110422120736.20261.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2011-04-22 12:07:36 Modified files: tools : lvmcmdline.c Log message: Use common udev_get_dev_dir() to get current device directory managed by udev. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.140&r2=1.141 --- LVM2/tools/lvmcmdline.c 2011/04/22 12:05:33 1.140 +++ LVM2/tools/lvmcmdline.c 2011/04/22 12:07:35 1.141 @@ -955,13 +955,11 @@ static int _set_udev_checking(struct cmd_context *cmd) { #ifdef UDEV_SYNC_SUPPORT - struct udev *udev; const char *udev_dev_dir; size_t udev_dev_dir_len; int dirs_diff; - if (!(udev = udev_new()) || - !(udev_dev_dir = udev_get_dev_path(udev)) || + if (!(udev_dev_dir = udev_get_dev_dir()) || !*udev_dev_dir) { log_error("Could not get udev dev path."); return 0; @@ -988,7 +986,6 @@ init_udev_checking(0); } - udev_unref(udev); #endif return 1; } From prajnoha@sourceware.org Fri Apr 22 12:13:00 2011 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 22 Apr 2011 12:13:00 -0000 Subject: LVM2 configure Message-ID: <20110422121306.22146.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2011-04-22 12:13:06 Modified files: . : configure Log message: autoreconf Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.diff?cvsroot=lvm2&r1=1.146&r2=1.147 --- LVM2/configure 2011/02/04 22:17:54 1.146 +++ LVM2/configure 2011/04/22 12:13:05 1.147 @@ -607,7 +607,6 @@ UDEV_SYNC UDEV_RULES UDEV_PC -UDEV_LIBS TESTING STATIC_LINK STATICDIR @@ -675,6 +674,8 @@ MSGFMT LVM2CMD_LIB LVM2APP_LIB +UDEV_LIBS +UDEV_CFLAGS VALGRIND RUBY19 GENPNG @@ -875,7 +876,9 @@ DLM_CFLAGS DLM_LIBS SACKPT_CFLAGS -SACKPT_LIBS' +SACKPT_LIBS +UDEV_CFLAGS +UDEV_LIBS' # Initialize some variables set by options. @@ -1628,6 +1631,8 @@ SACKPT_CFLAGS C compiler flags for SACKPT, overriding pkg-config SACKPT_LIBS linker flags for SACKPT, overriding pkg-config + UDEV_CFLAGS C compiler flags for UDEV, overriding pkg-config + UDEV_LIBS linker flags for UDEV, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -8762,48 +8767,97 @@ $as_echo "$UDEV_SYNC" >&6; } if test x$UDEV_SYNC = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for udev_queue_get_udev_is_active in -ludev" >&5 -$as_echo_n "checking for udev_queue_get_udev_is_active in -ludev... " >&6; } -if test "${ac_cv_lib_udev_udev_queue_get_udev_is_active+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ludev $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char udev_queue_get_udev_is_active (); -int -main () -{ -return udev_queue_get_udev_is_active (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_udev_udev_queue_get_udev_is_active=yes +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UDEV" >&5 +$as_echo_n "checking for UDEV... " >&6; } + +if test -n "$UDEV_CFLAGS"; then + pkg_cv_UDEV_CFLAGS="$UDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev >= 143\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libudev >= 143") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_UDEV_CFLAGS=`$PKG_CONFIG --cflags "libudev >= 143" 2>/dev/null` else - ac_cv_lib_udev_udev_queue_get_udev_is_active=no + pkg_failed=yes fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + else + pkg_failed=untried fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_udev_udev_queue_get_udev_is_active" >&5 -$as_echo "$ac_cv_lib_udev_udev_queue_get_udev_is_active" >&6; } -if test "x$ac_cv_lib_udev_udev_queue_get_udev_is_active" = x""yes; then : - UDEV_PC="libudev"; UDEV_LIBS="-ludev" +if test -n "$UDEV_LIBS"; then + pkg_cv_UDEV_LIBS="$UDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev >= 143\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libudev >= 143") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_UDEV_LIBS=`$PKG_CONFIG --libs "libudev >= 143" 2>/dev/null` else - as_fn_error $? "bailing out... libudev library is required" "$LINENO" 5 + pkg_failed=yes fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + UDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libudev >= 143" 2>&1` + else + UDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors "libudev >= 143" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$UDEV_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libudev >= 143) were not met: + +$UDEV_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables UDEV_CFLAGS +and UDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables UDEV_CFLAGS +and UDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } + +else + UDEV_CFLAGS=$pkg_cv_UDEV_CFLAGS + UDEV_LIBS=$pkg_cv_UDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + UDEV_PC="libudev" +fi $as_echo "#define UDEV_SYNC_SUPPORT 1" >>confdefs.h From prajnoha@sourceware.org Tue Apr 26 09:09:00 2011 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Tue, 26 Apr 2011 09:09:00 -0000 Subject: LVM2/doc example.conf.in Message-ID: <20110426090925.29816.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2011-04-26 09:09:24 Modified files: doc : example.conf.in Log message: Uncomment obtain_device_list_from_udev setting in lvm.conf. Just for consistency with other settings we already have in lvm.conf. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.23&r2=1.24 --- LVM2/doc/example.conf.in 2011/04/22 12:05:32 1.23 +++ LVM2/doc/example.conf.in 2011/04/26 09:09:24 1.24 @@ -27,7 +27,7 @@ # fully. LVM2 needs to be compiled with udev support for this setting to # take effect. N.B. Any device node or symlink not managed by udev in # udev directory will be ignored with this setting on. - # obtain_device_list_from_udev = 1 + obtain_device_list_from_udev = 1 # If several entries in the scanned directories correspond to the # same block device and the tools need to display a name for device, From agk@sourceware.org Thu Apr 28 16:22:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 28 Apr 2011 16:22:00 -0000 Subject: LVM2/man pvmove.8.in Message-ID: <20110428162248.4318.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-28 16:22:48 Modified files: man : pvmove.8.in Log message: Adjust pvmove man page wording. Add missing --alloc anywhere to example and mention that snapshots and mirrors can't be moved. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/pvmove.8.in.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/man/pvmove.8.in 2011/02/09 22:24:55 1.5 +++ LVM2/man/pvmove.8.in 2011/04/28 16:22:47 1.6 @@ -21,7 +21,7 @@ .IR DestinationPhysicalVolume (s). If no .I DestinationPhysicalVolume -is specified, the normal allocation rules for the volume group are used. +is specified, the normal allocation rules for the Volume Group are used. If \fBpvmove\fP gets interrupted for any reason (e.g. the machine crashes) then run \fBpvmove\fP again without any PhysicalVolume arguments to @@ -31,15 +31,15 @@ You can run more than one pvmove at once provided they are moving data off different SourcePhysicalVolumes, but additional pvmoves will ignore -any logical volumes already in the process of being changed, so some +any Logical Volumes already in the process of being changed, so some data might not get moved. \fBpvmove\fP works as follows: -1. A temporary 'pvmove' logical volume is created to store +1. A temporary 'pvmove' Logical Volume is created to store details of all the data movements required. -2. Every logical volume in the volume group is searched +2. Every Logical Volume in the Volume Group is searched for contiguous data that need moving according to the command line arguments. For each piece of data found, a new segment is added to the end of the @@ -49,25 +49,27 @@ The original LV is updated to use the new temporary mirror segment in the pvmove LV instead of accessing the data directly. -3. The volume group metadata is updated on disk. +3. The Volume Group metadata is updated on disk. -4. The first segment of the pvmove logical volume is activated and starts +4. The first segment of the pvmove Logical Volume is activated and starts to mirror the first part of the data. Only one segment is mirrored at once as this is usually more efficient. 5. A daemon repeatedly checks progress at the specified time interval. When it detects that the first temporary mirror is in-sync, it breaks that mirror so that only the new location for that data gets used -and writes a checkpoint into the volume group metadata on disk. +and writes a checkpoint into the Volume Group metadata on disk. Then it activates the mirror for the next segment of the pvmove LV. 6. When there are no more segments left to be mirrored, -the temporary logical volume is removed and the volume group metadata -is updated so that the logical volumes reflect the new data locations. +the temporary Logical Volume is removed and the Volume Group metadata +is updated so that the Logical Volumes reflect the new data locations. Note that this new process cannot support the original LVM1 type of on-disk metadata. Metadata can be converted using \fBvgconvert\fP(8). +N.B. The moving of mirrors, snapshots and their origins is not yet supported. + .SH OPTIONS .TP .I \-\-abort @@ -94,38 +96,54 @@ instead of all allocated extents to the destination physical volume(s). .SH EXAMPLES -To move all logical extents of any logical volumes on +To move all Physical Extents that are used by simple Logical Volumes on .B /dev/sdb1 -to free physical extents elsewhere in the volume group, use: +to free Physical Extents elsewhere in the Volume Group use: .sp \ pvmove /dev/sdb1 .P -Additionally, the destination device can be specified. +Any mirrors, snapshots and their origins are left unchanged. +.P +Additionally, a specific destination device +.B /dev/sdc1 +can be specified like this: .sp \ pvmove /dev/sdb1 /dev/sdc1 .P -It is possible to perform the action on a single logical volume (instead of all -the logical volumes that might be on the source device), like this: +To perform the action only on extents belonging to the single Logical Volume +.B lvol1 +do this: .sp \ pvmove -n lvol1 /dev/sdb1 /dev/sdc1 .P Rather than moving the contents of the entire device, it is possible to -move a range of extents. +move a range of Physical Extents - for example numbers 1000 to 1999 inclusive on +.B /dev/sdb1 +- like this: .sp \ pvmove /dev/sdb1:1000-1999 .P -It is possible to move the range of extents to a specific location (as long -as the location has sufficent free extents) - even on the same device. +To move a range of Physical Extents to a specific location (which must have +sufficent free extents) use the form: .sp \ pvmove /dev/sdb1:1000-1999 /dev/sdc1 .sp -\ pvmove /dev/sdb1:1000-1999 /dev/sdb1:0-999 +or +.sp +\ pvmove /dev/sdb1:1000-1999 /dev/sdc1:0-999 .P -A specific logical volume in a range of extents can also be picked out and -moved. +If the source and destination are on the same disk, the +.B anywhere +allocation policy would be needed, like this: +.sp +\ pvmove --alloc anywhere /dev/sdb1:1000-1999 /dev/sdb1:0-999 +.P + +The part of a specific Logical Volume present within in a range of Physical +Extents can also be picked out and moved, like this: .sp \ pvmove -n lvol1 /dev/sdb1:1000-1999 /dev/sdc1 .SH SEE ALSO .BR lvm (8), .BR vgconvert (8) -.BR pvs (8) \ No newline at end of file +.BR pvs (8) From agk@sourceware.org Thu Apr 28 16:54:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 28 Apr 2011 16:54:00 -0000 Subject: LVM2 configure configure.in Message-ID: <20110428165435.15680.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-28 16:54:33 Modified files: . : configure configure.in Log message: Add missing pkg_config_init check with --enable-udev_sync. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.diff?cvsroot=lvm2&r1=1.147&r2=1.148 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.161&r2=1.162 --- LVM2/configure 2011/04/22 12:13:05 1.147 +++ LVM2/configure 2011/04/28 16:54:32 1.148 @@ -8767,6 +8767,9 @@ $as_echo "$UDEV_SYNC" >&6; } if test x$UDEV_SYNC = xyes; then + if test x$PKGCONFIG_INIT != x1; then + pkg_config_init + fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UDEV" >&5 --- LVM2/configure.in 2011/04/22 11:56:41 1.161 +++ LVM2/configure.in 2011/04/28 16:54:33 1.162 @@ -803,6 +803,10 @@ AC_MSG_RESULT($UDEV_SYNC) if test x$UDEV_SYNC = xyes; then + dnl -- init pkgconfig if required + if test x$PKGCONFIG_INIT != x1; then + pkg_config_init + fi PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"]) AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.]) fi From agk@sourceware.org Thu Apr 28 17:33:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 28 Apr 2011 17:33:00 -0000 Subject: LVM2 lib/misc/lvm-globals.h lib/config/default ... Message-ID: <20110428173338.14524.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-28 17:33:35 Modified files: lib/misc : lvm-globals.h lib/config : defaults.h lib/commands : toolcontext.c doc : example.conf.in Log message: Set pv_min_size to 2048KB to exclude floppy drives. Previously was 512. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-globals.h.diff?cvsroot=lvm2&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.74&r2=1.75 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.116&r2=1.117 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.24&r2=1.25 --- LVM2/lib/misc/lvm-globals.h 2011/04/22 12:05:33 1.10 +++ LVM2/lib/misc/lvm-globals.h 2011/04/28 17:33:34 1.11 @@ -18,7 +18,6 @@ #define VERBOSE_BASE_LEVEL _LOG_WARN #define SECURITY_LEVEL 0 -#define DEFAULT_PV_MIN_SIZE_KB 512 /* 512 KB */ void init_verbose(int level); void init_test(int level); --- LVM2/lib/config/defaults.h 2011/04/22 12:05:32 1.74 +++ LVM2/lib/config/defaults.h 2011/04/28 17:33:35 1.75 @@ -39,6 +39,7 @@ #define DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION 1 #define DEFAULT_DATA_ALIGNMENT_DETECTION 1 #define DEFAULT_ISSUE_DISCARDS 0 +#define DEFAULT_PV_MIN_SIZE_KB 2048 #define DEFAULT_LOCKING_LIB "liblvm2clusterlock.so" #define DEFAULT_FALLBACK_TO_LOCAL_LOCKING 1 --- LVM2/lib/commands/toolcontext.c 2011/04/22 12:05:32 1.116 +++ LVM2/lib/commands/toolcontext.c 2011/04/28 17:33:35 1.117 @@ -325,7 +325,7 @@ pv_min_kb, DEFAULT_PV_MIN_SIZE_KB); pv_min_kb = DEFAULT_PV_MIN_SIZE_KB; } - /* lvm internally works with device size in 512b sectors */ + /* LVM stores sizes internally in units of 512-byte sectors. */ init_pv_min_size((uint64_t)pv_min_kb * (1024 >> SECTOR_SHIFT)); return 1; --- LVM2/doc/example.conf.in 2011/04/26 09:09:24 1.24 +++ LVM2/doc/example.conf.in 2011/04/28 17:33:35 1.25 @@ -6,6 +6,9 @@ # # To put this file in a different directory and override @DEFAULT_SYS_DIR@ set # the environment variable LVM_SYSTEM_DIR before running the tools. +# +# N.B. Take care that each setting only appears once if uncommenting +# example settings in this file. # This section allows you to configure which block devices should @@ -155,12 +158,15 @@ # Allow use of pvcreate --uuid without requiring --restorefile. require_restorefile_with_uuid = 1 - # Minimal size (in KB) of the block device which can be used as a PV. - # In clustered environment all nodes have to use the same value. + # Minimum size (in KB) of block devices which can be used as PVs. + # In a clustered environment all nodes must use the same value. # Any value smaller than 512KB is ignored. - # Example: Ignore devices smaller than 2MB (i.e. floppy drives). - # pv_min_size = 2048 - pv_min_size = 512 + + # Ignore devices smaller than 2MB such as floppy drives. + pv_min_size = 2048 + + # The original built-in setting was 512 up to and including version 2.02.84. + # pv_min_size = 512 # Issue discards to a logical volumes's underlying physical volume(s) when # the logical volume is no longer using the physical volumes' space (e.g. From zkabelac@sourceware.org Thu Apr 28 19:59:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Thu, 28 Apr 2011 19:59:00 -0000 Subject: LVM2/lib/device dev-cache.c Message-ID: <20110428195918.29719.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-28 19:59:17 Modified files: lib/device : dev-cache.c Log message: Missing space in debug message Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.c.diff?cvsroot=lvm2&r1=1.64&r2=1.65 --- LVM2/lib/device/dev-cache.c 2011/04/22 12:05:33 1.64 +++ LVM2/lib/device/dev-cache.c 2011/04/28 19:59:17 1.65 @@ -546,7 +546,7 @@ "cache fully", dl->dir); } else if (!_insert_dir(dl->dir)) - log_debug("%s: Failed to insert devices to" + log_debug("%s: Failed to insert devices to " "device cache fully", dl->dir); } } From agk@sourceware.org Thu Apr 28 20:30:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 28 Apr 2011 20:30:00 -0000 Subject: LVM2/lib locking/locking.c locking/locking.h m ... Message-ID: <20110428203001.9308.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-28 20:30:00 Modified files: lib/locking : locking.c locking.h lib/metadata : metadata-exported.h mirror.c lib/mm : memlock.h Log message: clean up critical section patch Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.93&r2=1.94 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.63&r2=1.64 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.189&r2=1.190 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.150&r2=1.151 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mm/memlock.h.diff?cvsroot=lvm2&r1=1.7&r2=1.8 --- LVM2/lib/locking/locking.c 2011/02/18 14:16:12 1.93 +++ LVM2/lib/locking/locking.c 2011/04/28 20:29:59 1.94 @@ -574,11 +574,13 @@ int sync_local_dev_names(struct cmd_context* cmd) { memlock_unlock(cmd); - return lock_vol(cmd, VG_SYNC_NAMES, LCK_NONE | LCK_CACHE | LCK_LOCAL); + + return lock_vol(cmd, VG_SYNC_NAMES, LCK_VG_SYNC_LOCAL); } int sync_dev_names(struct cmd_context* cmd) { memlock_unlock(cmd); - return lock_vol(cmd, VG_SYNC_NAMES, LCK_NONE | LCK_CACHE); + + return lock_vol(cmd, VG_SYNC_NAMES, LCK_VG_SYNC); } --- LVM2/lib/locking/locking.h 2011/02/18 14:16:12 1.63 +++ LVM2/lib/locking/locking.h 2011/04/28 20:29:59 1.64 @@ -39,6 +39,9 @@ * acquired in alphabetical order of 'vol' (to avoid deadlocks), with * VG_ORPHANS last. * + * Use VG_SYNC_NAMES to wait for any outstanding asynchronous /dev nodes + * events to complete. + * * LCK_LV: * Lock/unlock an individual logical volume * char *vol holds lvid @@ -127,6 +130,9 @@ #define LCK_VG_BACKUP (LCK_VG | LCK_CACHE) +#define LCK_VG_SYNC (LCK_NONE | LCK_CACHE) +#define LCK_VG_SYNC_LOCAL (LCK_NONE | LCK_CACHE | LCK_LOCAL) + #define LCK_LV_EXCLUSIVE (LCK_LV | LCK_EXCL) #define LCK_LV_SUSPEND (LCK_LV | LCK_WRITE) #define LCK_LV_RESUME (LCK_LV | LCK_UNLOCK) @@ -175,12 +181,7 @@ lock_vol((vg)->cmd, (vg)->name, LCK_VG_REVERT) #define remote_backup_metadata(vg) \ lock_vol((vg)->cmd, (vg)->name, LCK_VG_BACKUP) -/* cleanup later -#define sync_local_dev_names(cmd) \ - lock_vol(cmd, VG_SYNC_NAMES, LCK_NONE | LCK_CACHE | LCK_LOCAL) -#define sync_dev_names(cmd) \ - lock_vol(cmd, VG_SYNC_NAMES, LCK_NONE | LCK_CACHE) -*/ + int sync_local_dev_names(struct cmd_context* cmd); int sync_dev_names(struct cmd_context* cmd); --- LVM2/lib/metadata/metadata-exported.h 2011/04/06 21:32:20 1.189 +++ LVM2/lib/metadata/metadata-exported.h 2011/04/28 20:30:00 1.190 @@ -196,7 +196,7 @@ #define FMT_INSTANCE_PRIVATE_MDAS 0x00000008U struct format_instance { - unsigned ref_count; + unsigned ref_count; /* Refs to this fid from VG and PV structs */ struct dm_pool *mem; uint32_t type; --- LVM2/lib/metadata/mirror.c 2011/04/12 14:13:17 1.150 +++ LVM2/lib/metadata/mirror.c 2011/04/28 20:30:00 1.151 @@ -987,11 +987,11 @@ } /* FIXME: second suspend should not be needed - * Explicitly suspend temporary LV - * This balance critical_section_inc() calls with critical_section_dec() in resume - * (both localy and in cluster) and also properly propagates precommited + * Explicitly suspend temporary LV. + * This balances critical_section_inc() calls with critical_section_dec() + * in resume (both local and cluster) and also properly propagates precommitted * metadata into dm table on other nodes. - * (visible flag set causes the suspend is not properly propagated?) + * FIXME: check propagation of suspend with visible flag */ if (temp_layer_lv && !suspend_lv(temp_layer_lv->vg->cmd, temp_layer_lv)) log_error("Problem suspending temporary LV %s", temp_layer_lv->name); --- LVM2/lib/mm/memlock.h 2011/02/18 14:16:12 1.7 +++ LVM2/lib/mm/memlock.h 2011/04/28 20:30:00 1.8 @@ -18,6 +18,19 @@ struct cmd_context; +/* + * Inside a critical section, memory is always locked. + * + * After leaving the critical section, memory stays locked until + * memlock_unlock() is called. This happens with + * sync_local_dev_names() and sync_dev_names(). + * + * This allows critical sections to be entered and exited repeatedly without + * incurring the expense of locking memory every time. + * + * memlock_reset() is necessary to clear the state after forking (polldaemon). + */ + void critical_section_inc(struct cmd_context *cmd); void critical_section_dec(struct cmd_context *cmd); int critical_section(void); From zkabelac@sourceware.org Thu Apr 28 22:17:00 2011 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Thu, 28 Apr 2011 22:17:00 -0000 Subject: LVM2/test Makefile.in Message-ID: <20110428221706.25594.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2011-04-28 22:17:06 Modified files: test : Makefile.in Log message: Add missing cleanup for vgimportclone script Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/Makefile.in.diff?cvsroot=lvm2&r1=1.55&r2=1.56 --- LVM2/test/Makefile.in 2011/04/21 17:42:58 1.55 +++ LVM2/test/Makefile.in 2011/04/28 22:17:06 1.56 @@ -106,6 +106,7 @@ for i in lvm $$(cat ../tools/.commands); do rm -f lib/$$i; done if test "$(srcdir)" != . ; then rm -f $(subst $(srcdir)/, ,$(RUN)) lvm2app.sh ; fi -CLEAN_TARGETS += .lib-dir-stamp .test-stamp $(LIB) lib/dmsetup lib/clvmd lib/dmeventd +CLEAN_TARGETS += .lib-dir-stamp .test-stamp $(LIB) \ + lib/dmsetup lib/clvmd lib/dmeventd lib/vgimportclone .NOTPARALLEL: From agk@sourceware.org Fri Apr 29 00:21:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 00:21:00 -0000 Subject: LVM2 ./WHATS_NEW ./WHATS_NEW_DM lib/locking/lo ... Message-ID: <20110429002123.27456.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 00:21:16 Modified files: . : WHATS_NEW WHATS_NEW_DM lib/locking : locking.h lib/log : log.c lib/mirror : mirrored.c lib/mm : memlock.c lib/snapshot : snapshot.c man : dmsetup.8.in lvm.conf.5.in tools : vgsplit.c Log message: pre-release clean-ups Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1975&r2=1.1976 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.462&r2=1.463 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.64&r2=1.65 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.63&r2=1.64 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mirror/mirrored.c.diff?cvsroot=lvm2&r1=1.85&r2=1.86 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mm/memlock.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/snapshot/snapshot.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.38&r2=1.39 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvm.conf.5.in.diff?cvsroot=lvm2&r1=1.20&r2=1.21 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.106&r2=1.107 --- LVM2/WHATS_NEW 2011/04/22 12:05:32 1.1975 +++ LVM2/WHATS_NEW 2011/04/29 00:21:13 1.1976 @@ -3,9 +3,10 @@ Add new obtain_device_list_from_udev setting to lvm.conf. Obtain device list from udev by default if LVM2 is compiled with udev support. Add nightly test for vgimportclone and querying of vgnames with duplicate pvs. - Fix use of released memory when duplicate PV is found. + Avoid use of released memory when duplicate PV is found. Add "devices/issue_discards" to lvm.conf. Issue discards on lvremove, lvreduce, etc if enabled and supported. + Add seg_pe_ranges and devices fields to liblvm. Fix incorrect tests for dm_snprintf() failure. Fix some unmatching sign comparation gcc warnings in the code. Allow lv_extend() to work on zero length intrinsically layered LVs. @@ -17,7 +18,12 @@ Replace several strncmp() calls with id_equal(). Fix lvmcache_info transfer to orphan_vginfo in _lvmcache_update_vgname(). Fix -Wold-style-definition gcc warnings. + Rename MIRROR_NOTSYNCED to LV_NOTSYNCED. + Fix _move_lv_segments to handle empty LVs. Fixes for lvconvert (including --repair) of temporary mirror stacks. + Avoid potential loop when removing mirror images. + Fix mirror removal always to take account of preferences as to which. + Fix MIRRORED flag usage. Mitigate annoying error warning from device is usable check if run as non-root. Add missing \0 for grown debug object in _bitset_with_random_bits(). Fix allocation of system_id buffer in volume_group structure. @@ -31,6 +37,7 @@ Use new alloc_fid fn for common format instance initialisation. Optimise _get_token() and _eat_space(). Add _lv_postorder_vg() to improve efficiency for all LVs in VG. + Add gdbinit script for debugging. Use hash tables to speedup string search in vg_validate(). Refactor allocation of VG structure, add alloc_vg(). Avoid possible endless loop in _free_vginfo when 4 or more VGs have same name. @@ -38,8 +45,7 @@ Don't allocate unused VG mempool in _pvsegs_sub_single. Do not send uninitialised bytes in local clvmd messages. Support --help option for clvmd and return error for unknown option. - Use system page size and not hardcoded value in locking code check. - Fix reading of released memory for printing segment type. + Avoid reading freed memory when printing LV segment type. Fix syslog initialisation in clvmd to respect lvm.conf setting. Fix possible overflow in maximum stripe size and physical extent size. Add test for failed allocation from dm_task_set_uuid() in dmeventd. @@ -48,26 +54,31 @@ Improve cling policy to recognise PVs already used during the transaction. Improve normal allocation algorithm to include clinging to existing areas. Add allocation/maximise_cling & mirror_logs_require_separate_pvs to lvm.conf. - Fix metadata balance code to work with recent changes in metadata handling. + Adapt metadata balancing code to work with metadata handling changes. Add old_id field to physical_volume and fix pvchange -u for recent changes. Allow pvresize on a PV with two metadata areas. Change pvcreate to use new metadata handling interface. - Restructure existing pv_setup and pv_write fn, add pv_initialise fn. + Restructure existing pv_setup and pv_write and add pv_initialise. Add internal interface to support adding and removing metadata areas. Allow internal indexing of metadata areas (PV id + mda order). Generalise internal format_instance infrastrusture for PV and VG use. Handle decimal digits with --units instead of ignoring them silently. Fix remaining warnings and compile with -Wpointer-arith. - Fix gcc warnings for unused variables. + Fix gcc warnings for unused variables and const casts. Add stack backtraces for error paths in process_each_lv(). - Fixing some const cast gcc warnings in the code. - Use char* arithmetic in _text_write(), _text_read() & send_message(). - Fix compilation when devmapper is dissabled. + Temporarily suppress error from calling yes_no_prompt while locks are held. + Replace void* with char* arithmetic in _text_write, _text_read & send_message. + Fix compilation without DEVMAPPER_SUPPORT. Remove fs_unlock() from lv_suspend error path. - Change memory locking semantic and use critical sections. - Add configurable pv_min_size to select block devices by its size. - Add function to read 64bit ints from config find_config_tree_int64. - Fix to make resuming exclusive cluster mirror use local target type. + Allow memory to stay locked between leaving and re-entering critical sections. + Rename memlock to critical_section throughout. + Make pv_min_size configurable and increase to 2048KB to exclude floppy drives. + Add find_config_tree_int64 to read 64-bit ints from config. + Ensure resuming exclusive cluster mirror continues to use local mirror target. + Clear temporary postorder LV status flags to allow re-use with same LV struct. + Remove invalid snapshot umount mesg which floods syslog from dmeventd plugin. + Add extended examples to pvmove man page. + Support LVM_TEST_DEVDIR env var for private /dev during testing. Version 2.02.84 - 9th February 2011 =================================== --- LVM2/WHATS_NEW_DM 2011/04/22 11:56:41 1.462 +++ LVM2/WHATS_NEW_DM 2011/04/29 00:21:13 1.463 @@ -10,15 +10,18 @@ Improve stack debug reporting in dm_task_create(). Fallback to control node creation only if node doesn't exist yet. Change dm_hash API for binary data to accept const void *key. - Fix memory access of empty params string in _reload_with_suppression_v4(). + Fix uninitialised memory use with empty params in _reload_with_suppression_v4. Lower severity of selabel_lookup and matchpathcon failure to log_debug. + Add dm_event_get_version to dmeventd for use with -R. + Avoid dmeventd core dumps when handling request with unknown command ID. + Have dmeventd -R start up even when no existing copy is running. Accept multiple mapped device names on many dmsetup command lines. Fix dm_udev_wait calls in dmsetup to occur before readahead display not after. Include an implicit dm_task_update_nodes() within dm_udev_wait(). Fix _create_and_load_v4 not to lose the --addnodeoncreate setting (1.02.62). Add inactive table query support for kernel driver >= 4.11.6 (RHEL 5.7). Log debug open_count in _node_has_closed_parents(). - Change dm_report_field_string() API to accept const char *const *data. + Add a const to dm_report_field_string() data parameter. Version 1.02.63 - 9th February 2011 =================================== --- LVM2/lib/locking/locking.h 2011/04/28 20:29:59 1.64 +++ LVM2/lib/locking/locking.h 2011/04/29 00:21:14 1.65 @@ -39,8 +39,8 @@ * acquired in alphabetical order of 'vol' (to avoid deadlocks), with * VG_ORPHANS last. * - * Use VG_SYNC_NAMES to wait for any outstanding asynchronous /dev nodes - * events to complete. + * Use VG_SYNC_NAMES to ensure /dev is up-to-date for example, with udev, + * by waiting for any asynchronous events issued to have completed. * * LCK_LV: * Lock/unlock an individual logical volume --- LVM2/lib/log/log.c 2011/04/08 14:13:08 1.63 +++ LVM2/lib/log/log.c 2011/04/29 00:21:14 1.64 @@ -234,6 +234,7 @@ message = &buf2[0]; } +/* FIXME Avoid pointless use of message buffer when it'll never be read! */ if (_store_errmsg && (level <= _LOG_ERR) && _lvm_errmsg_len < MAX_ERRMSG_LEN) { msglen = strlen(message); --- LVM2/lib/mirror/mirrored.c 2011/03/25 21:59:42 1.85 +++ LVM2/lib/mirror/mirrored.c 2011/04/29 00:21:14 1.86 @@ -613,11 +613,11 @@ .target_percent = _mirrored_target_percent, .target_present = _mirrored_target_present, .check_transient_status = _mirrored_transient_status, -#ifdef DMEVENTD +# ifdef DMEVENTD .target_monitored = _target_registered, .target_monitor_events = _target_monitor_events, .target_unmonitor_events = _target_unmonitor_events, -#endif +# endif /* DMEVENTD */ #endif .modules_needed = _mirrored_modules_needed, .destroy = _mirrored_destroy, @@ -642,10 +642,10 @@ segtype->flags = SEG_AREAS_MIRRORED; #ifdef DEVMAPPER_SUPPORT -#ifdef DMEVENTD +# ifdef DMEVENTD if (_get_mirror_dso_path(cmd)) segtype->flags |= SEG_MONITORED; -#endif +# endif /* DMEVENTD */ #endif log_very_verbose("Initialised segtype: %s", segtype->name); --- LVM2/lib/mm/memlock.c 2011/04/08 14:40:20 1.40 +++ LVM2/lib/mm/memlock.c 2011/04/29 00:21:15 1.41 @@ -360,7 +360,8 @@ "Maps lock %ld < unlock %ld", (long)_mstats, (long)unlock_mstats); else - log_debug("Maps lock %ld < unlock %ld, 1 page difference!", + /* FIXME Believed due to incorrect use of yes_no_prompt while locks held */ + log_debug("Suppressed internal error: Maps lock %ld < unlock %ld, a one-page difference.", (long)_mstats, (long)unlock_mstats); } } --- LVM2/lib/snapshot/snapshot.c 2011/03/25 21:59:42 1.54 +++ LVM2/lib/snapshot/snapshot.c 2011/04/29 00:21:15 1.55 @@ -232,11 +232,11 @@ #ifdef DEVMAPPER_SUPPORT .target_percent = _snap_target_percent, .target_present = _snap_target_present, -#ifdef DMEVENTD +# ifdef DMEVENTD .target_monitored = _target_registered, .target_monitor_events = _target_register_events, .target_unmonitor_events = _target_unregister_events, -#endif +# endif /* DMEVENTD */ #endif .modules_needed = _snap_modules_needed, .destroy = _snap_destroy, @@ -261,10 +261,10 @@ segtype->flags = SEG_SNAPSHOT; #ifdef DEVMAPPER_SUPPORT -#ifdef DMEVENTD +# ifdef DMEVENTD if (_get_snapshot_dso_path(cmd)) segtype->flags |= SEG_MONITORED; -#endif +# endif /* DMEVENTD */ #endif log_very_verbose("Initialised segtype: %s", segtype->name); --- LVM2/man/dmsetup.8.in 2011/03/10 13:11:45 1.38 +++ LVM2/man/dmsetup.8.in 2011/04/29 00:21:16 1.39 @@ -290,7 +290,7 @@ be removed because uninterruptible processes are waiting for I/O to return from them, adding --force will replace the table with one that fails all I/O, which might allow the -process to be killed. This also runs \fBmknodes\fP afterward. +process to be killed. This also runs \fBmknodes\fP afterwards. .IP \fBrename .I device_name new_name .br --- LVM2/man/lvm.conf.5.in 2011/04/13 18:26:39 1.20 +++ LVM2/man/lvm.conf.5.in 2011/04/29 00:21:16 1.21 @@ -175,10 +175,9 @@ \fBpv_min_size\fP \(em Minimal size (in KB) of the block device which can be used as a PV. In clustered environment all nodes have to use the same value. -Any value smaller than 512KB is ignored. An example to -ignore devices smaller than 2MB (i.e. floppy drives): -.IP -pv_min_size = 2048 +Any value smaller than 512KB is ignored. Up to and include version 2.02.84 +the default was 512KB. From 2.02.85 onwards it was changed to 2MB to +avoid floppy drives by default. .IP \fBissue_discards\fP \(em Issue discards to a logical volumes's underlying physical volume(s) when the --- LVM2/tools/vgsplit.c 2011/03/30 14:35:01 1.106 +++ LVM2/tools/vgsplit.c 2011/04/29 00:21:16 1.107 @@ -488,8 +488,8 @@ bad: /* - * Note: as vg_to is referencing moved elements from vg_from - * the order of free_vg calls is mandatory. + * vg_to references elements moved from vg_from + * so vg_to has to be freed first. */ unlock_and_free_vg(cmd, vg_to, vg_name_to); unlock_and_free_vg(cmd, vg_from, vg_name_from); From agk@sourceware.org Fri Apr 29 16:12:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 16:12:00 -0000 Subject: LVM2 VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Message-ID: <20110429161223.29191.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 16:12:22 Modified files: . : VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Log message: pre-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.276&r2=1.277 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.83&r2=1.84 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1976&r2=1.1977 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.463&r2=1.464 --- LVM2/VERSION 2011/02/09 12:11:21 1.276 +++ LVM2/VERSION 2011/04/29 16:12:21 1.277 @@ -1 +1 @@ -2.02.85(2)-cvs (2011-02-09) +2.02.85(2)-cvs (2011-04-29) --- LVM2/VERSION_DM 2011/02/09 12:11:21 1.83 +++ LVM2/VERSION_DM 2011/04/29 16:12:21 1.84 @@ -1 +1 @@ -1.02.64-cvs (2011-02-09) +1.02.64-cvs (2011-04-29) --- LVM2/WHATS_NEW 2011/04/29 00:21:13 1.1976 +++ LVM2/WHATS_NEW 2011/04/29 16:12:21 1.1977 @@ -1,19 +1,19 @@ -Version 2.02.85 - -=================================== +Version 2.02.85 - 29th April 2011 +================================= Add new obtain_device_list_from_udev setting to lvm.conf. Obtain device list from udev by default if LVM2 is compiled with udev support. - Add nightly test for vgimportclone and querying of vgnames with duplicate pvs. + Add test for vgimportclone and querying of vgnames with duplicate pvs. Avoid use of released memory when duplicate PV is found. Add "devices/issue_discards" to lvm.conf. - Issue discards on lvremove, lvreduce, etc if enabled and supported. + Issue discards on lvremove and lvreduce etc. if enabled and supported. Add seg_pe_ranges and devices fields to liblvm. Fix incorrect tests for dm_snprintf() failure. Fix some unmatching sign comparation gcc warnings in the code. - Allow lv_extend() to work on zero length intrinsically layered LVs. - Keep the cache content when the exported vg buffer is matching. - Extend the set of memory regions, that are not locked to memory. - Enhance usability with the valgrind memcheck tool. - Support regular quit of the lvm_thread_fn function in clvmd. + Support lv_extend() on empty LVs. + Avoid regenerating cache content when exported VG buffer is unchanged. + Extend the set of memory regions that are not locked to memory. + Workaround some problems when compiled for valgrind memcheck. + Support controlled quit of the lvm_thread_fn function in clvmd. Fix reading of unallocated memory in lvm1 format import function. Replace several strncmp() calls with id_equal(). Fix lvmcache_info transfer to orphan_vginfo in _lvmcache_update_vgname(). @@ -24,7 +24,7 @@ Avoid potential loop when removing mirror images. Fix mirror removal always to take account of preferences as to which. Fix MIRRORED flag usage. - Mitigate annoying error warning from device is usable check if run as non-root. + Remove error messages issued by device_is_usable when run as non-root. Add missing \0 for grown debug object in _bitset_with_random_bits(). Fix allocation of system_id buffer in volume_group structure. Fix readlink usage inside get_primary_dev(). @@ -39,7 +39,7 @@ Add _lv_postorder_vg() to improve efficiency for all LVs in VG. Add gdbinit script for debugging. Use hash tables to speedup string search in vg_validate(). - Refactor allocation of VG structure, add alloc_vg(). + Refactor allocation of VG structure adding alloc_vg(). Avoid possible endless loop in _free_vginfo when 4 or more VGs have same name. Use empty string instead of /dev// for LV path when there's no VG. Don't allocate unused VG mempool in _pvsegs_sub_single. @@ -48,7 +48,6 @@ Avoid reading freed memory when printing LV segment type. Fix syslog initialisation in clvmd to respect lvm.conf setting. Fix possible overflow in maximum stripe size and physical extent size. - Add test for failed allocation from dm_task_set_uuid() in dmeventd. Improve pvremove error message when PV belongs to a VG. Extend normal policy to allow mirror logs on same PVs as images if necessary. Improve cling policy to recognise PVs already used during the transaction. --- LVM2/WHATS_NEW_DM 2011/04/29 00:21:13 1.463 +++ LVM2/WHATS_NEW_DM 2011/04/29 16:12:21 1.464 @@ -1,17 +1,18 @@ -Version 1.02.64 - -=================================== +Version 1.02.64 - 29th April 2011 +================================== Require libudev >= 143 when compiling with udev support. Use word alignment for dm_pool_strdup() and dm_pool_strndup(). - Use dm_snprintf() to fix signess warning in dm_set_dev_dir(). - Use unsigned loop counter to fix signess warning in _other_node_ops(). + Use dm_snprintf() to fix signedness warning in dm_set_dev_dir(). + Use unsigned loop counter to fix signedness warning in _other_node_ops(). Fix const cast in dmsetup calls of dm_report_field_string(). Streamline /dev/mapper/control node code for common cases. Use hard-coded dm control node device number for 2.6.36 kernels and above. Improve stack debug reporting in dm_task_create(). Fallback to control node creation only if node doesn't exist yet. - Change dm_hash API for binary data to accept const void *key. + Change dm_hash binary functions to take void *key instead of char *. Fix uninitialised memory use with empty params in _reload_with_suppression_v4. Lower severity of selabel_lookup and matchpathcon failure to log_debug. + Add test for failed allocation from dm_task_set_uuid() in dmeventd. Add dm_event_get_version to dmeventd for use with -R. Avoid dmeventd core dumps when handling request with unknown command ID. Have dmeventd -R start up even when no existing copy is running. From agk@sourceware.org Fri Apr 29 16:23:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 16:23:00 -0000 Subject: LVM2/lib/commands toolcontext.c Message-ID: <20110429162340.1412.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 16:23:40 Modified files: lib/commands : toolcontext.c Log message: commands/toolcontext.c:578: warning: ??????????????udev_dir???????????????? may be used uninitialized in this function commands/toolcontext.c:576: warning: ??????????????udev_dir_len???????????????? may be used uninitialized in this function Bogus - suppress them. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.117&r2=1.118 --- LVM2/lib/commands/toolcontext.c 2011/04/28 17:33:35 1.117 +++ LVM2/lib/commands/toolcontext.c 2011/04/29 16:23:39 1.118 @@ -573,9 +573,9 @@ { const struct config_node *cn; const struct config_value *cv; - size_t udev_dir_len, len; + size_t uninitialized_var(udev_dir_len), len; int device_list_from_udev; - const char *udev_dir; + const char *uninitialized_var(udev_dir); init_dev_disable_after_error_count( find_config_tree_int(cmd, "devices/disable_after_error_count", From agk@sourceware.org Fri Apr 29 16:27:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 16:27:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20110429162711.4887.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 16:27:10 Modified files: . : WHATS_NEW Log message: wake buildbot Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1977&r2=1.1978 --- LVM2/WHATS_NEW 2011/04/29 16:12:21 1.1977 +++ LVM2/WHATS_NEW 2011/04/29 16:27:09 1.1978 @@ -346,7 +346,7 @@ Fix const warning in dev_manager_info() and _dev_manager_lv_rmnodes(). Fix const warning in archive_file structure from archive.c. Clean generated files .exported_symbols_generated, example.conf for distclean. - Handle failure of all mirrored log devices and all but one mirror leg. + Handle failure of all mirrored log devices and all but one mirror leg. Disallow 'mirrored' log type for cluster mirrors. Do not use VPATH in include/Makefile. Fix exported_symbols generation to use standard compiler arguments. From agk@sourceware.org Fri Apr 29 17:05:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 17:05:00 -0000 Subject: LVM2 VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Message-ID: <20110429170521.16241.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 17:05:21 Modified files: . : VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Log message: post-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.277&r2=1.278 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.84&r2=1.85 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1978&r2=1.1979 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.464&r2=1.465 --- LVM2/VERSION 2011/04/29 16:12:21 1.277 +++ LVM2/VERSION 2011/04/29 17:05:20 1.278 @@ -1 +1 @@ -2.02.85(2)-cvs (2011-04-29) +2.02.86(2)-cvs (2011-04-29) --- LVM2/VERSION_DM 2011/04/29 16:12:21 1.84 +++ LVM2/VERSION_DM 2011/04/29 17:05:20 1.85 @@ -1 +1 @@ -1.02.64-cvs (2011-04-29) +1.02.65-cvs (2011-04-29) --- LVM2/WHATS_NEW 2011/04/29 16:27:09 1.1978 +++ LVM2/WHATS_NEW 2011/04/29 17:05:20 1.1979 @@ -1,3 +1,6 @@ +Version 2.02.86 - +================================= + Version 2.02.85 - 29th April 2011 ================================= Add new obtain_device_list_from_udev setting to lvm.conf. --- LVM2/WHATS_NEW_DM 2011/04/29 16:12:21 1.464 +++ LVM2/WHATS_NEW_DM 2011/04/29 17:05:20 1.465 @@ -1,3 +1,6 @@ +Version 1.02.65 - +================================== + Version 1.02.64 - 29th April 2011 ================================== Require libudev >= 143 when compiling with udev support. From agk@sourceware.org Fri Apr 29 18:40:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 18:40:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20110429184056.8309.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 18:40:56 Modified files: . : WHATS_NEW Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1980&r2=1.1981 --- LVM2/WHATS_NEW 2011/04/29 18:40:14 1.1980 +++ LVM2/WHATS_NEW 2011/04/29 18:40:55 1.1981 @@ -1,4 +1,4 @@ -Version 2.02.86 - +Version 2.02.86 - ================================= Version 2.02.85 - 29th April 2011 From agk@sourceware.org Fri Apr 29 18:41:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 18:41:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20110429184147.13156.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 18:41:46 Modified files: . : WHATS_NEW Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1981&r2=1.1982 --- LVM2/WHATS_NEW 2011/04/29 18:40:55 1.1981 +++ LVM2/WHATS_NEW 2011/04/29 18:41:46 1.1982 @@ -1,4 +1,4 @@ -Version 2.02.86 - +Version 2.02.86 - ================================= Version 2.02.85 - 29th April 2011 From agk@sourceware.org Fri Apr 29 18:43:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 18:43:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20110429184331.14457.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 18:43:31 Modified files: . : WHATS_NEW Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1982&r2=1.1983 --- LVM2/WHATS_NEW 2011/04/29 18:41:46 1.1982 +++ LVM2/WHATS_NEW 2011/04/29 18:43:31 1.1983 @@ -1,4 +1,4 @@ -Version 2.02.86 - +Version 2.02.86 - ================================= Version 2.02.85 - 29th April 2011 From agk@sourceware.org Fri Apr 29 18:48:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 18:48:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20110429184852.17119.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 18:48:51 Modified files: . : WHATS_NEW Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1983&r2=1.1984 --- LVM2/WHATS_NEW 2011/04/29 18:43:31 1.1983 +++ LVM2/WHATS_NEW 2011/04/29 18:48:50 1.1984 @@ -1,4 +1,4 @@ -Version 2.02.86 - +Version 2.02.86 - ================================= Version 2.02.85 - 29th April 2011 From agk@sourceware.org Fri Apr 29 18:56:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 18:56:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20110429185636.22213.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 18:56:35 Modified files: . : WHATS_NEW Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1984&r2=1.1985 --- LVM2/WHATS_NEW 2011/04/29 18:48:50 1.1984 +++ LVM2/WHATS_NEW 2011/04/29 18:56:35 1.1985 @@ -1,4 +1,4 @@ -Version 2.02.86 - +Version 2.02.86 - ================================= Version 2.02.85 - 29th April 2011 From agk@sourceware.org Fri Apr 29 18:57:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 18:57:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20110429185712.23185.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 18:57:10 Modified files: . : WHATS_NEW Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1985&r2=1.1986 --- LVM2/WHATS_NEW 2011/04/29 18:56:35 1.1985 +++ LVM2/WHATS_NEW 2011/04/29 18:57:09 1.1986 @@ -1,4 +1,4 @@ -Version 2.02.86 - +Version 2.02.86 - ================================= Version 2.02.85 - 29th April 2011 From agk@sourceware.org Fri Apr 29 18:58:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 18:58:00 -0000 Subject: LVM2 WHATS_NEW_DM Message-ID: <20110429185805.24796.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 18:58:05 Modified files: . : WHATS_NEW_DM Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.465&r2=1.466 --- LVM2/WHATS_NEW_DM 2011/04/29 17:05:20 1.465 +++ LVM2/WHATS_NEW_DM 2011/04/29 18:58:04 1.466 @@ -1,4 +1,4 @@ -Version 1.02.65 - +Version 1.02.65 - ================================== Version 1.02.64 - 29th April 2011 From agk@sourceware.org Fri Apr 29 19:02:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 19:02:00 -0000 Subject: LVM2 VERSION WHATS_NEW_DM Message-ID: <20110429190200.27750.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 19:01:59 Modified files: . : VERSION WHATS_NEW_DM Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.278&r2=1.279 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.466&r2=1.467 --- LVM2/VERSION 2011/04/29 17:05:20 1.278 +++ LVM2/VERSION 2011/04/29 19:01:59 1.279 @@ -1 +1 @@ -2.02.86(2)-cvs (2011-04-29) +2.02.86(2)-cvs (2011-04-29) --- LVM2/WHATS_NEW_DM 2011/04/29 18:58:04 1.466 +++ LVM2/WHATS_NEW_DM 2011/04/29 19:01:59 1.467 @@ -1,4 +1,4 @@ -Version 1.02.65 - +Version 1.02.65 - ================================== Version 1.02.64 - 29th April 2011 From agk@sourceware.org Fri Apr 29 19:02:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 19:02:00 -0000 Subject: LVM2 VERSION Message-ID: <20110429190223.28111.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 19:02:22 Modified files: . : VERSION Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.279&r2=1.280 --- LVM2/VERSION 2011/04/29 19:01:59 1.279 +++ LVM2/VERSION 2011/04/29 19:02:22 1.280 @@ -1 +1 @@ -2.02.86(2)-cvs (2011-04-29) +2.02.86(2)-cvs (2011-04-29) From agk@sourceware.org Fri Apr 29 19:05:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 19:05:00 -0000 Subject: LVM2 WHATS_NEW WHATS_NEW_DM Message-ID: <20110429190512.29177.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 19:05:11 Modified files: . : WHATS_NEW WHATS_NEW_DM Log message: test Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1986&r2=1.1987 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.467&r2=1.468 --- LVM2/WHATS_NEW 2011/04/29 18:57:09 1.1986 +++ LVM2/WHATS_NEW 2011/04/29 19:05:11 1.1987 @@ -1,4 +1,4 @@ -Version 2.02.86 - +Version 2.02.86 - ================================= Version 2.02.85 - 29th April 2011 --- LVM2/WHATS_NEW_DM 2011/04/29 19:01:59 1.467 +++ LVM2/WHATS_NEW_DM 2011/04/29 19:05:11 1.468 @@ -1,4 +1,4 @@ -Version 1.02.65 - +Version 1.02.65 - ================================== Version 1.02.64 - 29th April 2011 From agk@sourceware.org Fri Apr 29 19:06:00 2011 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 29 Apr 2011 19:06:00 -0000 Subject: LVM2/lib format_text/import_vsn1.c metadata/vg.h Message-ID: <20110429190617.29509.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-04-29 19:06:17 Modified files: lib/format_text: import_vsn1.c lib/metadata : vg.h Log message: test update without WHATS_NEW to check it gives warning now Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.86&r2=1.87 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/vg.h.diff?cvsroot=lvm2&r1=1.10&r2=1.11 --- LVM2/lib/format_text/import_vsn1.c 2011/03/27 13:44:08 1.86 +++ LVM2/lib/format_text/import_vsn1.c 2011/04/29 19:06:17 1.87 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * --- LVM2/lib/metadata/vg.h 2011/03/10 12:43:30 1.10 +++ LVM2/lib/metadata/vg.h 2011/04/29 19:06:17 1.11 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *