From prajnoha@sourceware.org Sun Nov 1 18:01:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Sun, 01 Nov 2009 18:01:00 -0000 Subject: LVM2/udev 10-dm.rules.in 11-dm-lvm.rules 95-dm ... Message-ID: <20091101180132.31649.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-11-01 18:01:31 Modified files: udev : 10-dm.rules.in 11-dm-lvm.rules 95-dm-notify.rules Log message: More cleanup in udev rules: - add copyright notice for 10-dm.rules.in, - set DM_UDEV_DISABLE_{DISK, OTHER}_RULES_FLAG in 11-dm-lvm.rules directly for inappropriate and non-top-level subdevices in case we use older kernels where DM_COOKIE is not used (and therefore there are no flags passed from the LVM process itself). This applies for older kernels (version < 2.6.31), - remove unnecessary filters in 95-dm-notify.rules - the DM_COOKIE env var itself is set for change/remove udev events and for DM devices only so there's no need to double-check this. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/10-dm.rules.in.diff?cvsroot=lvm2&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/11-dm-lvm.rules.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/95-dm-notify.rules.diff?cvsroot=lvm2&r1=1.4&r2=1.5 --- LVM2/udev/10-dm.rules.in 2009/10/26 14:29:34 1.5 +++ LVM2/udev/10-dm.rules.in 2009/11/01 18:01:31 1.6 @@ -1,3 +1,7 @@ +# Copyright (C) 2009 Red Hat, Inc. All rights reserved. +# +# This file is part of LVM2. + # Udev rules for device-mapper devices. # # These rules create a DM control node in /dev/(DM_DIR) directory. --- LVM2/udev/11-dm-lvm.rules 2009/10/26 22:42:07 1.3 +++ LVM2/udev/11-dm-lvm.rules 2009/11/01 18:01:31 1.4 @@ -22,9 +22,14 @@ IMPORT{program}="$env{DM_SBIN_PATH}/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}" # Do not create symlinks for inappropriate subdevices. -ENV{DM_LV_NAME}=="?*_mimage_[0-9]*|pvmove?*|?*_vorigin", GOTO="lvm_end" +ENV{DM_LV_NAME}=="?*_mimage_[0-9]*|pvmove?*|?*_vorigin", GOTO="lvm_disable" +ENV{DM_LV_LAYER}=="?*", GOTO="lvm_disable" # Create symlinks for top-level devices only. -ENV{DM_VG_NAME}=="?*", ENV{DM_LV_NAME}=="?*", ENV{DM_LV_LAYER}!="?*", SYMLINK+="$env{DM_VG_NAME}/$env{DM_LV_NAME}" +ENV{DM_VG_NAME}=="?*", ENV{DM_LV_NAME}=="?*", SYMLINK+="$env{DM_VG_NAME}/$env{DM_LV_NAME}", GOTO="lvm_end" + +LABEL="lvm_disable" +ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1" +ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1" LABEL="lvm_end" --- LVM2/udev/95-dm-notify.rules 2009/10/26 22:42:07 1.4 +++ LVM2/udev/95-dm-notify.rules 2009/11/01 18:01:31 1.5 @@ -9,10 +9,4 @@ # a cookie value sent within "change" and "remove" events (the cookie # value is set before by that process for every action requested). -SUBSYSTEM!="block", GOTO="dm_end" -KERNEL!="dm-[0-9]*", GOTO="dm_end" -ACTION!="change|remove", GOTO="dm_end" - ENV{DM_COOKIE}=="?*", RUN+="$env{DM_SBIN_PATH}/dmsetup udevcomplete $env{DM_COOKIE}" - -LABEL="dm_end" From wysochanski@sourceware.org Sun Nov 1 19:51:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Sun, 01 Nov 2009 19:51:00 -0000 Subject: LVM2 lib/metadata/metadata-exported.h lib/meta ... Message-ID: <20091101195156.24908.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-11-01 19:51:55 Modified files: lib/metadata : metadata-exported.h metadata.c liblvm : lvm_vg.c tools : pvcreate.c toollib.c toollib.h vgcreate.c vgextend.c Log message: Rename pvcreate_params processing functions to better match . Rename fill_default_pvcreate_params to pvcreate_params_set_defaults. Rename pvcreate_validate_restore_params to pvcreate_restore_params_validate. Rename pvcreate_validate_params to pvcreate_params_validate. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.119&r2=1.120 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.293&r2=1.294 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_vg.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.175&r2=1.176 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.65&r2=1.66 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55 --- LVM2/lib/metadata/metadata-exported.h 2009/10/31 17:30:52 1.119 +++ LVM2/lib/metadata/metadata-exported.h 2009/11/01 19:51:54 1.120 @@ -372,7 +372,7 @@ struct physical_volume *pvcreate_single(struct cmd_context *cmd, const char *pv_name, struct pvcreate_params *pp); -void fill_default_pvcreate_params(struct pvcreate_params *pp); +void pvcreate_params_set_defaults(struct pvcreate_params *pp); /* * Utility functions --- LVM2/lib/metadata/metadata.c 2009/10/31 17:30:52 1.293 +++ LVM2/lib/metadata/metadata.c 2009/11/01 19:51:54 1.294 @@ -1314,7 +1314,7 @@ return 1; } -void fill_default_pvcreate_params(struct pvcreate_params *pp) +void pvcreate_params_set_defaults(struct pvcreate_params *pp) { memset(pp, 0, sizeof(*pp)); pp->zero = 1; @@ -1354,7 +1354,7 @@ struct pvcreate_params default_pp; char buffer[64] __attribute((aligned(8))); - fill_default_pvcreate_params(&default_pp); + pvcreate_params_set_defaults(&default_pp); if (!pp) pp = &default_pp; --- LVM2/liblvm/lvm_vg.c 2009/10/05 20:03:08 1.32 +++ LVM2/liblvm/lvm_vg.c 2009/11/01 19:51:55 1.33 @@ -54,7 +54,7 @@ return -1; } - fill_default_pvcreate_params(&pp); + pvcreate_params_set_defaults(&pp); if (!vg_extend(vg, 1, (char **) &device, &pp)) { unlock_vg(vg->cmd, VG_ORPHANS); return -1; --- LVM2/tools/pvcreate.c 2009/10/05 20:03:54 1.87 +++ LVM2/tools/pvcreate.c 2009/11/01 19:51:55 1.88 @@ -23,7 +23,7 @@ * Output arguments: * pp: structure allocated by caller, fields written / validated here */ -static int pvcreate_validate_restore_params(struct cmd_context *cmd, +static int pvcreate_restore_params_validate(struct cmd_context *cmd, int argc, char **argv, struct pvcreate_params *pp) { @@ -84,12 +84,12 @@ int ret = ECMD_PROCESSED; struct pvcreate_params pp; - fill_default_pvcreate_params(&pp); + pvcreate_params_set_defaults(&pp); - if (!pvcreate_validate_restore_params(cmd, argc, argv, &pp)) { + if (!pvcreate_restore_params_validate(cmd, argc, argv, &pp)) { return EINVALID_CMD_LINE; } - if (!pvcreate_validate_params(cmd, argc, argv, &pp)) { + if (!pvcreate_params_validate(cmd, argc, argv, &pp)) { return EINVALID_CMD_LINE; } --- LVM2/tools/toollib.c 2009/10/06 16:00:38 1.175 +++ LVM2/tools/toollib.c 2009/11/01 19:51:55 1.176 @@ -1278,7 +1278,7 @@ * Output arguments: * pp: structure allocated by caller, fields written / validated here */ -int pvcreate_validate_params(struct cmd_context *cmd, +int pvcreate_params_validate(struct cmd_context *cmd, int argc, char **argv, struct pvcreate_params *pp) { --- LVM2/tools/toollib.h 2009/10/05 20:03:55 1.65 +++ LVM2/tools/toollib.h 2009/11/01 19:51:55 1.66 @@ -107,7 +107,7 @@ int vg_refresh_visible(struct cmd_context *cmd, struct volume_group *vg); void lv_spawn_background_polling(struct cmd_context *cmd, struct logical_volume *lv); -int pvcreate_validate_params(struct cmd_context *cmd, +int pvcreate_params_validate(struct cmd_context *cmd, int argc, char **argv, struct pvcreate_params *pp); --- LVM2/tools/vgcreate.c 2009/10/31 17:39:22 1.71 +++ LVM2/tools/vgcreate.c 2009/11/01 19:51:55 1.72 @@ -40,8 +40,8 @@ "use --pvmetadatacopies instead."); return EINVALID_CMD_LINE; } - fill_default_pvcreate_params(&pp); - if (!pvcreate_validate_params(cmd, argc, argv, &pp)) { + pvcreate_params_set_defaults(&pp); + if (!pvcreate_params_validate(cmd, argc, argv, &pp)) { return EINVALID_CMD_LINE; } --- LVM2/tools/vgextend.c 2009/10/05 20:55:57 1.54 +++ LVM2/tools/vgextend.c 2009/11/01 19:51:55 1.55 @@ -37,8 +37,8 @@ "use --pvmetadatacopies instead."); return EINVALID_CMD_LINE; } - fill_default_pvcreate_params(&pp); - if (!pvcreate_validate_params(cmd, argc, argv, &pp)) { + pvcreate_params_set_defaults(&pp); + if (!pvcreate_params_validate(cmd, argc, argv, &pp)) { return EINVALID_CMD_LINE; } From wysochanski@sourceware.org Sun Nov 1 20:02:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Sun, 01 Nov 2009 20:02:00 -0000 Subject: LVM2/tools toollib.c toollib.h vgcreate.c vgsp ... Message-ID: <20091101200233.27147.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-11-01 20:02:32 Modified files: tools : toollib.c toollib.h vgcreate.c vgsplit.c Log message: Add vgcreate_params_set_defaults(). Add function to set default vgcreate parameters based on existing VG or internal defaults. Should be no functional change. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.176&r2=1.177 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.66&r2=1.67 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.96&r2=1.97 --- LVM2/tools/toollib.c 2009/11/01 19:51:55 1.176 +++ LVM2/tools/toollib.c 2009/11/01 20:02:32 1.177 @@ -1183,6 +1183,26 @@ return rc; } +void vgcreate_params_set_defaults(struct vgcreate_params *vp_def, + struct volume_group *vg) +{ + if (vg) { + vp_def->vg_name = NULL; + vp_def->extent_size = vg->extent_size; + vp_def->max_pv = vg->max_pv; + vp_def->max_lv = vg->max_lv; + vp_def->alloc = vg->alloc; + vp_def->clustered = vg_is_clustered(vg); + } else { + vp_def->vg_name = NULL; + vp_def->extent_size = DEFAULT_EXTENT_SIZE * 2; + vp_def->max_pv = DEFAULT_MAX_PV; + vp_def->max_lv = DEFAULT_MAX_LV; + vp_def->alloc = DEFAULT_ALLOC_POLICY; + vp_def->clustered = DEFAULT_CLUSTERED; + } +} + /* * Set members of struct vgcreate_params from cmdline. * Do preliminary validation with arg_*() interface. --- LVM2/tools/toollib.h 2009/11/01 19:51:55 1.66 +++ LVM2/tools/toollib.h 2009/11/01 20:02:32 1.67 @@ -99,6 +99,8 @@ int apply_lvname_restrictions(const char *name); int is_reserved_lvname(const char *name); +void vgcreate_params_set_defaults(struct vgcreate_params *vp_def, + struct volume_group *vg); int fill_vg_create_params(struct cmd_context *cmd, char *vg_name, struct vgcreate_params *vp_new, struct vgcreate_params *vp_def); --- LVM2/tools/vgcreate.c 2009/11/01 19:51:55 1.72 +++ LVM2/tools/vgcreate.c 2009/11/01 20:02:32 1.73 @@ -45,12 +45,7 @@ return EINVALID_CMD_LINE; } - vp_def.vg_name = NULL; - vp_def.extent_size = DEFAULT_EXTENT_SIZE * 2; - vp_def.max_pv = DEFAULT_MAX_PV; - vp_def.max_lv = DEFAULT_MAX_LV; - vp_def.alloc = DEFAULT_ALLOC_POLICY; - vp_def.clustered = DEFAULT_CLUSTERED; + vgcreate_params_set_defaults(&vp_def, NULL); if (fill_vg_create_params(cmd, vg_name, &vp_new, &vp_def)) return EINVALID_CMD_LINE; --- LVM2/tools/vgsplit.c 2009/10/31 17:43:57 1.96 +++ LVM2/tools/vgsplit.c 2009/11/01 20:02:32 1.97 @@ -366,13 +366,7 @@ if (!vgs_are_compatible(cmd, vg_from,vg_to)) goto_bad; } else { - vp_def.vg_name = NULL; - vp_def.extent_size = vg_from->extent_size; - vp_def.max_pv = vg_from->max_pv; - vp_def.max_lv = vg_from->max_lv; - vp_def.alloc = vg_from->alloc; - vp_def.clustered = vg_is_clustered(vg_from); - + vgcreate_params_set_defaults(&vp_def, vg_from); if (fill_vg_create_params(cmd, vg_name_to, &vp_new, &vp_def)) { r = EINVALID_CMD_LINE; goto_bad; From wysochanski@sourceware.org Sun Nov 1 20:03:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Sun, 01 Nov 2009 20:03:00 -0000 Subject: LVM2/tools toollib.c toollib.h vgcreate.c vgsp ... Message-ID: <20091101200324.12374.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-11-01 20:03:24 Modified files: tools : toollib.c toollib.h vgcreate.c vgsplit.c Log message: Rename fill_vg_create_params to vgcreate_params_set_from_args. Rename fill_vg_create_params to vgcreate_params_set_from_args and remove vg_name parameter from function (caller must set before calling function). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.177&r2=1.178 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.67&r2=1.68 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.97&r2=1.98 --- LVM2/tools/toollib.c 2009/11/01 20:02:32 1.177 +++ LVM2/tools/toollib.c 2009/11/01 20:03:24 1.178 @@ -1204,16 +1204,16 @@ } /* - * Set members of struct vgcreate_params from cmdline. + * Set members of struct vgcreate_params from cmdline arguments. * Do preliminary validation with arg_*() interface. * Further, more generic validation is done in validate_vgcreate_params(). * This function is to remain in tools directory. */ -int fill_vg_create_params(struct cmd_context *cmd, - char *vg_name, struct vgcreate_params *vp_new, - struct vgcreate_params *vp_def) +int vgcreate_params_set_from_args(struct cmd_context *cmd, + struct vgcreate_params *vp_new, + struct vgcreate_params *vp_def) { - vp_new->vg_name = skip_dev_dir(cmd, vg_name, NULL); + vp_new->vg_name = skip_dev_dir(cmd, vp_def->vg_name, NULL); vp_new->max_lv = arg_uint_value(cmd, maxlogicalvolumes_ARG, vp_def->max_lv); vp_new->max_pv = arg_uint_value(cmd, maxphysicalvolumes_ARG, --- LVM2/tools/toollib.h 2009/11/01 20:02:32 1.67 +++ LVM2/tools/toollib.h 2009/11/01 20:03:24 1.68 @@ -101,10 +101,9 @@ void vgcreate_params_set_defaults(struct vgcreate_params *vp_def, struct volume_group *vg); -int fill_vg_create_params(struct cmd_context *cmd, - char *vg_name, struct vgcreate_params *vp_new, - struct vgcreate_params *vp_def); - +int vgcreate_params_set_from_args(struct cmd_context *cmd, + struct vgcreate_params *vp_new, + struct vgcreate_params *vp_def); int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv); int vg_refresh_visible(struct cmd_context *cmd, struct volume_group *vg); void lv_spawn_background_polling(struct cmd_context *cmd, --- LVM2/tools/vgcreate.c 2009/11/01 20:02:32 1.73 +++ LVM2/tools/vgcreate.c 2009/11/01 20:03:24 1.74 @@ -46,7 +46,8 @@ } vgcreate_params_set_defaults(&vp_def, NULL); - if (fill_vg_create_params(cmd, vg_name, &vp_new, &vp_def)) + vp_def.vg_name = vg_name; + if (vgcreate_params_set_from_args(cmd, &vp_new, &vp_def)) return EINVALID_CMD_LINE; if (validate_vg_create_params(cmd, &vp_new)) --- LVM2/tools/vgsplit.c 2009/11/01 20:02:32 1.97 +++ LVM2/tools/vgsplit.c 2009/11/01 20:03:24 1.98 @@ -367,7 +367,8 @@ goto_bad; } else { vgcreate_params_set_defaults(&vp_def, vg_from); - if (fill_vg_create_params(cmd, vg_name_to, &vp_new, &vp_def)) { + vp_def.vg_name = vg_name_to; + if (vgcreate_params_set_from_args(cmd, &vp_new, &vp_def)) { r = EINVALID_CMD_LINE; goto_bad; } From wysochanski@sourceware.org Sun Nov 1 20:05:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Sun, 01 Nov 2009 20:05:00 -0000 Subject: LVM2 lib/metadata/metadata-exported.h lib/meta ... Message-ID: <20091101200518.17600.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-11-01 20:05:17 Modified files: lib/metadata : metadata-exported.h metadata.c tools : vgcreate.c vgsplit.c Log message: Rename validate_vg_create_params to vgcreate_params_validate. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.120&r2=1.121 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.294&r2=1.295 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.74&r2=1.75 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.98&r2=1.99 --- LVM2/lib/metadata/metadata-exported.h 2009/11/01 19:51:54 1.120 +++ LVM2/lib/metadata/metadata-exported.h 2009/11/01 20:05:17 1.121 @@ -749,8 +749,8 @@ int clustered; /* FIXME: put this into a 'status' variable instead? */ }; -int validate_vg_create_params(struct cmd_context *cmd, - struct vgcreate_params *vp); +int vgcreate_params_validate(struct cmd_context *cmd, + struct vgcreate_params *vp); int validate_vg_rename_params(struct cmd_context *cmd, const char *vg_name_old, --- LVM2/lib/metadata/metadata.c 2009/11/01 19:51:54 1.294 +++ LVM2/lib/metadata/metadata.c 2009/11/01 20:05:17 1.295 @@ -679,8 +679,8 @@ * FIXME: Move inside vg_create library function. * FIXME: Change vgcreate_params struct to individual gets/sets */ -int validate_vg_create_params(struct cmd_context *cmd, - struct vgcreate_params *vp) +int vgcreate_params_validate(struct cmd_context *cmd, + struct vgcreate_params *vp) { if (!validate_new_vg_name(cmd, vp->vg_name)) { log_error("New volume group name \"%s\" is invalid", --- LVM2/tools/vgcreate.c 2009/11/01 20:03:24 1.74 +++ LVM2/tools/vgcreate.c 2009/11/01 20:05:17 1.75 @@ -50,7 +50,7 @@ if (vgcreate_params_set_from_args(cmd, &vp_new, &vp_def)) return EINVALID_CMD_LINE; - if (validate_vg_create_params(cmd, &vp_new)) + if (vgcreate_params_validate(cmd, &vp_new)) return EINVALID_CMD_LINE; /* Create the new VG */ --- LVM2/tools/vgsplit.c 2009/11/01 20:03:24 1.98 +++ LVM2/tools/vgsplit.c 2009/11/01 20:05:17 1.99 @@ -373,7 +373,7 @@ goto_bad; } - if (validate_vg_create_params(cmd, &vp_new)) { + if (vgcreate_params_validate(cmd, &vp_new)) { r = EINVALID_CMD_LINE; goto_bad; } From mornfall@sourceware.org Mon Nov 2 15:16:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Mon, 02 Nov 2009 15:16:00 -0000 Subject: LVM2/test Makefile.in Message-ID: <20091102151622.11596.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-02 15:16:21 Modified files: test : Makefile.in Log message: Rudimentary support for running testsuite in a builddir != srcdir situation. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/Makefile.in.diff?cvsroot=lvm2&r1=1.19&r2=1.20 --- LVM2/test/Makefile.in 2009/09/15 19:59:05 1.19 +++ LVM2/test/Makefile.in 2009/11/02 15:16:21 1.20 @@ -26,15 +26,15 @@ abs_top_srcdir = @abs_top_srcdir@ all: init.sh - ./bin/harness $(T) + ./bin/harness t-*.sh -bin/not: .bin-dir-stamp not.c - $(CC) -o bin/not not.c +bin/not: $(srcdir)/not.c .bin-dir-stamp + $(CC) -o bin/not $< -bin/harness: .bin-dir-stamp harness.c - $(CC) -o bin/harness harness.c +bin/harness: $(srcdir)/harness.c .bin-dir-stamp + $(CC) -o bin/harness $< -init.sh: Makefile.in .bin-dir-stamp bin/not bin/harness +init.sh: $(srcdir)/Makefile.in $(srcdir)/test-utils.sh .bin-dir-stamp bin/not bin/harness $(T) rm -f $@-t $@ echo 'top_srcdir=$(top_srcdir)' >> $@-t echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t @@ -46,11 +46,14 @@ echo 'export PATH' >> $@-t chmod a-w $@-t mv $@-t $@ + -cp $(srcdir)/test-utils.sh . + -cp $(srcdir)/test-lib.sh . + -cp $(T) . # Shell quote; SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) -T = $(wildcard t-*.sh) +T = $(wildcard $(srcdir)/t-*.sh) ifeq ("@APPLIB@", "yes") T += lvm2app.sh @@ -62,13 +65,13 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -$(T): init.sh - ./bin/harness $@ +#$(T): init.sh +# ./bin/harness $@ .bin-dir-stamp: lvm-wrapper rm -rf bin mkdir bin - for i in lvm $$(cat $(top_srcdir)/tools/.commands); do \ + for i in lvm $$(cat ../tools/.commands); do \ ln -s ../lvm-wrapper bin/$$i; \ done ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup From agk@sourceware.org Tue Nov 3 00:45:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 03 Nov 2009 00:45:00 -0000 Subject: LVM2/libdm/datastruct hash.c Message-ID: <20091103004535.1307.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-03 00:45:35 Modified files: libdm/datastruct: hash.c Log message: Fix hash lookup segfault when keys compared are different lengths. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/datastruct/hash.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10 --- LVM2/libdm/datastruct/hash.c 2008/11/03 18:59:59 1.9 +++ LVM2/libdm/datastruct/hash.c 2009/11/03 00:45:35 1.10 @@ -143,9 +143,13 @@ unsigned h = _hash(key, len) & (t->num_slots - 1); struct dm_hash_node **c; - for (c = &t->slots[h]; *c; c = &((*c)->next)) + for (c = &t->slots[h]; *c; c = &((*c)->next)) { + if ((*c)->keylen != len) + continue; + if (!memcmp(key, (*c)->key, len)) break; + } return c; } From zkabelac@sourceware.org Tue Nov 3 10:50:00 2009 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Tue, 03 Nov 2009 10:50:00 -0000 Subject: LVM2 ./WHATS_NEW lib/display/display.c Message-ID: <20091103105058.22155.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2009-11-03 10:50:57 Modified files: . : WHATS_NEW lib/display : display.c Log message: Add fflush for the case the log is redirected to the buffered file. Without this patch it have not been obvious, why the application waits on the stdin as the prompt might be still buffered in memory. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1310&r2=1.1311 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.106&r2=1.107 --- LVM2/WHATS_NEW 2009/10/31 17:43:57 1.1310 +++ LVM2/WHATS_NEW 2009/11/03 10:50:57 1.1311 @@ -1,5 +1,6 @@ Version 2.02.55 - =================================== + Flush stdout after yes/no prompt. Update vgsplit and vgcreate to use vg_set_clustered. Add vg_mda_count and vg_set_clustered library function. Add more vgcreate and vgsplit nightly tests. --- LVM2/lib/display/display.c 2009/10/26 10:01:57 1.106 +++ LVM2/lib/display/display.c 2009/11/03 10:50:57 1.107 @@ -824,6 +824,7 @@ va_start(ap, prompt); vprintf(prompt, ap); va_end(ap); + fflush(stdout); } if ((c = getchar()) == EOF) { From zkabelac@sourceware.org Tue Nov 3 11:00:00 2009 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Tue, 03 Nov 2009 11:00:00 -0000 Subject: LVM2/lib/format_text export.c text_export.h Message-ID: <20091103110047.25927.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2009-11-03 11:00:47 Modified files: lib/format_text: export.c text_export.h Log message: Export functions out_inc_indent(), out_dec_indent() for creating indented metadata lines. Macro outnl() is using exported out_newline() instead of direct call f->fn(), that required the visibility of the internal struct formatter. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/export.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/text_export.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/lib/format_text/export.c 2009/10/16 17:41:51 1.70 +++ LVM2/lib/format_text/export.c 2009/11/03 11:00:46 1.71 @@ -235,6 +235,24 @@ return dm_snprintf(buffer, s, "# %g %s", d, _units[i]) > 0; } +/* increment indention level */ +void out_inc_indent(struct formatter *f) +{ + _inc_indent(f); +} + +/* decrement indention level */ +void out_dec_indent(struct formatter *f) +{ + _dec_indent(f); +} + +/* insert new line */ +int out_newline(struct formatter *f) +{ + return f->nl(f); +} + /* * Appends a comment giving a size in more easily * readable form (eg, 4M instead of 8096). --- LVM2/lib/format_text/text_export.h 2009/10/16 17:41:51 1.5 +++ LVM2/lib/format_text/text_export.h 2009/11/03 11:00:46 1.6 @@ -17,7 +17,7 @@ #define _LVM_TEXT_EXPORT_H #define outf(args...) do {if (!out_text(args)) return_0;} while (0) -#define outnl(f) do {if (!f->nl(f)) return_0;} while (0) +#define outnl(f) do {if (!out_newline(f)) return_0;} while (0) struct formatter; struct lv_segment; @@ -37,4 +37,8 @@ int out_areas(struct formatter *f, const struct lv_segment *seg, const char *type); +void out_inc_indent(struct formatter *f); +void out_dec_indent(struct formatter *f); +int out_newline(struct formatter *f); + #endif From zkabelac@sourceware.org Tue Nov 3 11:17:00 2009 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Tue, 03 Nov 2009 11:17:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20091103111747.17846.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2009-11-03 11:17:46 Modified files: . : WHATS_NEW Log message: Update for outnl and indent functions Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1311&r2=1.1312 --- LVM2/WHATS_NEW 2009/11/03 10:50:57 1.1311 +++ LVM2/WHATS_NEW 2009/11/03 11:17:46 1.1312 @@ -1,5 +1,6 @@ Version 2.02.55 - =================================== + Export outnl and indent functions for modules. Flush stdout after yes/no prompt. Update vgsplit and vgcreate to use vg_set_clustered. Add vg_mda_count and vg_set_clustered library function. From agk@sourceware.org Tue Nov 3 15:50:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 03 Nov 2009 15:50:00 -0000 Subject: LVM2 ./WHATS_NEW ./WHATS_NEW_DM tools/dumpconf ... Message-ID: <20091103155046.19199.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-03 15:50:44 Modified files: . : WHATS_NEW WHATS_NEW_DM tools : dumpconfig.c lvconvert.c lvcreate.c lvmcmdline.c lvresize.c polldaemon.c pvmove.c reporter.c tools.h Log message: Tidy some uses of arg_count and introduce arg_is_set. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1312&r2=1.1313 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.310&r2=1.311 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dumpconfig.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.96&r2=1.97 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.208&r2=1.209 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.107&r2=1.108 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.114&r2=1.115 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.67&r2=1.68 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.64&r2=1.65 --- LVM2/WHATS_NEW 2009/11/03 11:17:46 1.1312 +++ LVM2/WHATS_NEW 2009/11/03 15:50:42 1.1313 @@ -1,5 +1,6 @@ Version 2.02.55 - =================================== + Tidy some uses of arg_count and introduce arg_is_set. Export outnl and indent functions for modules. Flush stdout after yes/no prompt. Update vgsplit and vgcreate to use vg_set_clustered. --- LVM2/WHATS_NEW_DM 2009/10/27 01:13:21 1.310 +++ LVM2/WHATS_NEW_DM 2009/11/03 15:50:42 1.311 @@ -1,5 +1,6 @@ Version 1.02.40 - =================================== + Fix hash lookup segfault when keys compared are different lengths. Version 1.02.39 - 26th October 2009 =================================== --- LVM2/tools/dumpconfig.c 2009/09/14 22:47:49 1.8 +++ LVM2/tools/dumpconfig.c 2009/11/03 15:50:43 1.9 @@ -17,10 +17,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv) { - const char *file = NULL; - - if (arg_count(cmd, file_ARG)) - file = arg_str_value(cmd, file_ARG, ""); + const char *file = arg_str_value(cmd, file_ARG, NULL); if (!write_config_file(cmd->cft, file, argc, argv)) { stack; --- LVM2/tools/lvconvert.c 2009/10/26 10:01:57 1.96 +++ LVM2/tools/lvconvert.c 2009/11/03 15:50:44 1.97 @@ -129,9 +129,7 @@ lp->mirrors_sign = arg_sign_value(cmd, mirrors_ARG, 0); } - lp->alloc = ALLOC_INHERIT; - if (arg_count(cmd, alloc_ARG)) - lp->alloc = arg_uint_value(cmd, alloc_ARG, lp->alloc); + lp->alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_INHERIT); if (lp->snapshot) { if (arg_count(cmd, regionsize_ARG)) { --- LVM2/tools/lvcreate.c 2009/09/14 22:47:49 1.208 +++ LVM2/tools/lvcreate.c 2009/11/03 15:50:44 1.209 @@ -33,8 +33,7 @@ char **argv = *pargv, *ptr; char *vg_name; - if (arg_count(cmd, name_ARG)) - lp->lv_name = arg_value(cmd, name_ARG); + lp->lv_name = arg_str_value(cmd, name_ARG, NULL); if (lp->snapshot && !arg_count(cmd, virtualsize_ARG)) { if (!argc) { @@ -347,7 +346,7 @@ log_verbose("Setting logging type to %s", mirrorlog); - lp->nosync = arg_count(cmd, nosync_ARG) ? 1 : 0; + lp->nosync = arg_is_set(cmd, nosync_ARG); if (arg_count(cmd, regionsize_ARG)) { if (arg_sign_value(cmd, regionsize_ARG, 0) == SIGN_MINUS) { @@ -521,10 +520,8 @@ /* * Permissions. */ - if (arg_count(cmd, permission_ARG)) - lp->permission = arg_uint_value(cmd, permission_ARG, 0); - else - lp->permission = LVM_READ | LVM_WRITE; + lp->permission = arg_uint_value(cmd, permission_ARG, + LVM_READ | LVM_WRITE); /* Must not zero read only volume */ if (!(lp->permission & LVM_WRITE)) @@ -558,11 +555,7 @@ return 0; } - if (arg_count(cmd, addtag_ARG) && - !(lp->tag = arg_str_value(cmd, addtag_ARG, NULL))) { - log_error("Failed to get tag"); - return 0; - } + lp->tag = arg_str_value(cmd, addtag_ARG, NULL); lcp->pv_count = argc; lcp->pvs = argv; --- LVM2/tools/lvmcmdline.c 2009/10/05 20:55:57 1.107 +++ LVM2/tools/lvmcmdline.c 2009/11/03 15:50:44 1.108 @@ -54,61 +54,58 @@ static struct cmdline_context _cmdline; /* Command line args */ -/* FIXME: struct cmd_context * is unnecessary (large # files ) */ +/* FIXME: Move static _the_args into cmd? */ unsigned arg_count(const struct cmd_context *cmd __attribute((unused)), int a) { return _the_args[a].count; } +unsigned arg_is_set(const struct cmd_context *cmd, int a) +{ + return arg_count(cmd, a) ? 1 : 0; +} + const char *arg_value(struct cmd_context *cmd __attribute((unused)), int a) { return _the_args[a].value; } -const char *arg_str_value(struct cmd_context *cmd __attribute((unused)), - int a, const char *def) +const char *arg_str_value(struct cmd_context *cmd, int a, const char *def) { return arg_count(cmd, a) ? _the_args[a].value : def; } -int32_t arg_int_value(struct cmd_context *cmd __attribute((unused)), - int a, const int32_t def) +int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def) { return arg_count(cmd, a) ? _the_args[a].i_value : def; } -uint32_t arg_uint_value(struct cmd_context *cmd __attribute((unused)), - int a, const uint32_t def) +uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def) { return arg_count(cmd, a) ? _the_args[a].ui_value : def; } -int64_t arg_int64_value(struct cmd_context *cmd __attribute((unused)), - int a, const int64_t def) +int64_t arg_int64_value(struct cmd_context *cmd, int a, const int64_t def) { return arg_count(cmd, a) ? _the_args[a].i64_value : def; } -uint64_t arg_uint64_value(struct cmd_context *cmd __attribute((unused)), - int a, const uint64_t def) +uint64_t arg_uint64_value(struct cmd_context *cmd, int a, const uint64_t def) { return arg_count(cmd, a) ? _the_args[a].ui64_value : def; } -const void *arg_ptr_value(struct cmd_context *cmd __attribute((unused)), - int a, const void *def) +const void *arg_ptr_value(struct cmd_context *cmd, int a, const void *def) { return arg_count(cmd, a) ? _the_args[a].ptr : def; } -sign_t arg_sign_value(struct cmd_context *cmd __attribute((unused)), - int a, const sign_t def) +sign_t arg_sign_value(struct cmd_context *cmd, int a, const sign_t def) { return arg_count(cmd, a) ? _the_args[a].sign : def; } -percent_t arg_percent_value(struct cmd_context *cmd __attribute((unused)), - int a, const percent_t def) +percent_t arg_percent_value(struct cmd_context *cmd, int a, const percent_t def) { return arg_count(cmd, a) ? _the_args[a].percent : def; } --- LVM2/tools/lvresize.c 2009/07/07 01:18:35 1.114 +++ LVM2/tools/lvresize.c 2009/11/03 15:50:44 1.115 @@ -240,8 +240,8 @@ return 0; } - lp->resizefs = arg_count(cmd, resizefs_ARG) ? 1 : 0; - lp->nofsck = arg_count(cmd, nofsck_ARG) ? 1 : 0; + lp->resizefs = arg_is_set(cmd, resizefs_ARG); + lp->nofsck = arg_is_set(cmd, nofsck_ARG); if (!argc) { log_error("Please provide the logical volume name"); --- LVM2/tools/polldaemon.c 2009/10/01 01:04:27 1.28 +++ LVM2/tools/polldaemon.c 2009/11/03 15:50:44 1.29 @@ -239,7 +239,7 @@ { struct daemon_parms parms; - parms.aborting = arg_count(cmd, abort_ARG) ? 1 : 0; + parms.aborting = arg_is_set(cmd, abort_ARG); parms.background = background; parms.interval = arg_uint_value(cmd, interval_ARG, DEFAULT_INTERVAL); parms.progress_display = 1; --- LVM2/tools/pvmove.c 2009/09/30 18:15:07 1.67 +++ LVM2/tools/pvmove.c 2009/11/03 15:50:44 1.68 @@ -608,6 +608,5 @@ } } - return pvmove_poll(cmd, pv_name, - arg_count(cmd, background_ARG) ? 1U : 0); + return pvmove_poll(cmd, pv_name, arg_is_set(cmd, background_ARG)); } --- LVM2/tools/reporter.c 2009/09/15 01:38:59 1.56 +++ LVM2/tools/reporter.c 2009/11/03 15:50:44 1.57 @@ -327,11 +327,9 @@ } /* -O overrides default sort settings */ - if (arg_count(cmd, sort_ARG)) - keys = arg_str_value(cmd, sort_ARG, ""); + keys = arg_str_value(cmd, sort_ARG, keys); - if (arg_count(cmd, separator_ARG)) - separator = arg_str_value(cmd, separator_ARG, " "); + separator = arg_str_value(cmd, separator_ARG, separator); if (arg_count(cmd, separator_ARG)) aligned = 0; if (arg_count(cmd, aligned_ARG)) --- LVM2/tools/tools.h 2009/06/01 14:43:28 1.64 +++ LVM2/tools/tools.h 2009/11/03 15:50:44 1.65 @@ -153,7 +153,8 @@ int readahead_arg(struct cmd_context *cmd, struct arg *a); /* we use the enums to access the switches */ -unsigned int arg_count(const struct cmd_context *cmd, int a); +unsigned arg_count(const struct cmd_context *cmd, int a); +unsigned arg_is_set(const struct cmd_context *cmd, int a); const char *arg_value(struct cmd_context *cmd, int a); const char *arg_str_value(struct cmd_context *cmd, int a, const char *def); int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def); From wysochanski@sourceware.org Tue Nov 3 15:58:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Tue, 03 Nov 2009 15:58:00 -0000 Subject: LVM2/man vgextend.8.in Message-ID: <20091103155802.22578.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-11-03 15:58:02 Modified files: man : vgextend.8.in Log message: Remove old, and now incorrect, vgextend man page description of pvcreate options. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/vgextend.8.in.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/man/vgextend.8.in 2009/10/26 02:36:29 1.5 +++ LVM2/man/vgextend.8.in 2009/11/03 15:58:02 1.6 @@ -22,10 +22,6 @@ that the restore-related options such as --restorefile, --uuid, and --physicalvolumesize are not available. If a restore operation is needed, use \fBpvcreate (8)\fP and \fBvgcfgrestore (8)\fP. -\fBpvcreate (8)\fP, the device will be initialized with the same -default values used with \fBpvcreate\fP. If non-default -\fPpvcreate\fP values are are desired, \fBpvcreate\fP should be explicitly -called prior to calling \fBvgcreate\fP. .SH OPTIONS See \fBlvm\fP for common options. .SH PHYSICAL DEVICE OPTIONS From zkabelac@sourceware.org Wed Nov 4 12:39:00 2009 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Wed, 04 Nov 2009 12:39:00 -0000 Subject: LVM2/tools lvchange.c Message-ID: <20091104123957.16754.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2009-11-04 12:39:56 Modified files: tools : lvchange.c Log message: minor code comment update Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.111&r2=1.112 --- LVM2/tools/lvchange.c 2009/09/29 20:22:35 1.111 +++ LVM2/tools/lvchange.c 2009/11/04 12:39:56 1.112 @@ -610,7 +610,7 @@ docmds++; } - /* read ahead sector change */ + /* persistent device number change */ if (arg_count(cmd, persistent_ARG)) { if (!archived && !archive(lv->vg)) { stack; From mbroz@sourceware.org Wed Nov 4 14:47:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 04 Nov 2009 14:47:00 -0000 Subject: LVM2 ./WHATS_NEW tools/lvcreate.c tools/lvresize.c Message-ID: <20091104144729.29830.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-04 14:47:28 Modified files: . : WHATS_NEW tools : lvcreate.c lvresize.c Log message: Fix lvcreate processing of %PVS argument. - fix missing unlocking of VG lvcreate -l 100%PVS -n lv1 vg_test Please specify physical volume(s) with %PVS Internal error: Volume Group vg_test was not unlocked - if no PVS specified, use all available Fix segfault if %PVS in lvresize without PVs list. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1313&r2=1.1314 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.209&r2=1.210 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.115&r2=1.116 --- LVM2/WHATS_NEW 2009/11/03 15:50:42 1.1313 +++ LVM2/WHATS_NEW 2009/11/04 14:47:27 1.1314 @@ -1,5 +1,6 @@ Version 2.02.55 - =================================== + Fix lvcreate and lvresize processing of %PVS argument. Tidy some uses of arg_count and introduce arg_is_set. Export outnl and indent functions for modules. Flush stdout after yes/no prompt. --- LVM2/tools/lvcreate.c 2009/11/03 15:50:44 1.209 +++ LVM2/tools/lvcreate.c 2009/11/04 14:47:28 1.210 @@ -160,13 +160,12 @@ lp->extents = lp->extents * vg->free_count / 100; break; case PERCENT_PVS: - if (!lcp->pv_count) { - log_error("Please specify physical volume(s) " - "with %%PVS"); - return 0; + if (!lcp->pv_count) + lp->extents = lp->extents * vg->extent_count / 100; + else { + pv_extent_count = pv_list_extents_free(lp->pvh); + lp->extents = lp->extents * pv_extent_count / 100; } - pv_extent_count = pv_list_extents_free(lp->pvh); - lp->extents = lp->extents * pv_extent_count / 100; break; case PERCENT_LV: log_error("Please express size as %%VG, %%PVS, or " @@ -584,15 +583,15 @@ } if (!_update_extents_params(vg, &lp, &lcp)) { - stack; - return ECMD_FAILED; + r = ECMD_FAILED; + goto_out; } if (!lv_create_single(vg, &lp)) { stack; r = ECMD_FAILED; } - +out: unlock_and_release_vg(cmd, vg, lp.vg_name); return r; } --- LVM2/tools/lvresize.c 2009/11/03 15:50:44 1.115 +++ LVM2/tools/lvresize.c 2009/11/04 14:47:28 1.116 @@ -367,8 +367,11 @@ lp->extents = lp->extents * lv->le_count / 100; break; case PERCENT_PVS: - pv_extent_count = pv_list_extents_free(pvh); - lp->extents = lp->extents * pv_extent_count / 100; + if (lp->argc) { + pv_extent_count = pv_list_extents_free(pvh); + lp->extents = lp->extents * pv_extent_count / 100; + } else + lp->extents = lp->extents * vg->extent_count / 100; break; case PERCENT_NONE: break; From mbroz@sourceware.org Wed Nov 4 14:56:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 04 Nov 2009 14:56:00 -0000 Subject: LVM2/lib/activate dev_manager.c Message-ID: <20091104145636.2319.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-04 14:56:36 Modified files: lib/activate : dev_manager.c Log message: Fix compilation warning: activate/dev_manager.c:362: warning: combined_percent_range may be used uninitialized in this function Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.162&r2=1.163 --- LVM2/lib/activate/dev_manager.c 2009/10/26 14:29:33 1.162 +++ LVM2/lib/activate/dev_manager.c 2009/11/04 14:56:35 1.163 @@ -359,7 +359,7 @@ struct dm_list *segh = &lv->segments; struct lv_segment *seg = NULL; struct segment_type *segtype; - percent_range_t percent_range, combined_percent_range; + percent_range_t percent_range = 0, combined_percent_range = 0; int first_time = 1; uint64_t total_numerator = 0, total_denominator = 0; From agk@sourceware.org Fri Nov 6 00:43:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 06 Nov 2009 00:43:00 -0000 Subject: LVM2 ./WHATS_NEW_DM libdm/.exported_symbols li ... Message-ID: <20091106004315.19041.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-06 00:43:10 Modified files: . : WHATS_NEW_DM libdm : .exported_symbols libdevmapper.h libdm-common.c libdm/ioctl : libdm-iface.c libdm-targets.h libdm/misc : dm-ioctl.h man : dmsetup.8.in tools : dmsetup.c Log message: Add support for querying a device's inactive table. Currently this data is invisible to userspace. Requires dm >= 4.16 (likely to be in linux 2.6.33). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.311&r2=1.312 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/.exported_symbols.diff?cvsroot=lvm2&r1=1.44&r2=1.45 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.100&r2=1.101 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.89&r2=1.90 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.64&r2=1.65 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-targets.h.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/misc/dm-ioctl.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.27&r2=1.28 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.126&r2=1.127 --- LVM2/WHATS_NEW_DM 2009/11/03 15:50:42 1.311 +++ LVM2/WHATS_NEW_DM 2009/11/06 00:43:08 1.312 @@ -1,5 +1,7 @@ Version 1.02.40 - =================================== + Add dmsetup --inactive support. + Add dm_task_query_inactive_table to libdevmapper for kernel driver >= 4.16. Fix hash lookup segfault when keys compared are different lengths. Version 1.02.39 - 26th October 2009 --- LVM2/libdm/.exported_symbols 2009/10/22 13:00:07 1.44 +++ LVM2/libdm/.exported_symbols 2009/11/06 00:43:08 1.45 @@ -40,6 +40,7 @@ dm_task_no_flush dm_task_no_open_count dm_task_skip_lockfs +dm_task_query_inactive_table dm_task_update_nodes dm_task_run dm_get_next_target --- LVM2/libdm/libdevmapper.h 2009/10/26 14:29:33 1.100 +++ LVM2/libdm/libdevmapper.h 2009/11/06 00:43:08 1.101 @@ -172,6 +172,7 @@ int dm_task_no_flush(struct dm_task *dmt); int dm_task_no_open_count(struct dm_task *dmt); int dm_task_skip_lockfs(struct dm_task *dmt); +int dm_task_query_inactive_table(struct dm_task *dmt); int dm_task_suppress_identical_reload(struct dm_task *dmt); /* --- LVM2/libdm/libdm-common.c 2009/10/26 21:38:35 1.89 +++ LVM2/libdm/libdm-common.c 2009/11/06 00:43:09 1.90 @@ -181,6 +181,7 @@ dmt->read_ahead_flags = 0; dmt->event_nr = 0; dmt->cookie_set = 0; + dmt->query_inactive_table = 0; return dmt; } --- LVM2/libdm/ioctl/libdm-iface.c 2009/10/26 14:29:34 1.64 +++ LVM2/libdm/ioctl/libdm-iface.c 2009/11/06 00:43:09 1.65 @@ -1135,6 +1135,13 @@ return 1; } +int dm_task_query_inactive_table(struct dm_task *dmt) +{ + dmt->query_inactive_table = 1; + + return 1; +} + int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr) { dmt->event_nr = event_nr; @@ -1382,6 +1389,12 @@ dmi->flags |= DM_READONLY_FLAG; if (dmt->skip_lockfs) dmi->flags |= DM_SKIP_LOCKFS_FLAG; + if (dmt->query_inactive_table) { + if (_dm_version_minor < 16) + log_warn("WARNING: Inactive table query unsupported " + "by kernel. It will use live table."); + dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG; + } dmi->target_count = count; dmi->event_nr = dmt->event_nr; @@ -1723,7 +1736,7 @@ } log_debug("dm %s %s %s%s%s %s%.0d%s%.0d%s" - "%s%c%c%s %.0" PRIu64 " %s [%u]", + "%s%c%c%s%s %.0" PRIu64 " %s [%u]", _cmd_data_v4[dmt->type].name, dmi->name, dmi->uuid, dmt->newname ? " " : "", dmt->newname ? dmt->newname : "", @@ -1736,6 +1749,7 @@ dmt->no_open_count ? 'N' : 'O', dmt->no_flush ? 'N' : 'F', dmt->skip_lockfs ? "S " : "", + dmt->query_inactive_table ? "I " : "", dmt->sector, dmt->message ? dmt->message : "", dmi->data_size); #ifdef DM_IOCTLS --- LVM2/libdm/ioctl/libdm-targets.h 2009/08/03 18:01:48 1.25 +++ LVM2/libdm/ioctl/libdm-targets.h 2009/11/06 00:43:09 1.26 @@ -58,6 +58,7 @@ int no_flush; int no_open_count; int skip_lockfs; + int query_inactive_table; int suppress_identical_reload; uint64_t existing_table_size; int cookie_set; --- LVM2/libdm/misc/dm-ioctl.h 2009/08/03 18:44:54 1.2 +++ LVM2/libdm/misc/dm-ioctl.h 2009/11/06 00:43:09 1.3 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. - * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved. * * This file is released under the LGPL. */ @@ -268,9 +268,9 @@ #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) #define DM_VERSION_MAJOR 4 -#define DM_VERSION_MINOR 15 +#define DM_VERSION_MINOR 16 #define DM_VERSION_PATCHLEVEL 0 -#define DM_VERSION_EXTRA "-ioctl (2009-04-01)" +#define DM_VERSION_EXTRA "-ioctl (2009-11-05)" /* Status bits */ #define DM_READONLY_FLAG (1 << 0) /* In/Out */ @@ -311,4 +311,11 @@ */ #define DM_NOFLUSH_FLAG (1 << 11) /* In */ +/* + * If set, any table information returned will relate to the inactive + * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG + * is set before using the data returned. + */ +#define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */ + #endif /* _LINUX_DM_IOCTL_H */ --- LVM2/man/dmsetup.8.in 2009/10/22 13:12:20 1.27 +++ LVM2/man/dmsetup.8.in 2009/11/06 00:43:09 1.28 @@ -107,6 +107,11 @@ .IP \fB-c|-C|--columns .br Display output in columns rather than as Field: Value lines. +.IP \fB--inactive +.br +When returning any table information from the kernel report on the +inactive table instead of the live table. +Requires kernel driver version 4.16.0 or above. .IP \fB-j|--major\ \fImajor .br Specify the major number. @@ -277,7 +282,7 @@ Splits given device name into subsystem constituents. Default subsystem is LVM. .IP \fBstatus -.I [--target target_type] +.I [--target target_type] [--inactive] .I [device_name] .br Outputs status information for each of the device's targets. @@ -296,7 +301,7 @@ the --noflush option. This lets outstanding I/O that has not yet reached the device to remain unflushed. .IP \fBtable -.I [--target target_type] +.I [--target target_type] [--inactive] .I [device_name] .br Outputs the current table for the device in a format that can be fed --- LVM2/tools/dmsetup.c 2009/10/26 14:29:34 1.126 +++ LVM2/tools/dmsetup.c 2009/11/06 00:43:10 1.127 @@ -117,6 +117,7 @@ EXEC_ARG, FORCE_ARG, GID_ARG, + INACTIVE_ARG, MAJOR_ARG, MINOR_ARG, MODE_ARG, @@ -296,6 +297,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto err; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto err; + if (!dm_task_run(dmt)) goto err; @@ -530,6 +534,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + if (!dm_task_run(dmt)) goto out; @@ -587,6 +594,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + if (_switches[READAHEAD_ARG] && !dm_task_set_read_ahead(dmt, _int_args[READAHEAD_ARG], _read_ahead_flags)) @@ -630,6 +640,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + if (!dm_task_set_cookie(dmt, &cookie, 0) || !dm_task_run(dmt)) goto out; @@ -696,6 +709,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + if (!dm_task_run(dmt)) goto out; @@ -728,6 +744,12 @@ if (!dm_task_set_geometry(dmt, argv[1], argv[2], argv[3], argv[4])) goto out; + if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) + goto out; + + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + /* run the task */ if (!dm_task_run(dmt)) goto out; @@ -1002,6 +1024,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + if (_switches[NOLOCKFS_ARG] && !dm_task_skip_lockfs(dmt)) goto out; @@ -1115,6 +1140,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + if (!dm_task_run(dmt)) goto out; @@ -1162,6 +1190,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto error; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto error; + if (!dm_task_run(dmt)) goto error; @@ -1337,6 +1368,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + if (!dm_task_run(dmt)) goto out; @@ -1458,6 +1492,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + if (!dm_task_run(dmt)) goto out; @@ -1496,6 +1533,9 @@ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt)) + goto out; + if (!dm_task_run(dmt)) goto out; @@ -2510,7 +2550,7 @@ fprintf(out, "Usage:\n\n"); fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n" - " [-r|--readonly] [--noopencount] [--nolockfs]\n" + " [-r|--readonly] [--noopencount] [--nolockfs] [--inactive]\n" " [--noudevsync] [-y|--yes] [--readahead [+]|auto|none]\n" " [-c|-C|--columns] [-o ] [-O|--sort ]\n" " [--nameprefixes] [--noheadings] [--separator ]\n\n"); @@ -2866,6 +2906,7 @@ {"exec", 1, &ind, EXEC_ARG}, {"force", 0, &ind, FORCE_ARG}, {"gid", 1, &ind, GID_ARG}, + {"inactive", 0, &ind, INACTIVE_ARG}, {"major", 1, &ind, MAJOR_ARG}, {"minor", 1, &ind, MINOR_ARG}, {"mode", 1, &ind, MODE_ARG}, @@ -3010,6 +3051,8 @@ _switches[TARGET_ARG]++; _target = optarg; } + if ((ind == INACTIVE_ARG)) + _switches[INACTIVE_ARG]++; if ((ind == NAMEPREFIXES_ARG)) _switches[NAMEPREFIXES_ARG]++; if ((ind == NOFLUSH_ARG)) From agk@sourceware.org Fri Nov 6 01:41:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 06 Nov 2009 01:41:00 -0000 Subject: LVM2/man dmsetup.8.in Message-ID: <20091106014100.26891.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-06 01:40:59 Modified files: man : dmsetup.8.in Log message: . Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.28&r2=1.29 --- LVM2/man/dmsetup.8.in 2009/11/06 00:43:09 1.28 +++ LVM2/man/dmsetup.8.in 2009/11/06 01:40:59 1.29 @@ -282,7 +282,7 @@ Splits given device name into subsystem constituents. Default subsystem is LVM. .IP \fBstatus -.I [--target target_type] [--inactive] +.I [--target target_type] .I [device_name] .br Outputs status information for each of the device's targets. @@ -301,7 +301,7 @@ the --noflush option. This lets outstanding I/O that has not yet reached the device to remain unflushed. .IP \fBtable -.I [--target target_type] [--inactive] +.I [--target target_type] .I [device_name] .br Outputs the current table for the device in a format that can be fed From prajnoha@sourceware.org Fri Nov 13 12:33:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 13 Nov 2009 12:33:00 -0000 Subject: LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h udev/ ... Message-ID: <20091113123328.23060.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-11-13 12:33:27 Modified files: . : WHATS_NEW_DM libdm : libdevmapper.h udev : 13-dm-disk.rules Log message: Remove 'last_rule' from udev rules. 'last_rule' option has been removed from udev (version >= 147). From now on, we require foreign rules to check and honor ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG} instead. Foreign rules should be skipped totally when this flag is set. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.312&r2=1.313 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.101&r2=1.102 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/13-dm-disk.rules.diff?cvsroot=lvm2&r1=1.4&r2=1.5 --- LVM2/WHATS_NEW_DM 2009/11/06 00:43:08 1.312 +++ LVM2/WHATS_NEW_DM 2009/11/13 12:33:27 1.313 @@ -1,5 +1,6 @@ Version 1.02.40 - =================================== + Remove 'last_rule' from udev rules: honor ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}. Add dmsetup --inactive support. Add dm_task_query_inactive_table to libdevmapper for kernel driver >= 4.16. Fix hash lookup segfault when keys compared are different lengths. --- LVM2/libdm/libdevmapper.h 2009/11/06 00:43:08 1.101 +++ LVM2/libdm/libdevmapper.h 2009/11/13 12:33:27 1.102 @@ -1058,9 +1058,9 @@ /* * DM_UDEV_DISABLE_OTHER_RULES_FLAG is set in case we need to disable * all the other rules that are not general device-mapper nor subsystem - * related (the rules belong to other software or packages). Use this - * flag with care since it will cutoff the rule processing after the - * last device-mapper/subsytem rule is applied. + * related (the rules belong to other software or packages). All foreign + * rules should check this flag directly and they should ignore further + * rule processing for such event. */ #define DM_UDEV_DISABLE_OTHER_RULES_FLAG 0x0008 /* --- LVM2/udev/13-dm-disk.rules 2009/10/26 22:42:07 1.4 +++ LVM2/udev/13-dm-disk.rules 2009/11/13 12:33:27 1.5 @@ -10,27 +10,18 @@ # suspended. # "add" event is processed on coldplug only! -ACTION!="add|change", GOTO="dm_other" -ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_other" -ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_other" +ACTION!="add|change", GOTO="dm_end" +ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end" +ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end" SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" -ENV{DM_SUSPENDED}=="1", GOTO="dm_other" +ENV{DM_SUSPENDED}=="1", GOTO="dm_end" IMPORT{program}="$env{DM_SBIN_PATH}/blkid -o udev -p $tempnode" ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" -# Cutoff all subsequent rules if instructed by a flag. -# This flag should be used in well-founded situations only to prevent -# any problems that could arise when processing this event further by -# foreign rules (various temporary and hidden devices mostly). -LABEL="dm_other" -ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="dm_end" -ENV{DM_COOKIE}=="?*", RUN+="$env{DM_SBIN_PATH}/dmsetup udevcomplete $env{DM_COOKIE}" -OPTIONS+="last_rule" - LABEL="dm_end" From prajnoha@sourceware.org Fri Nov 13 12:43:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 13 Nov 2009 12:43:00 -0000 Subject: LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ... Message-ID: <20091113124323.29353.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-11-13 12:43:22 Modified files: . : WHATS_NEW_DM libdm : libdevmapper.h libdm-common.c libdm-deptree.c libdm/ioctl : libdm-iface.c tools : dmsetup.c Log message: Support udev flags even when udev_sync is disabled or not compiled in. This provides better support for environments where udev rules are installed but udev_sync is not compiled in (however, using udev_sync is highly recommended). It also provides consistent and expected functionality even when '--noudevsync' option is used. There is still requirement for kernel >= 2.6.31 for the flags to work though (it uses DM cookies to pass the flags into the kernel and set them in udev event environment that we can read in udev rules). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.313&r2=1.314 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.102&r2=1.103 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.61&r2=1.62 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.127&r2=1.128 --- LVM2/WHATS_NEW_DM 2009/11/13 12:33:27 1.313 +++ LVM2/WHATS_NEW_DM 2009/11/13 12:43:21 1.314 @@ -1,5 +1,6 @@ Version 1.02.40 - =================================== + Support udev flags even when udev_sync is disabled or not compiled in. Remove 'last_rule' from udev rules: honor ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}. Add dmsetup --inactive support. Add dm_task_query_inactive_table to libdevmapper for kernel driver >= 4.16. --- LVM2/libdm/libdevmapper.h 2009/11/13 12:33:27 1.102 +++ LVM2/libdm/libdevmapper.h 2009/11/13 12:43:21 1.103 @@ -1032,6 +1032,10 @@ * of udev rules we use by decoding the cookie prefix. When doing the * notification, we replace the cookie prefix with DM_COOKIE_MAGIC, * so we notify the right semaphore. + * It is still possible to use cookies for passing the flags to udev + * rules even when udev_sync is disabled. The base part of the cookie + * will be zero (there's no notification semaphore) and prefix will be + * set then. However, having udev_sync enabled is highly recommended. */ #define DM_COOKIE_MAGIC 0x0D4D #define DM_UDEV_FLAGS_MASK 0xFFFF0000 @@ -1076,7 +1080,7 @@ int dm_cookie_supported(void); /* - * Udev notification functions. + * Udev synchronisation functions. */ void dm_udev_set_sync_support(int sync_with_udev); int dm_udev_get_sync_support(void); --- LVM2/libdm/libdm-common.c 2009/11/06 00:43:09 1.90 +++ LVM2/libdm/libdm-common.c 2009/11/13 12:43:22 1.91 @@ -886,6 +886,8 @@ int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags) { + if (dm_cookie_supported()) + dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT; *cookie = 0; return 1; @@ -1141,8 +1143,11 @@ { int semid; + if (dm_cookie_supported()) + dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT; + if (!dm_udev_get_sync_support()) { - dmt->event_nr = *cookie = 0; + *cookie = 0; return 1; } @@ -1159,8 +1164,7 @@ goto bad; } - dmt->event_nr = (~DM_UDEV_FLAGS_MASK & *cookie) | - (flags << DM_UDEV_FLAGS_SHIFT); + dmt->event_nr |= ~DM_UDEV_FLAGS_MASK & *cookie; dmt->cookie_set = 1; log_debug("Udev cookie 0x%" PRIx32 " (semid %d) assigned to dm_task " --- LVM2/libdm/libdm-deptree.c 2009/10/26 14:29:34 1.61 +++ LVM2/libdm/libdm-deptree.c 2009/11/13 12:43:22 1.62 @@ -1039,7 +1039,7 @@ continue; if (!_deactivate_node(name, info.major, info.minor, - &dnode->dtree->cookie, dnode->udev_flags)) { + &child->dtree->cookie, child->udev_flags)) { log_error("Unable to deactivate %s (%" PRIu32 ":%" PRIu32 ")", name, info.major, info.minor); --- LVM2/libdm/ioctl/libdm-iface.c 2009/11/06 00:43:09 1.65 +++ LVM2/libdm/ioctl/libdm-iface.c 2009/11/13 12:43:22 1.66 @@ -1548,6 +1548,7 @@ task->gid = dmt->gid; task->mode = dmt->mode; /* FIXME: Just for udev_check in dm_task_run. Can we avoid this? */ + task->event_nr = dmt->event_nr & DM_UDEV_FLAGS_MASK; task->cookie_set = dmt->cookie_set; r = dm_task_run(task); --- LVM2/tools/dmsetup.c 2009/11/06 00:43:10 1.127 +++ LVM2/tools/dmsetup.c 2009/11/13 12:43:22 1.128 @@ -843,9 +843,17 @@ if (!(cookie = _get_cookie_value(argv[1]))) return 0; - /* strip flags from the cookie and use cookie magic instead */ - cookie = (cookie & ~DM_UDEV_FLAGS_MASK) | - (DM_COOKIE_MAGIC << DM_UDEV_FLAGS_SHIFT); + /* + * Strip flags from the cookie and use cookie magic instead. + * If the cookie has non-zero prefix and the base is zero then + * this one carries flags to control udev rules only and it is + * not meant to be for notification. Return with success in this + * situation. + */ + if (!(cookie &= ~DM_UDEV_FLAGS_MASK)) + return 1; + + cookie |= DM_COOKIE_MAGIC << DM_UDEV_FLAGS_SHIFT; return dm_udev_complete(cookie); } From mbroz@sourceware.org Fri Nov 13 12:48:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Fri, 13 Nov 2009 12:48:00 -0000 Subject: LVM2 ./WHATS_NEW_DM daemons/dmeventd/Makefile.in Message-ID: <20091113124802.31139.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-13 12:48:01 Modified files: . : WHATS_NEW_DM daemons/dmeventd: Makefile.in Log message: Fix install_device-mapper Makefile target to not build dmeventd plugins. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.314&r2=1.315 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/Makefile.in.diff?cvsroot=lvm2&r1=1.29&r2=1.30 --- LVM2/WHATS_NEW_DM 2009/11/13 12:43:21 1.314 +++ LVM2/WHATS_NEW_DM 2009/11/13 12:48:01 1.315 @@ -1,5 +1,6 @@ Version 1.02.40 - =================================== + Fix install_device-mapper Makefile target to not build dmeventd plugins. Support udev flags even when udev_sync is disabled or not compiled in. Remove 'last_rule' from udev rules: honor ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}. Add dmsetup --inactive support. --- LVM2/daemons/dmeventd/Makefile.in 2009/10/13 02:35:26 1.29 +++ LVM2/daemons/dmeventd/Makefile.in 2009/11/13 12:48:01 1.30 @@ -103,7 +103,7 @@ install: install_include install_lib install_dmeventd -install_device-mapper: install +install_device-mapper: install_include install_lib install_dmeventd .PHONY: distclean_lib distclean From mbroz@sourceware.org Wed Nov 18 16:48:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 18 Nov 2009 16:48:00 -0000 Subject: LVM2 ./WHATS_NEW lib/mirror/mirrored.c Message-ID: <20091118164811.30581.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-18 16:48:10 Modified files: . : WHATS_NEW lib/mirror : mirrored.c Log message: Fix pvmove region_size overflow for very large PVs. Fixes problem reported in https://www.redhat.com/archives/dm-devel/2009-November/msg00104.html The region size multiplication can overflow when using 32bit integer. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1314&r2=1.1315 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mirror/mirrored.c.diff?cvsroot=lvm2&r1=1.64&r2=1.65 --- LVM2/WHATS_NEW 2009/11/04 14:47:27 1.1314 +++ LVM2/WHATS_NEW 2009/11/18 16:48:10 1.1315 @@ -1,5 +1,6 @@ Version 2.02.55 - =================================== + Fix pvmove region_size oveflow for very large PVs. Fix lvcreate and lvresize processing of %PVS argument. Tidy some uses of arg_count and introduce arg_is_set. Export outnl and indent functions for modules. --- LVM2/lib/mirror/mirrored.c 2009/10/01 00:35:30 1.64 +++ LVM2/lib/mirror/mirrored.c 2009/11/18 16:48:10 1.65 @@ -290,7 +290,7 @@ uint32_t area_count = seg->area_count; unsigned start_area = 0u; int mirror_status = MIRR_RUNNING; - uint32_t region_size, region_max; + uint32_t region_size; int r; if (!*target_state) @@ -333,18 +333,11 @@ return 0; } region_size = seg->region_size; - } else { - /* Find largest power of 2 region size unit we can use */ - region_max = (1 << (ffs((int)seg->area_len) - 1)) * - seg->lv->vg->extent_size; - - region_size = mirr_state->default_region_size; - if (region_max < region_size) { - region_size = region_max; - log_verbose("Using reduced mirror region size of %u sectors", - region_size); - } - } + + } else + region_size = adjusted_mirror_region_size(seg->lv->vg->extent_size, + seg->area_len, + mirr_state->default_region_size); if (!dm_tree_node_add_mirror_target(node, len)) return_0; From mbroz@sourceware.org Wed Nov 18 17:20:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 18 Nov 2009 17:20:00 -0000 Subject: LVM2 ./WHATS_NEW tools/vgchange.c Message-ID: <20091118172019.4879.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-18 17:20:18 Modified files: . : WHATS_NEW tools : vgchange.c Log message: Never activate hidden volumes directly in vgchange. All hidden (not visible) volumes should be activated through other visible volumes. (There are already exceptions like snapshot, mirror log and image, which should be cleaned one day...) This solves problems for future types of hidden volumes, which can have special meaning and must not be activated implicitly (e.g. key store volume). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1315&r2=1.1316 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.89&r2=1.90 --- LVM2/WHATS_NEW 2009/11/18 16:48:10 1.1315 +++ LVM2/WHATS_NEW 2009/11/18 17:20:18 1.1316 @@ -1,5 +1,6 @@ Version 2.02.55 - =================================== + Do not activate directly not visible volumes in vgchange. Fix pvmove region_size oveflow for very large PVs. Fix lvcreate and lvresize processing of %PVS argument. Tidy some uses of arg_count and introduce arg_is_set. --- LVM2/tools/vgchange.c 2009/10/31 17:30:52 1.89 +++ LVM2/tools/vgchange.c 2009/11/18 17:20:18 1.90 @@ -61,6 +61,9 @@ dm_list_iterate_items(lvl, &vg->lvs) { lv = lvl->lv; + if (!lv_is_visible(lv)) + continue; + /* Only request activation of snapshot origin devices */ if ((lv->status & SNAPSHOT) || lv_is_cow(lv)) continue; From mornfall@sourceware.org Wed Nov 18 18:22:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Wed, 18 Nov 2009 18:22:00 -0000 Subject: LVM2/lib/mm memlock.c Message-ID: <20091118182233.28286.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-18 18:22:33 Modified files: lib/mm : memlock.c Log message: Issue an Internal error message whenever _memlock_count drops below 0. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mm/memlock.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13 --- LVM2/lib/mm/memlock.c 2008/05/28 23:12:45 1.12 +++ LVM2/lib/mm/memlock.c 2009/11/18 18:22:32 1.13 @@ -135,6 +135,8 @@ if (_memlock_count && (!--_memlock_count)) _unlock_mem(); log_debug("memlock_count dec to %d", _memlock_count); + if (_memlock_count < 0) + log_error("Internal error: _memlock_count has dropped below 0."); } int memlock(void) From mornfall@sourceware.org Wed Nov 18 18:23:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Wed, 18 Nov 2009 18:23:00 -0000 Subject: LVM2/lib/metadata mirror.c Message-ID: <20091118182346.28668.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-18 18:23:46 Modified files: lib/metadata : mirror.c Log message: Add an extra memlock_inc() to _remove_mirror_images to properly balance reference counting (see code comment for details). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.92&r2=1.93 --- LVM2/lib/metadata/mirror.c 2009/10/14 14:55:44 1.92 +++ LVM2/lib/metadata/mirror.c 2009/11/18 18:23:46 1.93 @@ -612,6 +612,17 @@ return 0; } + /* + * The code above calls a suspend_lv once, however we now need to + * resume 2 LVs, due to image removal: the mirror image itself above, + * and now the remaining mirror LV. Since suspend_lv/resume_lv call + * memlock_inc/memlock_dec and these need to be balanced, we need to + * call an extra memlock_inc() here to balance for the second resume, + * which could otherwise either deadlock due to suspended devices, or + * alternatively drop memlock_count below 0. + */ + memlock_inc(); + if (!resume_lv(mirrored_seg->lv->vg->cmd, mirrored_seg->lv)) { log_error("Problem reactivating %s", mirrored_seg->lv->name); return 0; From mornfall@sourceware.org Thu Nov 19 01:11:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 19 Nov 2009 01:11:00 -0000 Subject: LVM2 tools/lvmcmdlib.c lib/mm/memlock.h lib/mm ... Message-ID: <20091119011158.31472.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-19 01:11:57 Modified files: tools : lvmcmdlib.c lib/mm : memlock.h memlock.c Log message: Fix another bug in memlock handling, this time the "global" dmeventd memlock was preventing device scans in lvconvert --repair running from inside dmeventd. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdlib.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mm/memlock.h.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mm/memlock.c.diff?cvsroot=lvm2&r1=1.13&r2=1.14 --- LVM2/tools/lvmcmdlib.c 2009/02/22 22:11:59 1.9 +++ LVM2/tools/lvmcmdlib.c 2009/11/19 01:11:57 1.10 @@ -82,9 +82,9 @@ /* FIXME Temporary - move to libdevmapper */ ret = ECMD_PROCESSED; if (!strcmp(cmdline, "_memlock_inc")) - memlock_inc(); + memlock_inc_daemon(); else if (!strcmp(cmdline, "_memlock_dec")) - memlock_dec(); + memlock_dec_daemon(); else ret = lvm_run_command(cmd, argc, argv); --- LVM2/lib/mm/memlock.h 2007/08/20 20:55:27 1.4 +++ LVM2/lib/mm/memlock.h 2009/11/19 01:11:57 1.5 @@ -20,6 +20,8 @@ void memlock_inc(void); void memlock_dec(void); +void memlock_inc_daemon(void); +void memlock_dec_daemon(void); int memlock(void); void memlock_init(struct cmd_context *cmd); --- LVM2/lib/mm/memlock.c 2009/11/18 18:22:32 1.13 +++ LVM2/lib/mm/memlock.c 2009/11/19 01:11:57 1.14 @@ -53,6 +53,7 @@ static void *_malloc_mem = NULL; static int _memlock_count = 0; +static int _memlock_count_daemon = 0; static int _priority; static int _default_priority; @@ -123,22 +124,61 @@ strerror(errno)); } +static void _lock_mem_if_needed(void) { + if ((_memlock_count + _memlock_count_daemon) == 1) + _lock_mem(); +} + +static void _unlock_mem_if_possible(void) { + if ((_memlock_count + _memlock_count_daemon) == 0) + _unlock_mem(); +} + void memlock_inc(void) { - if (!_memlock_count++) - _lock_mem(); + ++_memlock_count; + _lock_mem_if_needed(); log_debug("memlock_count inc to %d", _memlock_count); } void memlock_dec(void) { - if (_memlock_count && (!--_memlock_count)) - _unlock_mem(); - log_debug("memlock_count dec to %d", _memlock_count); - if (_memlock_count < 0) + if (!_memlock_count) log_error("Internal error: _memlock_count has dropped below 0."); + --_memlock_count; + _unlock_mem_if_possible(); + log_debug("memlock_count dec to %d", _memlock_count); } +/* + * The memlock_*_daemon functions will force the mlockall() call that we need + * to stay in memory, but they will have no effect on device scans (unlike + * normal memlock_inc and memlock_dec). Memory is kept locked as long as either + * of memlock or memlock_daemon is in effect. + */ + +void memlock_inc_daemon(void) +{ + ++_memlock_count_daemon; + _lock_mem_if_needed(); + log_debug("memlock_count_daemon inc to %d", _memlock_count_daemon); +} + +void memlock_dec_daemon(void) +{ + if (!_memlock_count_daemon) + log_error("Internal error: _memlock_count_daemon has dropped below 0."); + --_memlock_count_daemon; + _unlock_mem_if_possible(); + log_debug("memlock_count_daemon dec to %d", _memlock_count_daemon); +} + +/* + * This disregards the daemon (dmeventd) locks, since we use memlock() to check + * whether it is safe to run a device scan, which would normally coincide with + * !memlock() -- but the daemon global memory lock breaks this assumption, so + * we do not take those into account here. + */ int memlock(void) { return _memlock_count; From mornfall@sourceware.org Thu Nov 19 01:17:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 19 Nov 2009 01:17:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20091119011702.32554.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-19 01:17:01 Modified files: . : WHATS_NEW Log message: What's new. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1316&r2=1.1317 --- LVM2/WHATS_NEW 2009/11/18 17:20:18 1.1316 +++ LVM2/WHATS_NEW 2009/11/19 01:17:01 1.1317 @@ -1,5 +1,7 @@ Version 2.02.55 - =================================== + Fix a possible deadlock in mirror code due to memlock refcount mismatch. + Enable dmeventd event handlers to properly scan devices. Do not activate directly not visible volumes in vgchange. Fix pvmove region_size oveflow for very large PVs. Fix lvcreate and lvresize processing of %PVS argument. From mornfall@sourceware.org Thu Nov 19 12:01:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 19 Nov 2009 12:01:00 -0000 Subject: LVM2/test Makefile.in Message-ID: <20091119120139.24724.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-19 12:01:39 Modified files: test : Makefile.in Log message: Fix the dmeventd LD_LIBRARY_PATH in the testsuite. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/Makefile.in.diff?cvsroot=lvm2&r1=1.20&r2=1.21 --- LVM2/test/Makefile.in 2009/11/02 15:16:21 1.20 +++ LVM2/test/Makefile.in 2009/11/19 12:01:39 1.21 @@ -40,7 +40,7 @@ echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t echo 'abs_top_srcdir=$(abs_top_builddir)' >> $@-t echo 'PATH=$(abs_top_builddir)/test/bin:$$PATH' >> $@-t - echo 'export LD_LIBRARY_PATH="$(abs_top_builddir)/libdm:$(abs_top_builddir)/liblvm:$(abs_top_builddir)/dmeventd"' >> $@-t + echo 'export LD_LIBRARY_PATH="$(abs_top_builddir)/libdm:$(abs_top_builddir)/liblvm:$(abs_top_builddir)/daemons/dmeventd"' >> $@-t echo 'abs_srcdir=$(abs_srcdir)' >> $@-t echo 'abs_builddir=$(abs_builddir)' >> $@-t echo 'export PATH' >> $@-t From mornfall@sourceware.org Thu Nov 19 12:09:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 19 Nov 2009 12:09:00 -0000 Subject: LVM2/lib/metadata mirror.c Message-ID: <20091119120953.2123.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-19 12:09:53 Modified files: lib/metadata : mirror.c Log message: Add a missing #include (fix compiler warning). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.93&r2=1.94 --- LVM2/lib/metadata/mirror.c 2009/11/18 18:23:46 1.93 +++ LVM2/lib/metadata/mirror.c 2009/11/19 12:09:53 1.94 @@ -24,6 +24,7 @@ #include "lvm-string.h" #include "str_list.h" #include "locking.h" /* FIXME Should not be used in this file */ +#include "memlock.h" #include "defaults.h" /* FIXME: should this be defaults.h? */ From mornfall@sourceware.org Thu Nov 19 12:13:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 19 Nov 2009 12:13:00 -0000 Subject: LVM2 daemons/clvmd/lvm-functions.c lib/metadat ... Message-ID: <20091119121339.4868.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-19 12:13:37 Modified files: daemons/clvmd : lvm-functions.c lib/metadata : metadata-exported.h metadata.c Log message: Un-export vg_read_internal. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.121&r2=1.122 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.295&r2=1.296 --- LVM2/daemons/clvmd/lvm-functions.c 2009/10/22 17:45:24 1.70 +++ LVM2/daemons/clvmd/lvm-functions.c 2009/11/19 12:13:37 1.71 @@ -774,15 +774,14 @@ void lvm_do_backup(const char *vgname) { struct volume_group * vg; - int consistent = 0; DEBUGLOG("Triggering backup of VG metadata for %s. suspended=%d\n", vgname, suspended); pthread_mutex_lock(&lvm_lock); - vg = vg_read_internal(cmd, vgname, NULL /*vgid*/, &consistent); + vg = vg_read(cmd, vgname, NULL /*vgid*/, 0 /*flags*/); - if (vg && consistent) + if (!vg_read_error(vg)) check_current_backup(vg); else log_error("Error backing up metadata, can't find VG for group %s", vgname); --- LVM2/lib/metadata/metadata-exported.h 2009/11/01 20:05:17 1.121 +++ LVM2/lib/metadata/metadata-exported.h 2009/11/19 12:13:37 1.122 @@ -380,8 +380,6 @@ int vg_write(struct volume_group *vg); int vg_commit(struct volume_group *vg); int vg_revert(struct volume_group *vg); -struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vg_name, - const char *vgid, int *consistent); struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name, struct dm_list *mdas, uint64_t *label_sector, int warnings, int scan_label_only); @@ -472,7 +470,7 @@ force_t force); /* * vg_release() must be called on every struct volume_group allocated - * by vg_create() or vg_read_internal() to free it when no longer required. + * by vg_create() or vg_read() to free it when no longer required. */ void vg_release(struct volume_group *vg); --- LVM2/lib/metadata/metadata.c 2009/11/01 20:05:17 1.295 +++ LVM2/lib/metadata/metadata.c 2009/11/19 12:13:37 1.296 @@ -58,6 +58,10 @@ static uint32_t _vg_bad_status_bits(const struct volume_group *vg, uint32_t status); +static struct volume_group *_vg_read_internal(struct cmd_context *cmd, + const char *vgname, + const char *vgid, int *consistent); + const char _really_init[] = "Really INITIALIZE physical volume \"%s\" of volume group \"%s\" [y/n]? "; @@ -284,7 +288,7 @@ struct pv_list *pvl; int r = 0, consistent = 0; - if (!(vg = vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) { + if (!(vg = _vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) { log_error("get_pv_from_vg_by_id: vg_read_internal failed to read VG %s", vg_name); return 0; @@ -786,10 +790,10 @@ /* NOTE: let caller decide - this may be check for existence */ return _vg_make_handle(cmd, NULL, rc); - /* FIXME: Is this vg_read_internal necessary? Move it inside + /* FIXME: Is this _vg_read_internal necessary? Move it inside vg_lock_newname? */ /* is this vg name already in use ? */ - if ((vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) { + if ((vg = _vg_read_internal(cmd, vg_name, NULL, &consistent))) { log_error("A volume group called '%s' already exists.", vg_name); unlock_and_release_vg(cmd, vg, vg_name); return _vg_make_handle(cmd, NULL, FAILED_EXIST); @@ -2490,7 +2494,7 @@ if (is_orphan_vg(vgname)) { if (use_precommitted) { - log_error("Internal error: vg_read_internal requires vgname " + log_error("Internal error: _vg_read requires vgname " "with pre-commit."); return NULL; } @@ -2779,8 +2783,9 @@ return correct_vg; } -struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgname, - const char *vgid, int *consistent) +static struct volume_group *_vg_read_internal(struct cmd_context *cmd, + const char *vgname, + const char *vgid, int *consistent) { struct volume_group *vg; struct lv_list *lvl; @@ -3045,7 +3050,7 @@ stack; continue; } - if (!(vg = vg_read_internal(cmd, vgname, vgid, &consistent))) { + if (!(vg = _vg_read_internal(cmd, vgname, vgid, &consistent))) { stack; continue; } @@ -3279,7 +3284,7 @@ if (!lock_vol(cmd, lock_name, lock_flags)) return_NULL; - if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent))) + if (!(vg = _vg_read_internal(cmd, vg_name, vgid, &consistent))) return_NULL; if (!consistent) { @@ -3336,7 +3341,7 @@ consistent_in = consistent; /* If consistent == 1, we get NULL here if correction fails. */ - if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent))) { + if (!(vg = _vg_read_internal(cmd, vg_name, vgid, &consistent))) { if (consistent_in && !consistent) { log_error("Volume group \"%s\" inconsistent.", vg_name); failure |= FAILED_INCONSISTENT; From mornfall@sourceware.org Thu Nov 19 13:42:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 19 Nov 2009 13:42:00 -0000 Subject: LVM2/lib/metadata mirror.c Message-ID: <20091119134239.26005.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-19 13:42:39 Modified files: lib/metadata : mirror.c Log message: The double resume in remove_mirror_images does not happen *always*. Only call memlock_inc() when it actually does happen. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.94&r2=1.95 --- LVM2/lib/metadata/mirror.c 2009/11/19 12:09:53 1.94 +++ LVM2/lib/metadata/mirror.c 2009/11/19 13:42:38 1.95 @@ -608,21 +608,24 @@ * As it's now detached from mirrored_seg->lv we must resume it * explicitly. */ - if (lv1 && !resume_lv(lv1->vg->cmd, lv1)) { - log_error("Problem resuming temporary LV, %s", lv1->name); - return 0; - } + if (lv1) { + if (!resume_lv(lv1->vg->cmd, lv1)) { + log_error("Problem resuming temporary LV, %s", lv1->name); + return 0; + } - /* - * The code above calls a suspend_lv once, however we now need to - * resume 2 LVs, due to image removal: the mirror image itself above, - * and now the remaining mirror LV. Since suspend_lv/resume_lv call - * memlock_inc/memlock_dec and these need to be balanced, we need to - * call an extra memlock_inc() here to balance for the second resume, - * which could otherwise either deadlock due to suspended devices, or - * alternatively drop memlock_count below 0. - */ - memlock_inc(); + /* + * The code above calls a suspend_lv once, however we now need + * to resume 2 LVs, due to image removal: the mirror image + * itself here, and now the remaining mirror LV. Since + * suspend_lv/resume_lv call memlock_inc/memlock_dec and these + * need to be balanced, we need to call an extra memlock_inc() + * here to balance for the this extra resume -- the following + * one could otherwise either deadlock due to suspended + * devices, or alternatively drop memlock_count below 0. + */ + memlock_inc(); + } if (!resume_lv(mirrored_seg->lv->vg->cmd, mirrored_seg->lv)) { log_error("Problem reactivating %s", mirrored_seg->lv->name); From mornfall@sourceware.org Thu Nov 19 13:44:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 19 Nov 2009 13:44:00 -0000 Subject: LVM2/lib/metadata metadata.c Message-ID: <20091119134437.27419.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-19 13:44:37 Modified files: lib/metadata : metadata.c Log message: In case we refuse to continue due to missing PVs, print a hint about using vgreduce --removemissing to remedy the situation. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.296&r2=1.297 --- LVM2/lib/metadata/metadata.c 2009/11/19 12:13:37 1.296 +++ LVM2/lib/metadata/metadata.c 2009/11/19 13:44:37 1.297 @@ -3378,8 +3378,8 @@ if (!cmd->handles_missing_pvs && vg_missing_pv_count(vg) && (lock_flags & LCK_WRITE)) { - log_error("Cannot change VG %s while PVs are missing!", - vg->name); + log_error("Cannot change VG %s while PVs are missing.", vg->name); + log_error("Consider vgreduce --removemissing."); failure |= FAILED_INCONSISTENT; /* FIXME new failure code here? */ goto_bad; } From mornfall@sourceware.org Thu Nov 19 13:55:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 19 Nov 2009 13:55:00 -0000 Subject: LVM2/test t-snapshots-of-mirrors.sh Message-ID: <20091119135541.957.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-19 13:55:40 Added files: test : t-snapshots-of-mirrors.sh Log message: Add a basic test for snapshots of mirrors, thanks to Jon Brassow. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-snapshots-of-mirrors.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1 /cvs/lvm2/LVM2/test/t-snapshots-of-mirrors.sh,v --> standard output revision 1.1 --- LVM2/test/t-snapshots-of-mirrors.sh +++ - 2009-11-19 13:55:40.942022000 +0000 @@ -0,0 +1,35 @@ +. ./test-utils.sh + +prepare_vg 4 + +# Create snapshot of a mirror origin +lvcreate -m 1 -L 10M -n lv $vg +lvcreate -s $vg/lv -L 10M -n snap + +# Down-convert (mirror -> linear) under a snapshot +lvconvert -m0 $vg/lv + +# Up-convert (linear -> mirror) +lvconvert -m2 $vg/lv + +# Down-convert (mirror -> mirror) +lvconvert -m1 $vg/lv + +# Up-convert (mirror -> mirror) -- Not supported! +not lvconvert -m2 $vg/lv + +# Log conversion (disk -> core) +lvconvert --mirrorlog core $vg/lv + +# Log conversion (core -> redundant) -- Not available yet! +not lvconvert --mirrorlog redundant $vg/lv + +# Log conversion (redundant -> core) -- Not available yet! +# Note: Uncomment this command when the above works +# not lvconvert --mirrorlog core $vg/lv + +# Log conversion (core -> disk) +lvconvert --mirrorlog disk $vg/lv + +# Clean-up +lvremove -ff $vg From agk@sourceware.org Thu Nov 19 19:00:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 19 Nov 2009 19:00:00 -0000 Subject: LVM2 VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Message-ID: <20091119190037.23032.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-19 19:00:35 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.213&r2=1.214 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1317&r2=1.1318 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.315&r2=1.316 --- LVM2/VERSION 2009/10/27 01:13:20 1.213 +++ LVM2/VERSION 2009/11/19 19:00:34 1.214 @@ -1 +1 @@ -2.02.55(1)-cvs (2009-10-26) +2.02.55(1)-cvs (2009-11-19) --- LVM2/VERSION_DM 2009/10/27 01:13:20 1.25 +++ LVM2/VERSION_DM 2009/11/19 19:00:34 1.26 @@ -1 +1 @@ -1.02.40-cvs (2009-10-26) +1.02.40-cvs (2009-11-19) --- LVM2/WHATS_NEW 2009/11/19 01:17:01 1.1317 +++ LVM2/WHATS_NEW 2009/11/19 19:00:34 1.1318 @@ -1,5 +1,5 @@ -Version 2.02.55 - -=================================== +Version 2.02.55 - 19th November 2009 +==================================== Fix a possible deadlock in mirror code due to memlock refcount mismatch. Enable dmeventd event handlers to properly scan devices. Do not activate directly not visible volumes in vgchange. --- LVM2/WHATS_NEW_DM 2009/11/13 12:48:01 1.315 +++ LVM2/WHATS_NEW_DM 2009/11/19 19:00:34 1.316 @@ -1,5 +1,5 @@ -Version 1.02.40 - -=================================== +Version 1.02.40 - 19th November 2009 +==================================== Fix install_device-mapper Makefile target to not build dmeventd plugins. Support udev flags even when udev_sync is disabled or not compiled in. Remove 'last_rule' from udev rules: honor ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}. From agk@sourceware.org Thu Nov 19 19:42:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 19 Nov 2009 19:42:00 -0000 Subject: LVM2 WHATS_NEW WHATS_NEW_DM Message-ID: <20091119194258.326.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-19 19:42:57 Modified files: . : WHATS_NEW WHATS_NEW_DM Log message: . Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1318&r2=1.1319 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.316&r2=1.317 --- LVM2/WHATS_NEW 2009/11/19 19:00:34 1.1318 +++ LVM2/WHATS_NEW 2009/11/19 19:42:57 1.1319 @@ -1,18 +1,18 @@ Version 2.02.55 - 19th November 2009 ==================================== - Fix a possible deadlock in mirror code due to memlock refcount mismatch. - Enable dmeventd event handlers to properly scan devices. - Do not activate directly not visible volumes in vgchange. - Fix pvmove region_size oveflow for very large PVs. - Fix lvcreate and lvresize processing of %PVS argument. + Fix deadlock when changing mirrors due to unpaired memlock refcount changes. + Use separate memlock counter for dmeventd handlers to permit device scanning. + Directly restrict vgchange to activating visible LVs. + Fix pvmove region_size overflow for very large PVs. + Fix lvcreate and lvresize %PVS argument always to use sensible total size. Tidy some uses of arg_count and introduce arg_is_set. Export outnl and indent functions for modules. Flush stdout after yes/no prompt. Update vgsplit and vgcreate to use vg_set_clustered. - Add vg_mda_count and vg_set_clustered library function. + Add vg_mda_count and vg_set_clustered library functions. Add more vgcreate and vgsplit nightly tests. Insert some missing stack macros into activation code. - Recognise DRBD device part and handle it similar to MD devices. + Recognise DRBD devices and handle them like md devices. Version 2.02.54 - 26th October 2009 =================================== --- LVM2/WHATS_NEW_DM 2009/11/19 19:00:34 1.316 +++ LVM2/WHATS_NEW_DM 2009/11/19 19:42:57 1.317 @@ -2,7 +2,7 @@ ==================================== Fix install_device-mapper Makefile target to not build dmeventd plugins. Support udev flags even when udev_sync is disabled or not compiled in. - Remove 'last_rule' from udev rules: honor ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}. + Remove 'last_rule' from udev rules: honour DM_UDEV_DISABLE_OTHER_RULES_FLAG. Add dmsetup --inactive support. Add dm_task_query_inactive_table to libdevmapper for kernel driver >= 4.16. Fix hash lookup segfault when keys compared are different lengths. From agk@sourceware.org Thu Nov 19 19:53:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 19 Nov 2009 19:53:00 -0000 Subject: LVM2 VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Message-ID: <20091119195358.7693.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-19 19:53:58 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.214&r2=1.215 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.26&r2=1.27 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1319&r2=1.1320 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.317&r2=1.318 --- LVM2/VERSION 2009/11/19 19:00:34 1.214 +++ LVM2/VERSION 2009/11/19 19:53:58 1.215 @@ -1 +1 @@ -2.02.55(1)-cvs (2009-11-19) +2.02.56(1)-cvs (2009-11-19) --- LVM2/VERSION_DM 2009/11/19 19:00:34 1.26 +++ LVM2/VERSION_DM 2009/11/19 19:53:58 1.27 @@ -1 +1 @@ -1.02.40-cvs (2009-11-19) +1.02.41-cvs (2009-11-19) --- LVM2/WHATS_NEW 2009/11/19 19:42:57 1.1319 +++ LVM2/WHATS_NEW 2009/11/19 19:53:58 1.1320 @@ -1,3 +1,6 @@ +Version 2.02.56 - +==================================== + Version 2.02.55 - 19th November 2009 ==================================== Fix deadlock when changing mirrors due to unpaired memlock refcount changes. --- LVM2/WHATS_NEW_DM 2009/11/19 19:42:57 1.317 +++ LVM2/WHATS_NEW_DM 2009/11/19 19:53:58 1.318 @@ -1,3 +1,6 @@ +Version 1.02.41 - +==================================== + Version 1.02.40 - 19th November 2009 ==================================== Fix install_device-mapper Makefile target to not build dmeventd plugins. From mbroz@sourceware.org Mon Nov 23 10:44:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 23 Nov 2009 10:44:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/clvmd/lvm-functions.c ... Message-ID: <20091123104452.1396.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-23 10:44:51 Modified files: . : WHATS_NEW daemons/clvmd : lvm-functions.c lib/metadata : metadata-exported.h metadata.c Log message: Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1320&r2=1.1321 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.122&r2=1.123 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.297&r2=1.298 --- LVM2/WHATS_NEW 2009/11/19 19:53:58 1.1320 +++ LVM2/WHATS_NEW 2009/11/23 10:44:50 1.1321 @@ -1,5 +1,6 @@ Version 2.02.56 - ==================================== + Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55) Version 2.02.55 - 19th November 2009 ==================================== --- LVM2/daemons/clvmd/lvm-functions.c 2009/11/19 12:13:37 1.71 +++ LVM2/daemons/clvmd/lvm-functions.c 2009/11/23 10:44:51 1.72 @@ -774,14 +774,15 @@ void lvm_do_backup(const char *vgname) { struct volume_group * vg; + int consistent = 0; DEBUGLOG("Triggering backup of VG metadata for %s. suspended=%d\n", vgname, suspended); pthread_mutex_lock(&lvm_lock); - vg = vg_read(cmd, vgname, NULL /*vgid*/, 0 /*flags*/); + vg = vg_read_internal(cmd, vgname, NULL /*vgid*/, &consistent); - if (!vg_read_error(vg)) + if (vg && consistent) check_current_backup(vg); else log_error("Error backing up metadata, can't find VG for group %s", vgname); --- LVM2/lib/metadata/metadata-exported.h 2009/11/19 12:13:37 1.122 +++ LVM2/lib/metadata/metadata-exported.h 2009/11/23 10:44:51 1.123 @@ -380,6 +380,8 @@ int vg_write(struct volume_group *vg); int vg_commit(struct volume_group *vg); int vg_revert(struct volume_group *vg); +struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vg_name, + const char *vgid, int *consistent); struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name, struct dm_list *mdas, uint64_t *label_sector, int warnings, int scan_label_only); @@ -470,7 +472,7 @@ force_t force); /* * vg_release() must be called on every struct volume_group allocated - * by vg_create() or vg_read() to free it when no longer required. + * by vg_create() or vg_read_internal() to free it when no longer required. */ void vg_release(struct volume_group *vg); --- LVM2/lib/metadata/metadata.c 2009/11/19 13:44:37 1.297 +++ LVM2/lib/metadata/metadata.c 2009/11/23 10:44:51 1.298 @@ -58,10 +58,6 @@ static uint32_t _vg_bad_status_bits(const struct volume_group *vg, uint32_t status); -static struct volume_group *_vg_read_internal(struct cmd_context *cmd, - const char *vgname, - const char *vgid, int *consistent); - const char _really_init[] = "Really INITIALIZE physical volume \"%s\" of volume group \"%s\" [y/n]? "; @@ -288,7 +284,7 @@ struct pv_list *pvl; int r = 0, consistent = 0; - if (!(vg = _vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) { + if (!(vg = vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) { log_error("get_pv_from_vg_by_id: vg_read_internal failed to read VG %s", vg_name); return 0; @@ -790,10 +786,10 @@ /* NOTE: let caller decide - this may be check for existence */ return _vg_make_handle(cmd, NULL, rc); - /* FIXME: Is this _vg_read_internal necessary? Move it inside + /* FIXME: Is this vg_read_internal necessary? Move it inside vg_lock_newname? */ /* is this vg name already in use ? */ - if ((vg = _vg_read_internal(cmd, vg_name, NULL, &consistent))) { + if ((vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) { log_error("A volume group called '%s' already exists.", vg_name); unlock_and_release_vg(cmd, vg, vg_name); return _vg_make_handle(cmd, NULL, FAILED_EXIST); @@ -2494,7 +2490,7 @@ if (is_orphan_vg(vgname)) { if (use_precommitted) { - log_error("Internal error: _vg_read requires vgname " + log_error("Internal error: vg_read_internal requires vgname " "with pre-commit."); return NULL; } @@ -2783,9 +2779,8 @@ return correct_vg; } -static struct volume_group *_vg_read_internal(struct cmd_context *cmd, - const char *vgname, - const char *vgid, int *consistent) +struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgname, + const char *vgid, int *consistent) { struct volume_group *vg; struct lv_list *lvl; @@ -3050,7 +3045,7 @@ stack; continue; } - if (!(vg = _vg_read_internal(cmd, vgname, vgid, &consistent))) { + if (!(vg = vg_read_internal(cmd, vgname, vgid, &consistent))) { stack; continue; } @@ -3284,7 +3279,7 @@ if (!lock_vol(cmd, lock_name, lock_flags)) return_NULL; - if (!(vg = _vg_read_internal(cmd, vg_name, vgid, &consistent))) + if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent))) return_NULL; if (!consistent) { @@ -3341,7 +3336,7 @@ consistent_in = consistent; /* If consistent == 1, we get NULL here if correction fails. */ - if (!(vg = _vg_read_internal(cmd, vg_name, vgid, &consistent))) { + if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent))) { if (consistent_in && !consistent) { log_error("Volume group \"%s\" inconsistent.", vg_name); failure |= FAILED_INCONSISTENT; From mbroz@sourceware.org Mon Nov 23 10:55:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 23 Nov 2009 10:55:00 -0000 Subject: LVM2 ./WHATS_NEW lib/locking/locking.c Message-ID: <20091123105514.5325.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-23 10:55:14 Modified files: . : WHATS_NEW lib/locking : locking.c Log message: Fix memory lock imbalance in locking code. (This affects only cluster locking because only cluster locking module set LCK_PRE_MEMLOCK.) With currect code you get # vgchange -a n Internal error: _memlock_count has dropped below 0. when using cluster locking. It is caused by _unlock_memory calls here if ((flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK)) == LCK_LV_RESUME) memlock_dec(); Unfortunately it is also (wrongly) called in immediate unlock (when LCK_HOLD is not set) from lock_vol (LCK_UNLOCK is misinterpreted as LCK_LV_RESUME). Avoid this by comparing original flags and provide memlock code type of operation (suspend/resume). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1321&r2=1.1322 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.66&r2=1.67 --- LVM2/WHATS_NEW 2009/11/23 10:44:50 1.1321 +++ LVM2/WHATS_NEW 2009/11/23 10:55:14 1.1322 @@ -1,5 +1,6 @@ Version 2.02.56 - ==================================== + Fix memory lock imbalance in locking code. Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55) Version 2.02.55 - 19th November 2009 --- LVM2/lib/locking/locking.c 2009/09/14 22:47:49 1.66 +++ LVM2/lib/locking/locking.c 2009/11/23 10:55:14 1.67 @@ -42,6 +42,12 @@ static struct sigaction _oldhandler; static int _oldmasked; +typedef enum { + LV_NOOP, + LV_SUSPEND, + LV_RESUME +} lv_operation_t; + static void _catch_sigint(int unused __attribute__((unused))) { _sigint_caught = 1; @@ -159,21 +165,21 @@ return; } -static void _lock_memory(uint32_t flags) +static void _lock_memory(lv_operation_t lv_op) { if (!(_locking.flags & LCK_PRE_MEMLOCK)) return; - if ((flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK)) == LCK_LV_SUSPEND) + if (lv_op == LV_SUSPEND) memlock_inc(); } -static void _unlock_memory(uint32_t flags) +static void _unlock_memory(lv_operation_t lv_op) { if (!(_locking.flags & LCK_PRE_MEMLOCK)) return; - if ((flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK)) == LCK_LV_RESUME) + if (lv_op == LV_RESUME) memlock_dec(); } @@ -336,12 +342,13 @@ * VG locking is by VG name. * FIXME This should become VG uuid. */ -static int _lock_vol(struct cmd_context *cmd, const char *resource, uint32_t flags) +static int _lock_vol(struct cmd_context *cmd, const char *resource, + uint32_t flags, lv_operation_t lv_op) { int ret = 0; _block_signals(flags); - _lock_memory(flags); + _lock_memory(lv_op); assert(resource); @@ -368,7 +375,7 @@ _update_vg_lock_count(resource, flags); } - _unlock_memory(flags); + _unlock_memory(lv_op); _unblock_signals(); return ret; @@ -377,6 +384,18 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags) { char resource[258] __attribute((aligned(8))); + lv_operation_t lv_op; + + switch (flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK)) { + case LCK_LV_SUSPEND: + lv_op = LV_SUSPEND; + break; + case LCK_LV_RESUME: + lv_op = LV_RESUME; + break; + default: lv_op = LV_NOOP; + } + if (flags == LCK_NONE) { log_debug("Internal error: %s: LCK_NONE lock requested", vol); @@ -416,7 +435,7 @@ strncpy(resource, vol, sizeof(resource)); - if (!_lock_vol(cmd, resource, flags)) + if (!_lock_vol(cmd, resource, flags, lv_op)) return 0; /* @@ -426,7 +445,7 @@ if (!(flags & LCK_CACHE) && !(flags & LCK_HOLD) && ((flags & LCK_TYPE_MASK) != LCK_UNLOCK)) { if (!_lock_vol(cmd, resource, - (flags & ~LCK_TYPE_MASK) | LCK_UNLOCK)) + (flags & ~LCK_TYPE_MASK) | LCK_UNLOCK, lv_op)) return 0; } From mbroz@sourceware.org Tue Nov 24 16:08:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 24 Nov 2009 16:08:00 -0000 Subject: LVM2 ./WHATS_NEW tools/vgchange.c Message-ID: <20091124160850.22066.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-24 16:08:49 Modified files: . : WHATS_NEW tools : vgchange.c Log message: Return error status if vgchange fails to activate some volume. (on one node a storage connection failed): # vgchange -a y vg_bar ; echo $? Error locking on node bar-02: Refusing activation of partial LV lv1. Use --partial to override. 1 logical volume(s) in volume group "vg_bar" now active 0 So activation fails on one node, error is correctly printed but status code is wrong. This patch fixes the top level (vgchange) to return proper code (and print # of activated LVs). (lvchange returns error properly here.) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1322&r2=1.1323 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91 --- LVM2/WHATS_NEW 2009/11/23 10:55:14 1.1322 +++ LVM2/WHATS_NEW 2009/11/24 16:08:49 1.1323 @@ -1,5 +1,6 @@ Version 2.02.56 - ==================================== + Return error status if vgchange fails to activate some volume. Fix memory lock imbalance in locking code. Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55) --- LVM2/tools/vgchange.c 2009/11/18 17:20:18 1.90 +++ LVM2/tools/vgchange.c 2009/11/24 16:08:49 1.91 @@ -56,7 +56,7 @@ { struct lv_list *lvl; struct logical_volume *lv; - int count = 0; + int count = 0, expected_count = 0; dm_list_iterate_items(lvl, &vg->lvs) { lv = lvl->lv; @@ -78,6 +78,8 @@ ((lv->status & PVMOVE) )) continue; + expected_count++; + if (activate == CHANGE_AN) { if (!deactivate_lv(cmd, lv)) continue; @@ -100,7 +102,12 @@ count++; } - return count; + if (expected_count) + log_verbose("%s %d logical volumes in volume group %s", + activate ? "Activated" : "Deactivated", + count, vg->name); + + return (expected_count != count) ? ECMD_FAILED : ECMD_PROCESSED; } static int _vgchange_monitoring(struct cmd_context *cmd, struct volume_group *vg) @@ -121,7 +128,7 @@ static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg) { int lv_open, active, monitored; - int available; + int available, ret; int activate = 1; /* @@ -158,17 +165,11 @@ } } - if (activate && _activate_lvs_in_vg(cmd, vg, available)) - log_verbose("Activated logical volumes in " - "volume group \"%s\"", vg->name); - - if (!activate && _activate_lvs_in_vg(cmd, vg, available)) - log_verbose("Deactivated logical volumes in " - "volume group \"%s\"", vg->name); + ret = _activate_lvs_in_vg(cmd, vg, available); log_print("%d logical volume(s) in volume group \"%s\" now active", lvs_in_vg_activated(vg), vg->name); - return ECMD_PROCESSED; + return ret; } static int _vgchange_alloc(struct cmd_context *cmd, struct volume_group *vg) From mbroz@sourceware.org Tue Nov 24 16:10:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 24 Nov 2009 16:10:00 -0000 Subject: LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm ... Message-ID: <20091124161027.22448.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-24 16:10:26 Modified files: . : WHATS_NEW lib/cache : lvmcache.c lib/commands : toolcontext.c toolcontext.h Log message: Refresh device filters before full device rescan in lvmcache. The sysfs filter initialise hash of available devices using scan of /sys/block. We need to refresh even this hash when performing full scan otherwise the newly appeared device could be rejected, because there is no entry in sysfs filter. This easily could happen when attaching new device to cluster node. (Only force refresh of context in clvmd -R works here now). Unfortunately consequences of this are much worse, missing device part on that node is replaced with missing segment (even when no partial arg is selected) and this directly lead to data corruption. See https://bugzilla.redhat.com/show_bug.cgi?id=538515 Simply fix it by refreshing device filters in lvmcache before performing the full device scan. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1323&r2=1.1324 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.86&r2=1.87 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.h.diff?cvsroot=lvm2&r1=1.35&r2=1.36 --- LVM2/WHATS_NEW 2009/11/24 16:08:49 1.1323 +++ LVM2/WHATS_NEW 2009/11/24 16:10:25 1.1324 @@ -1,5 +1,6 @@ Version 2.02.56 - ==================================== + Refresh device filters before full device rescan in lvmcache. Return error status if vgchange fails to activate some volume. Fix memory lock imbalance in locking code. Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55) --- LVM2/lib/cache/lvmcache.c 2009/10/27 17:00:46 1.71 +++ LVM2/lib/cache/lvmcache.c 2009/11/24 16:10:25 1.72 @@ -510,6 +510,11 @@ goto out; } + if (full_scan == 2 && !refresh_filters(cmd)) { + log_error("refresh filters failed"); + goto out; + } + if (!(iter = dev_iter_create(cmd->filter, (full_scan == 2) ? 1 : 0))) { log_error("dev_iter creation failed"); goto out; --- LVM2/lib/commands/toolcontext.c 2009/10/16 17:41:50 1.86 +++ LVM2/lib/commands/toolcontext.c 2009/11/24 16:10:26 1.87 @@ -1223,6 +1223,16 @@ } } +int refresh_filters(struct cmd_context *cmd) +{ + if (cmd->filter) { + cmd->filter->destroy(cmd->filter); + cmd->filter = NULL; + } + + return _init_filters(cmd, 0); +} + int refresh_toolcontext(struct cmd_context *cmd) { log_verbose("Reloading config files"); --- LVM2/lib/commands/toolcontext.h 2009/10/16 17:41:50 1.35 +++ LVM2/lib/commands/toolcontext.h 2009/11/24 16:10:26 1.36 @@ -105,6 +105,7 @@ const char *system_dir); void destroy_toolcontext(struct cmd_context *cmd); int refresh_toolcontext(struct cmd_context *cmd); +int refresh_filters(struct cmd_context *cmd); int config_files_changed(struct cmd_context *cmd); int init_lvmcache_orphans(struct cmd_context *cmd); From mbroz@sourceware.org Tue Nov 24 16:11:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 24 Nov 2009 16:11:00 -0000 Subject: LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm ... Message-ID: <20091124161139.22924.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-24 16:11:38 Modified files: . : WHATS_NEW lib/cache : lvmcache.c lib/commands : toolcontext.c Log message: Move persistent filter dump to more appropriate place. After context_refresh is cache empty, the cache flush does nothing. Call it after lvmcache full rescan if running from log lived process. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1324&r2=1.1325 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88 --- LVM2/WHATS_NEW 2009/11/24 16:10:25 1.1324 +++ LVM2/WHATS_NEW 2009/11/24 16:11:37 1.1325 @@ -1,5 +1,6 @@ Version 2.02.56 - ==================================== + Move persistent filter dump to more appropriate place. Refresh device filters before full device rescan in lvmcache. Return error status if vgchange fails to activate some volume. Fix memory lock imbalance in locking code. --- LVM2/lib/cache/lvmcache.c 2009/11/24 16:10:25 1.72 +++ LVM2/lib/cache/lvmcache.c 2009/11/24 16:11:37 1.73 @@ -20,6 +20,7 @@ #include "locking.h" #include "metadata.h" #include "filter.h" +#include "filter-persistent.h" #include "memlock.h" #include "str_list.h" #include "format-text.h" @@ -533,6 +534,13 @@ goto out; } + /* + * If we are a long-lived process, write out the updated persistent + * device cache for the benefit of short-lived processes. + */ + if (full_scan == 2 && cmd->is_long_lived && cmd->dump_filter) + persistent_filter_dump(cmd->filter); + r = 1; out: --- LVM2/lib/commands/toolcontext.c 2009/11/24 16:10:26 1.87 +++ LVM2/lib/commands/toolcontext.c 2009/11/24 16:11:38 1.88 @@ -1291,13 +1291,6 @@ if (!_init_segtypes(cmd)) return 0; - /* - * If we are a long-lived process, write out the updated persistent - * device cache for the benefit of short-lived processes. - */ - if (cmd->is_long_lived && cmd->dump_filter) - persistent_filter_dump(cmd->filter); - cmd->config_valid = 1; reset_lvm_errno(1); From mbroz@sourceware.org Tue Nov 24 16:13:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 24 Nov 2009 16:13:00 -0000 Subject: LVM2 ./WHATS_NEW tools/toollib.c Message-ID: <20091124161304.24066.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-24 16:13:03 Modified files: . : WHATS_NEW tools : toollib.c Log message: Do not try to unlock VG which is not locked. If the vg_read() returned error, no lock was taken, so always call vg_release(). Otherwise this can happen because of missing FAILED_*: # vgchange -a y x --ignorelockingfailure Volume group "x" not found Internal error: Attempt to unlock unlocked VG x Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1325&r2=1.1326 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.178&r2=1.179 --- LVM2/WHATS_NEW 2009/11/24 16:11:37 1.1325 +++ LVM2/WHATS_NEW 2009/11/24 16:13:02 1.1326 @@ -1,5 +1,6 @@ Version 2.02.56 - ==================================== + Do not try to unlock VG which is not locked in _process_one_vg. Move persistent filter dump to more appropriate place. Refresh device filters before full device rescan in lvmcache. Return error status if vgchange fails to activate some volume. --- LVM2/tools/toollib.c 2009/11/01 20:03:24 1.178 +++ LVM2/tools/toollib.c 2009/11/24 16:13:03 1.179 @@ -452,8 +452,7 @@ ret_max = ret; out: - if ((vg_read_error(vg) == FAILED_ALLOCATION)|| - (vg_read_error(vg) == FAILED_LOCKING)) + if (vg_read_error(vg)) vg_release(vg); else unlock_and_release_vg(cmd, vg, vg_name); From mbroz@sourceware.org Tue Nov 24 17:07:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 24 Nov 2009 17:07:00 -0000 Subject: LVM2 ./WHATS_NEW tools/pvdisplay.c tools/repor ... Message-ID: <20091124170710.13545.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-24 17:07:09 Modified files: . : WHATS_NEW tools : pvdisplay.c reporter.c Log message: Add missing vg_release to pvs and pvdisplay to fix memory leak. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1326&r2=1.1327 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvdisplay.c.diff?cvsroot=lvm2&r1=1.53&r2=1.54 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.57&r2=1.58 --- LVM2/WHATS_NEW 2009/11/24 16:13:02 1.1326 +++ LVM2/WHATS_NEW 2009/11/24 17:07:09 1.1327 @@ -1,5 +1,6 @@ Version 2.02.56 - ==================================== + Add missing vg_release to pvs and pvdisplay to fix memory leak. Do not try to unlock VG which is not locked in _process_one_vg. Move persistent filter dump to more appropriate place. Refresh device filters before full device rescan in lvmcache. --- LVM2/tools/pvdisplay.c 2009/07/15 05:50:22 1.53 +++ LVM2/tools/pvdisplay.c 2009/11/24 17:07:09 1.54 @@ -31,10 +31,11 @@ vg_name = pv_vg_name(pv); vg = vg_read(cmd, vg_name, (char *)&pv->vgid, 0); if (vg_read_error(vg)) { - log_error("Skipping volume group %s", vg_name); + log_error("Skipping volume group %s", vg_name); + vg_release(vg); /* FIXME If CLUSTERED should return ECMD_PROCESSED here */ - return ECMD_FAILED; - } + return ECMD_FAILED; + } /* * Replace possibly incomplete PV structure with new one --- LVM2/tools/reporter.c 2009/11/03 15:50:44 1.57 +++ LVM2/tools/reporter.c 2009/11/24 17:07:09 1.58 @@ -143,6 +143,7 @@ vg = vg_read(cmd, vg_name, (char *)&pv->vgid, 0); if (vg_read_error(vg)) { log_error("Skipping volume group %s", vg_name); + vg_release(vg); return ECMD_FAILED; } From agk@sourceware.org Tue Nov 24 18:26:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 24 Nov 2009 18:26:00 -0000 Subject: LVM2 VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Message-ID: <20091124182609.2560.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-24 18:26:09 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.215&r2=1.216 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.27&r2=1.28 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1327&r2=1.1328 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.318&r2=1.319 --- LVM2/VERSION 2009/11/19 19:53:58 1.215 +++ LVM2/VERSION 2009/11/24 18:26:08 1.216 @@ -1 +1 @@ -2.02.56(1)-cvs (2009-11-19) +2.02.56(1)-cvs (2009-11-24) --- LVM2/VERSION_DM 2009/11/19 19:53:58 1.27 +++ LVM2/VERSION_DM 2009/11/24 18:26:08 1.28 @@ -1 +1 @@ -1.02.41-cvs (2009-11-19) +1.02.40-cvs (2009-11-24) --- LVM2/WHATS_NEW 2009/11/24 17:07:09 1.1327 +++ LVM2/WHATS_NEW 2009/11/24 18:26:08 1.1328 @@ -1,4 +1,4 @@ -Version 2.02.56 - +Version 2.02.56 - 24th November 2009 ==================================== Add missing vg_release to pvs and pvdisplay to fix memory leak. Do not try to unlock VG which is not locked in _process_one_vg. --- LVM2/WHATS_NEW_DM 2009/11/19 19:53:58 1.318 +++ LVM2/WHATS_NEW_DM 2009/11/24 18:26:08 1.319 @@ -1,6 +1,3 @@ -Version 1.02.41 - -==================================== - Version 1.02.40 - 19th November 2009 ==================================== Fix install_device-mapper Makefile target to not build dmeventd plugins. From agk@sourceware.org Tue Nov 24 18:54:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 24 Nov 2009 18:54:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20091124185424.13606.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-24 18:54:23 Modified files: . : WHATS_NEW Log message: . Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1328&r2=1.1329 --- LVM2/WHATS_NEW 2009/11/24 18:26:08 1.1328 +++ LVM2/WHATS_NEW 2009/11/24 18:54:23 1.1329 @@ -2,11 +2,11 @@ ==================================== Add missing vg_release to pvs and pvdisplay to fix memory leak. Do not try to unlock VG which is not locked in _process_one_vg. - Move persistent filter dump to more appropriate place. + Move is_long_lived persistent_filter_dump to happen after every full scan. Refresh device filters before full device rescan in lvmcache. Return error status if vgchange fails to activate some volume. - Fix memory lock imbalance in locking code. - Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55) + Fix suspend/resume lock type test causing unbalanced memory locking. + Revert vg_read_internal change as clvmd was not ready for vg_read. (2.02.55) Version 2.02.55 - 19th November 2009 ==================================== From agk@sourceware.org Tue Nov 24 19:04:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 24 Nov 2009 19:04:00 -0000 Subject: LVM2 VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Message-ID: <20091124190424.5154.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-24 19:04:23 Modified files: . : VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Log message: Post-release. Fingers crossed this one's more successful that the last one! Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.216&r2=1.217 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1329&r2=1.1330 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.319&r2=1.320 --- LVM2/VERSION 2009/11/24 18:26:08 1.216 +++ LVM2/VERSION 2009/11/24 19:04:23 1.217 @@ -1 +1 @@ -2.02.56(1)-cvs (2009-11-24) +2.02.57(1)-cvs (2009-11-24) --- LVM2/VERSION_DM 2009/11/24 18:26:08 1.28 +++ LVM2/VERSION_DM 2009/11/24 19:04:23 1.29 @@ -1 +1 @@ -1.02.40-cvs (2009-11-24) +1.02.41-cvs (2009-11-24) --- LVM2/WHATS_NEW 2009/11/24 18:54:23 1.1329 +++ LVM2/WHATS_NEW 2009/11/24 19:04:23 1.1330 @@ -1,3 +1,6 @@ +Version 2.02.57 - +==================================== + Version 2.02.56 - 24th November 2009 ==================================== Add missing vg_release to pvs and pvdisplay to fix memory leak. --- LVM2/WHATS_NEW_DM 2009/11/24 18:26:08 1.319 +++ LVM2/WHATS_NEW_DM 2009/11/24 19:04:23 1.320 @@ -1,3 +1,6 @@ +Version 1.02.41 - +==================================== + Version 1.02.40 - 19th November 2009 ==================================== Fix install_device-mapper Makefile target to not build dmeventd plugins. From snitzer@sourceware.org Tue Nov 24 22:56:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Tue, 24 Nov 2009 22:56:00 -0000 Subject: LVM2 ./WHATS_NEW lib/display/display.c lib/for ... Message-ID: <20091124225559.11196.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-11-24 22:55:56 Modified files: . : WHATS_NEW lib/display : display.c lib/format_text: export.c flags.c format-text.c format-text.h import-export.h import.c import_vsn1.c text_label.c lib/metadata : lv_alloc.h lv_manip.c metadata-exported.h metadata.c mirror.c Log message: Switch status from 32-bit to 64-bit The physical_volume, volume_group, logical_volume and lv_segment structures' 'status' member is now uint64_t. The alignment of these structures was also audited to remove holes. The movement of some members in 'volume_group' and 'lv_segment' eliminates holes. The 'physical_volume' structure still has one 4-byte hole after 'pe_size'; the other structures no longer have any holes. Each structures' size has not changed. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1330&r2=1.1331 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.107&r2=1.108 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/export.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/flags.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.115&r2=1.116 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.h.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import-export.h.diff?cvsroot=lvm2&r1=1.22&r2=1.23 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/text_label.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_alloc.h.diff?cvsroot=lvm2&r1=1.23&r2=1.24 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.185&r2=1.186 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.123&r2=1.124 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.298&r2=1.299 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.95&r2=1.96 --- LVM2/WHATS_NEW 2009/11/24 19:04:23 1.1330 +++ LVM2/WHATS_NEW 2009/11/24 22:55:55 1.1331 @@ -1,5 +1,6 @@ Version 2.02.57 - ==================================== + Switch status from 32-bit to 64-bit. Version 2.02.56 - 24th November 2009 ==================================== --- LVM2/lib/display/display.c 2009/11/03 10:50:57 1.107 +++ LVM2/lib/display/display.c 2009/11/24 22:55:56 1.108 @@ -317,7 +317,7 @@ return; } - log_print("%s:%s:%" PRIu64 ":-1:%u:%u:-1:%" PRIu32 ":%u:%u:%u:%s", + log_print("%s:%s:%" PRIu64 ":-1:%" PRIu64 ":%" PRIu64 ":-1:%" PRIu32 ":%u:%u:%u:%s", pv_dev_name(pv), pv->vg_name, pv->size, /* FIXME pv->pv_number, Derive or remove? */ pv->status, /* FIXME Support old or new format here? */ @@ -459,7 +459,7 @@ struct lvinfo info; inkernel = lv_info(lv->vg->cmd, lv, &info, 1, 0) && info.exists; - log_print("%s%s/%s:%s:%d:%d:-1:%d:%" PRIu64 ":%d:-1:%d:%d:%d:%d", + log_print("%s%s/%s:%s:%" PRIu64 ":%d:-1:%d:%" PRIu64 ":%d:-1:%d:%d:%d:%d", lv->vg->cmd->dev_dir, lv->vg->name, lv->name, @@ -760,7 +760,7 @@ return; } - log_print("%s:%s:%d:-1:%u:%u:%u:-1:%u:%u:%u:%" PRIu64 ":%" PRIu32 + log_print("%s:%s:%" PRIu64 ":-1:%u:%u:%u:-1:%u:%u:%u:%" PRIu64 ":%" PRIu32 ":%u:%u:%u:%s", vg->name, access_str, --- LVM2/lib/format_text/export.c 2009/11/03 11:00:46 1.71 +++ LVM2/lib/format_text/export.c 2009/11/24 22:55:56 1.72 @@ -349,7 +349,7 @@ return 1; } -static int _print_flag_config(struct formatter *f, int status, int type) +static int _print_flag_config(struct formatter *f, uint64_t status, int type) { char buffer[4096]; if (!print_flags(status, type | STATUS_FLAG, buffer, sizeof(buffer))) --- LVM2/lib/format_text/flags.c 2009/07/15 20:02:47 1.37 +++ LVM2/lib/format_text/flags.c 2009/11/24 22:55:56 1.38 @@ -23,7 +23,7 @@ * converted into arrays of strings. */ struct flag { - const int mask; + const uint64_t mask; const char *description; int kind; }; @@ -91,7 +91,7 @@ * using one of the tables defined at the top of * the file. */ -int print_flags(uint32_t status, int type, char *buffer, size_t size) +int print_flags(uint64_t status, int type, char *buffer, size_t size) { int f, first = 1; struct flag *flags; @@ -135,10 +135,10 @@ return 1; } -int read_flags(uint32_t *status, int type, struct config_value *cv) +int read_flags(uint64_t *status, int type, struct config_value *cv) { int f; - uint32_t s = 0; + uint64_t s = UINT64_C(0); struct flag *flags; if (!(flags = _get_flags(type))) --- LVM2/lib/format_text/format-text.c 2009/08/01 17:07:37 1.115 +++ LVM2/lib/format_text/format-text.c 2009/11/24 22:55:56 1.116 @@ -1037,7 +1037,7 @@ const char *vgname_from_mda(const struct format_type *fmt, struct device_area *dev_area, struct id *vgid, - uint32_t *vgstatus, char **creation_host, + uint64_t *vgstatus, char **creation_host, uint64_t *mda_free_sectors) { struct raw_locn *rlocn; @@ -1146,7 +1146,7 @@ struct volume_group *vg; struct format_instance fid; struct id vgid; - uint32_t vgstatus; + uint64_t vgstatus; raw_list = &((struct mda_lists *) fmt->private)->raws; --- LVM2/lib/format_text/format-text.h 2008/11/03 22:14:28 1.25 +++ LVM2/lib/format_text/format-text.h 2009/11/24 22:55:56 1.26 @@ -61,7 +61,7 @@ const char *vgname_from_mda(const struct format_type *fmt, struct device_area *dev_area, struct id *vgid, - uint32_t *vgstatus, char **creation_host, + uint64_t *vgstatus, char **creation_host, uint64_t *mda_free_sectors); #endif --- LVM2/lib/format_text/import-export.h 2008/11/03 22:14:28 1.22 +++ LVM2/lib/format_text/import-export.h 2009/11/24 22:55:56 1.23 @@ -51,14 +51,14 @@ time_t *when, char **desc); const char *(*read_vgname) (const struct format_type *fmt, struct config_tree *cft, - struct id *vgid, uint32_t *vgstatus, + struct id *vgid, uint64_t *vgstatus, char **creation_host); }; struct text_vg_version_ops *text_vg_vsn1_init(void); -int print_flags(uint32_t status, int type, char *buffer, size_t size); -int read_flags(uint32_t *status, int type, struct config_value *cv); +int print_flags(uint64_t status, int type, char *buffer, size_t size); +int read_flags(uint64_t *status, int type, struct config_value *cv); int print_tags(struct dm_list *tags, char *buffer, size_t size); int read_tags(struct dm_pool *mem, struct dm_list *tags, struct config_value *cv); @@ -81,7 +81,7 @@ off_t offset, uint32_t size, off_t offset2, uint32_t size2, checksum_fn_t checksum_fn, uint32_t checksum, - struct id *vgid, uint32_t *vgstatus, + struct id *vgid, uint64_t *vgstatus, char **creation_host); #endif --- LVM2/lib/format_text/import.c 2008/04/01 22:40:12 1.47 +++ LVM2/lib/format_text/import.c 2009/11/24 22:55:56 1.48 @@ -40,7 +40,7 @@ off_t offset, uint32_t size, off_t offset2, uint32_t size2, checksum_fn_t checksum_fn, uint32_t checksum, - struct id *vgid, uint32_t *vgstatus, + struct id *vgid, uint64_t *vgstatus, char **creation_host) { struct config_tree *cft; --- LVM2/lib/format_text/import_vsn1.c 2009/09/28 17:46:16 1.65 +++ LVM2/lib/format_text/import_vsn1.c 2009/11/24 22:55:56 1.66 @@ -125,7 +125,7 @@ return 1; } -static int _read_flag_config(struct config_node *n, uint32_t *status, int type) +static int _read_flag_config(struct config_node *n, uint64_t *status, int type) { struct config_node *cn; *status = 0; @@ -809,7 +809,7 @@ static const char *_read_vgname(const struct format_type *fmt, struct config_tree *cft, struct id *vgid, - uint32_t *vgstatus, char **creation_host) + uint64_t *vgstatus, char **creation_host) { struct config_node *vgn; struct dm_pool *mem = fmt->cmd->mem; --- LVM2/lib/format_text/text_label.c 2009/07/15 20:02:47 1.25 +++ LVM2/lib/format_text/text_label.c 2009/11/24 22:55:56 1.26 @@ -259,7 +259,7 @@ struct id vgid; struct mda_context *mdac; const char *vgname; - uint32_t vgstatus; + uint64_t vgstatus; char *creation_host; pvhdr = (struct pv_header *) ((void *) buf + xlate32(lh->offset_xl)); --- LVM2/lib/metadata/lv_alloc.h 2008/12/19 15:24:53 1.23 +++ LVM2/lib/metadata/lv_alloc.h 2009/11/24 22:55:56 1.24 @@ -19,7 +19,7 @@ const struct segment_type *segtype, struct logical_volume *lv, uint32_t le, uint32_t len, - uint32_t status, + uint64_t status, uint32_t stripe_size, struct logical_volume *log_lv, uint32_t area_count, @@ -29,7 +29,7 @@ uint32_t extents_copied); struct lv_segment *alloc_snapshot_seg(struct logical_volume *lv, - uint32_t status, uint32_t old_le_count); + uint64_t status, uint32_t old_le_count); int set_lv_segment_area_pv(struct lv_segment *seg, uint32_t area_num, struct physical_volume *pv, uint32_t pe); @@ -57,7 +57,7 @@ struct logical_volume *lv, const struct segment_type *segtype, uint32_t stripe_size, - uint32_t status, + uint64_t status, uint32_t region_size, struct logical_volume *log_lv); @@ -67,10 +67,10 @@ int lv_add_mirror_lvs(struct logical_volume *lv, struct logical_volume **sub_lvs, uint32_t num_extra_areas, - uint32_t status, uint32_t region_size); + uint64_t status, uint32_t region_size); int lv_add_log_segment(struct alloc_handle *ah, struct logical_volume *log_lv); -int lv_add_virtual_segment(struct logical_volume *lv, uint32_t status, +int lv_add_virtual_segment(struct logical_volume *lv, uint64_t status, uint32_t extents, const struct segment_type *segtype); void alloc_destroy(struct alloc_handle *ah); --- LVM2/lib/metadata/lv_manip.c 2009/10/26 10:01:57 1.185 +++ LVM2/lib/metadata/lv_manip.c 2009/11/24 22:55:56 1.186 @@ -167,7 +167,7 @@ const struct segment_type *segtype, struct logical_volume *lv, uint32_t le, uint32_t len, - uint32_t status, + uint64_t status, uint32_t stripe_size, struct logical_volume *log_lv, uint32_t area_count, @@ -213,7 +213,7 @@ } struct lv_segment *alloc_snapshot_seg(struct logical_volume *lv, - uint32_t status, uint32_t old_le_count) + uint64_t status, uint32_t old_le_count) { struct lv_segment *seg; const struct segment_type *segtype; @@ -639,7 +639,7 @@ return 1; } -static int _setup_alloced_segment(struct logical_volume *lv, uint32_t status, +static int _setup_alloced_segment(struct logical_volume *lv, uint64_t status, uint32_t area_count, uint32_t stripe_size, const struct segment_type *segtype, @@ -682,7 +682,7 @@ static int _setup_alloced_segments(struct logical_volume *lv, struct dm_list *alloced_areas, uint32_t area_count, - uint32_t status, + uint64_t status, uint32_t stripe_size, const struct segment_type *segtype, uint32_t region_size, @@ -1278,7 +1278,7 @@ return r; } -int lv_add_virtual_segment(struct logical_volume *lv, uint32_t status, +int lv_add_virtual_segment(struct logical_volume *lv, uint64_t status, uint32_t extents, const struct segment_type *segtype) { struct lv_segment *seg; @@ -1355,7 +1355,7 @@ struct logical_volume *lv, const struct segment_type *segtype, uint32_t stripe_size, - uint32_t status, + uint64_t status, uint32_t region_size, struct logical_volume *log_lv) { @@ -1495,7 +1495,7 @@ int lv_add_mirror_lvs(struct logical_volume *lv, struct logical_volume **sub_lvs, uint32_t num_extra_areas, - uint32_t status, uint32_t region_size) + uint64_t status, uint32_t region_size) { struct lv_segment *seg; uint32_t old_area_count, new_area_count; @@ -1620,7 +1620,7 @@ uint32_t mirrors, uint32_t extents, struct physical_volume *mirrored_pv __attribute((unused)), uint32_t mirrored_pe __attribute((unused)), - uint32_t status, struct dm_list *allocatable_pvs, + uint64_t status, struct dm_list *allocatable_pvs, alloc_policy_t alloc) { int r = 1; @@ -1885,7 +1885,7 @@ */ struct logical_volume *lv_create_empty(const char *name, union lvid *lvid, - uint32_t status, + uint64_t status, alloc_policy_t alloc, struct volume_group *vg) { @@ -2266,7 +2266,7 @@ int remove_layers_for_segments(struct cmd_context *cmd, struct logical_volume *lv, struct logical_volume *layer_lv, - uint32_t status_mask, struct dm_list *lvs_changed) + uint64_t status_mask, struct dm_list *lvs_changed) { struct lv_segment *seg, *lseg; uint32_t s; @@ -2298,7 +2298,7 @@ } if ((lseg->status & status_mask) != status_mask) { log_error("Layer status does not match: " - "%s:%" PRIu32 " status: 0x%x/0x%x", + "%s:%" PRIu32 " status: 0x%" PRIx64 "/0x%" PRIx64, layer_lv->name, lseg->le, lseg->status, status_mask); return 0; @@ -2347,7 +2347,7 @@ /* Remove a layer */ int remove_layers_for_segments_all(struct cmd_context *cmd, struct logical_volume *layer_lv, - uint32_t status_mask, + uint64_t status_mask, struct dm_list *lvs_changed) { struct lv_list *lvl; @@ -2372,7 +2372,7 @@ static int _move_lv_segments(struct logical_volume *lv_to, struct logical_volume *lv_from, - uint32_t set_status, uint32_t reset_status) + uint64_t set_status, uint64_t reset_status) { struct lv_segment *seg; @@ -2454,7 +2454,7 @@ */ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd, struct logical_volume *lv_where, - uint32_t status, + uint64_t status, const char *layer_suffix) { struct logical_volume *layer_lv; @@ -2543,7 +2543,7 @@ */ static int _extend_layer_lv_for_segment(struct logical_volume *layer_lv, struct lv_segment *seg, uint32_t s, - uint32_t status) + uint64_t status) { struct lv_segment *mapseg; struct segment_type *segtype; @@ -2690,7 +2690,7 @@ int insert_layer_for_segments_on_pv(struct cmd_context *cmd, struct logical_volume *lv_where, struct logical_volume *layer_lv, - uint32_t status, + uint64_t status, struct pv_list *pvl, struct dm_list *lvs_changed) { @@ -2833,7 +2833,7 @@ { struct cmd_context *cmd = vg->cmd; uint32_t size_rest; - uint32_t status = 0; + uint64_t status = UINT64_C(0); struct logical_volume *lv, *org = NULL; int origin_active = 0; char lv_name_buf[128]; --- LVM2/lib/metadata/metadata-exported.h 2009/11/23 10:44:51 1.123 +++ LVM2/lib/metadata/metadata-exported.h 2009/11/24 22:55:56 1.124 @@ -181,7 +181,7 @@ const char *vg_name; struct id vgid; - uint32_t status; + uint64_t status; uint64_t size; /* physical extents */ @@ -208,13 +208,13 @@ struct format_instance *fid; uint32_t seqno; /* Metadata sequence number */ + alloc_policy_t alloc; + uint64_t status; + struct id id; char *name; char *system_id; - uint32_t status; - alloc_policy_t alloc; - uint32_t extent_size; uint32_t extent_count; uint32_t free_count; @@ -285,16 +285,16 @@ uint32_t le; uint32_t len; - uint32_t status; + uint64_t status; /* FIXME Fields depend on segment type */ uint32_t stripe_size; uint32_t area_count; uint32_t area_len; + uint32_t chunk_size; /* For snapshots - in sectors */ struct logical_volume *origin; struct logical_volume *cow; struct dm_list origin_list; - uint32_t chunk_size; /* For snapshots - in sectors */ uint32_t region_size; /* For mirrors - in sectors */ uint32_t extents_copied; struct logical_volume *log_lv; @@ -315,7 +315,7 @@ struct volume_group *vg; - uint32_t status; + uint64_t status; alloc_policy_t alloc; uint32_t read_ahead; int32_t major; @@ -479,7 +479,7 @@ /* Manipulate LVs */ struct logical_volume *lv_create_empty(const char *name, union lvid *lvid, - uint32_t status, + uint64_t status, alloc_policy_t alloc, struct volume_group *vg); @@ -502,7 +502,7 @@ uint32_t stripes, uint32_t stripe_size, uint32_t mirrors, uint32_t extents, struct physical_volume *mirrored_pv, uint32_t mirrored_pe, - uint32_t status, struct dm_list *allocatable_pvs, + uint64_t status, struct dm_list *allocatable_pvs, alloc_policy_t alloc); /* lv must be part of lv->vg->lvs */ @@ -565,16 +565,16 @@ int insert_layer_for_segments_on_pv(struct cmd_context *cmd, struct logical_volume *lv_where, struct logical_volume *layer_lv, - uint32_t status, + uint64_t status, struct pv_list *pv, struct dm_list *lvs_changed); int remove_layers_for_segments(struct cmd_context *cmd, struct logical_volume *lv, struct logical_volume *layer_lv, - uint32_t status_mask, struct dm_list *lvs_changed); + uint64_t status_mask, struct dm_list *lvs_changed); int remove_layers_for_segments_all(struct cmd_context *cmd, struct logical_volume *layer_lv, - uint32_t status_mask, + uint64_t status_mask, struct dm_list *lvs_changed); int split_parent_segments_for_layer(struct cmd_context *cmd, struct logical_volume *layer_lv); @@ -582,7 +582,7 @@ struct logical_volume *layer_lv); struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd, struct logical_volume *lv_where, - uint32_t status, + uint64_t status, const char *layer_suffix); /* Find a PV within a given VG */ @@ -632,7 +632,7 @@ int vg_remove_snapshot(struct logical_volume *cow); -int vg_check_status(const struct volume_group *vg, uint32_t status); +int vg_check_status(const struct volume_group *vg, uint64_t status); /* * Returns visible LV count - number of LVs from user perspective @@ -654,7 +654,7 @@ struct dm_list *pvs, alloc_policy_t alloc, uint32_t flags); int lv_remove_mirrors(struct cmd_context *cmd, struct logical_volume *lv, uint32_t mirrors, uint32_t log_count, - struct dm_list *pvs, uint32_t status_mask); + struct dm_list *pvs, uint64_t status_mask); int is_temporary_mirror_layer(const struct logical_volume *lv); struct logical_volume * find_temporary_mirror(const struct logical_volume *lv); @@ -662,7 +662,7 @@ uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents, uint32_t region_size); int remove_mirrors_from_segments(struct logical_volume *lv, - uint32_t new_mirrors, uint32_t status_mask); + uint32_t new_mirrors, uint64_t status_mask); int add_mirrors_to_segments(struct cmd_context *cmd, struct logical_volume *lv, uint32_t mirrors, uint32_t region_size, struct dm_list *allocatable_pvs, alloc_policy_t alloc); @@ -711,7 +711,7 @@ const char *pv_vg_name(const struct physical_volume *pv); const char *pv_dev_name(const struct physical_volume *pv); uint64_t pv_size(const struct physical_volume *pv); -uint32_t pv_status(const struct physical_volume *pv); +uint64_t pv_status(const struct physical_volume *pv); uint32_t pv_pe_size(const struct physical_volume *pv); uint64_t pv_pe_start(const struct physical_volume *pv); uint32_t pv_pe_count(const struct physical_volume *pv); @@ -722,7 +722,7 @@ int vg_missing_pv_count(const struct volume_group *vg); uint32_t vg_seqno(const struct volume_group *vg); -uint32_t vg_status(const struct volume_group *vg); +uint64_t vg_status(const struct volume_group *vg); uint64_t vg_size(const struct volume_group *vg); uint64_t vg_free(const struct volume_group *vg); uint64_t vg_extent_size(const struct volume_group *vg); --- LVM2/lib/metadata/metadata.c 2009/11/23 10:44:51 1.298 +++ LVM2/lib/metadata/metadata.c 2009/11/24 22:55:56 1.299 @@ -56,7 +56,7 @@ const struct id *id); static uint32_t _vg_bad_status_bits(const struct volume_group *vg, - uint32_t status); + uint64_t status); const char _really_init[] = "Really INITIALIZE physical volume \"%s\" of volume group \"%s\" [y/n]? "; @@ -3220,7 +3220,7 @@ * FIXME Remove the unnecessary duplicate definitions and return bits directly. */ static uint32_t _vg_bad_status_bits(const struct volume_group *vg, - uint32_t status) + uint64_t status) { uint32_t failure = 0; @@ -3257,7 +3257,7 @@ * @vg - volume group to check status flags * @status - specific status flags to check (e.g. EXPORTED_VG) */ -int vg_check_status(const struct volume_group *vg, uint32_t status) +int vg_check_status(const struct volume_group *vg, uint64_t status) { return !_vg_bad_status_bits(vg, status); } @@ -3303,7 +3303,7 @@ */ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const char *vg_name, const char *vgid, uint32_t lock_flags, - uint32_t status_flags, uint32_t misc_flags) + uint64_t status_flags, uint32_t misc_flags) { struct volume_group *vg = NULL; const char *lock_name; @@ -3429,7 +3429,7 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const char *vgid, uint32_t flags) { - uint32_t status = 0; + uint64_t status = UINT64_C(0); uint32_t lock_flags = LCK_VG_READ; if (flags & READ_FOR_UPDATE) { @@ -3548,7 +3548,7 @@ return pv_field(pv, size); } -uint32_t pv_status(const struct physical_volume *pv) +uint64_t pv_status(const struct physical_volume *pv) { return pv_field(pv, status); } @@ -3586,7 +3586,7 @@ return vg->seqno; } -uint32_t vg_status(const struct volume_group *vg) +uint64_t vg_status(const struct volume_group *vg) { return vg->status; } --- LVM2/lib/metadata/mirror.c 2009/11/19 13:42:38 1.95 +++ LVM2/lib/metadata/mirror.c 2009/11/24 22:55:56 1.96 @@ -973,7 +973,7 @@ * has the status bits on. */ int remove_mirrors_from_segments(struct logical_volume *lv, - uint32_t new_mirrors, uint32_t status_mask) + uint32_t new_mirrors, uint64_t status_mask) { struct lv_segment *seg; uint32_t s; @@ -986,7 +986,7 @@ return 0; } if ((seg->status & status_mask) != status_mask) { log_error("Segment status does not match: %s:%" PRIu32 - " status:0x%x/0x%x", lv->name, seg->le, + " status:0x%" PRIx64 "/0x%" PRIx64, lv->name, seg->le, seg->status, status_mask); return 0; } @@ -1609,7 +1609,7 @@ int lv_remove_mirrors(struct cmd_context *cmd __attribute((unused)), struct logical_volume *lv, uint32_t mirrors, uint32_t log_count, struct dm_list *pvs, - uint32_t status_mask) + uint64_t status_mask) { uint32_t new_mirrors; struct lv_segment *seg; From agk@sourceware.org Wed Nov 25 15:59:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 25 Nov 2009 15:59:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/dmeventd/plugins/mirr ... Message-ID: <20091125155910.25562.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-11-25 15:59:08 Modified files: . : WHATS_NEW daemons/dmeventd/plugins/mirror: dmeventd_mirror.c Log message: Log failure type and recognise type 'F' (flush) in dmeventd mirror plugin. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1331&r2=1.1332 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28 --- LVM2/WHATS_NEW 2009/11/24 22:55:55 1.1331 +++ LVM2/WHATS_NEW 2009/11/25 15:59:07 1.1332 @@ -1,6 +1,7 @@ Version 2.02.57 - ==================================== - Switch status from 32-bit to 64-bit. + Log failure type and recognise type 'F' (flush) in dmeventd mirror plugin. + Extend internal PV/VG/LV/segment status variables from 32-bit to 64-bit. Version 2.02.56 - 24th November 2009 ==================================== --- LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c 2009/10/22 10:40:41 1.27 +++ LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c 2009/11/25 15:59:08 1.28 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Red Hat, Inc. All rights reserved. + * Copyright (C) 2005-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -27,6 +27,8 @@ #include /* FIXME Replace syslog with multilog */ /* FIXME Missing openlog? */ +/* FIXME Replace most syslogs with log_error() style messages and add complete context. */ +/* FIXME Reformat to 80 char lines. */ #define ME_IGNORE 0 #define ME_INSYNC 1 @@ -51,6 +53,36 @@ */ static pthread_mutex_t _event_mutex = PTHREAD_MUTEX_INITIALIZER; +static int _process_status_code(const char status_code, const char *dev_name, + const char *dev_type, int r) +{ + /* + * A => Alive - No failures + * D => Dead - A write failure occurred leaving mirror out-of-sync + * F => Flush failed. + * S => Sync - A sychronization failure occurred, mirror out-of-sync + * R => Read - A read failure occurred, mirror data unaffected + * U => Unclassified failure (bug) + */ + if (status_code == 'F') { + syslog(LOG_ERR, "%s device %s flush failed.\n", + dev_type, dev_name); + r = ME_FAILURE; + } else if (status_code == 'S') + syslog(LOG_ERR, "%s device %s sync failed.\n", + dev_type, dev_name); + else if (status_code == 'R') + syslog(LOG_ERR, "%s device %s read failed.\n", + dev_type, dev_name); + else if (status_code != 'A') { + syslog(LOG_ERR, "%s device %s has failed (%c).\n", + dev_type, dev_name, status_code); + r = ME_FAILURE; + } + + return r; +} + static int _get_mirror_event(char *params) { int i, r = ME_INSYNC; @@ -90,17 +122,14 @@ /* Check for bad mirror devices */ for (i = 0; i < num_devs; i++) - if (dev_status_str[i] == 'D') { - syslog(LOG_ERR, "Mirror device, %s, has failed.\n", args[i]); - r = ME_FAILURE; - } + r = _process_status_code(dev_status_str[i], args[i], + i ? "Secondary mirror" : "Primary mirror", r); /* Check for bad disk log device */ - if (log_argc > 1 && log_status_str[0] == 'D') { - syslog(LOG_ERR, "Log device, %s, has failed.\n", - args[2 + num_devs + log_argc]); - r = ME_FAILURE; - } + if (log_argc > 1) + r = _process_status_code(log_status_str[0], + args[2 + num_devs + log_argc], + "Log", r); if (r == ME_FAILURE) goto out; From wysochanski@sourceware.org Wed Nov 25 20:44:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Wed, 25 Nov 2009 20:44:00 -0000 Subject: LVM2 ./WHATS_NEW lib/datastruct/list.c lib/dat ... Message-ID: <20091125204408.6469.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-11-25 20:44:07 Modified files: . : WHATS_NEW Removed files: lib/datastruct : list.c list.h libdm/datastruct: list.h Log message: Remove unnecessary / duplicate dm_list macros and functions. These are no longer used by anyone. The dm_list defines are all in libdevmapper.h and libdm/datastruct/list.c contains any function definitions. There is some code in "old-tests" that still use this but this code is not being maintained. Thanks to Zdenek for spotting this. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/datastruct/list.c.diff?cvsroot=lvm2&r1=1.5&r2=NONE http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/datastruct/list.h.diff?cvsroot=lvm2&r1=1.28&r2=NONE http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/datastruct/list.h.diff?cvsroot=lvm2&r1=1.28&r2=NONE http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1332&r2=1.1333 --- LVM2/WHATS_NEW 2009/11/25 15:59:07 1.1332 +++ LVM2/WHATS_NEW 2009/11/25 20:44:07 1.1333 @@ -1,5 +1,6 @@ Version 2.02.57 - ==================================== + Remove duplicate dm_list macros and functions. Log failure type and recognise type 'F' (flush) in dmeventd mirror plugin. Extend internal PV/VG/LV/segment status variables from 32-bit to 64-bit. From mbroz@sourceware.org Fri Nov 27 14:32:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Fri, 27 Nov 2009 14:32:00 -0000 Subject: LVM2 ./WHATS_NEW scripts/lvmconf.sh scripts/lv ... Message-ID: <20091127143217.9745.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-27 14:32:16 Modified files: . : WHATS_NEW scripts : lvmconf.sh Added files: scripts : lvmconf_lockingtype2.sh Log message: Use locking_type 3 (compiled in cluster locking) in lvmconf. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1333&r2=1.1334 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/lvmconf_lockingtype2.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/lvmconf.sh.diff?cvsroot=lvm2&r1=1.4&r2=1.5 --- LVM2/WHATS_NEW 2009/11/25 20:44:07 1.1333 +++ LVM2/WHATS_NEW 2009/11/27 14:32:16 1.1334 @@ -1,5 +1,6 @@ Version 2.02.57 - ==================================== + Use locking_type 3 (compiled in cluster locking) in lvmconf. Remove duplicate dm_list macros and functions. Log failure type and recognise type 'F' (flush) in dmeventd mirror plugin. Extend internal PV/VG/LV/segment status variables from 32-bit to 64-bit. /cvs/lvm2/LVM2/scripts/lvmconf_lockingtype2.sh,v --> standard output revision 1.1 --- LVM2/scripts/lvmconf_lockingtype2.sh +++ - 2009-11-27 14:32:17.307148000 +0000 @@ -0,0 +1,259 @@ +#!/bin/sh +# +# Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. +# +# This file is part of the lvm2-cluster package. +# +# 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 + +# +# Edit an lvm.conf file to adjust various properties +# + +function usage +{ + echo "usage: $0 " + echo "" + echo "Commands:" + echo "Enable clvm: --enable-cluster [--lockinglibdir ] [--lockinglib ]" + echo "Disable clvm: --disable-cluster" + echo "Set locking library: --lockinglibdir [--lockinglib ]" + echo "" + echo "Global options:" + echo "Config file location: --file " + echo "" +} + + +function parse_args +{ + while [ -n "$1" ]; do + case $1 in + --enable-cluster) + LOCKING_TYPE=2 + shift + ;; + --disable-cluster) + LOCKING_TYPE=1 + shift + ;; + --lockinglibdir) + if [ -n "$2" ]; then + LOCKINGLIBDIR=$2 + shift 2 + else + usage + exit 1 + fi + ;; + --lockinglib) + if [ -n "$2" ]; then + LOCKINGLIB=$2 + shift 2 + else + usage + exit 1 + fi + ;; + --file) + if [ -n "$2" ]; then + CONFIGFILE=$2 + shift 2 + else + usage + exit 1 + fi + ;; + *) + usage + exit 1 + esac + done +} + +function validate_args +{ + [ -z "$CONFIGFILE" ] && CONFIGFILE="/etc/lvm/lvm.conf" + + if [ ! -f "$CONFIGFILE" ] + then + echo "$CONFIGFILE does not exist" + exit 10 + fi + + if [ -z "$LOCKING_TYPE" ] && [ -z "$LOCKINGLIBDIR" ]; then + usage + exit 1 + fi + + if [ -n "$LOCKINGLIBDIR" ]; then + + [ -z "$LOCKINGLIB" ] && LOCKINGLIB="liblvm2clusterlock.so" + + if [ "${LOCKINGLIBDIR:0:1}" != "/" ] + then + echo "Prefix must be an absolute path name (starting with a /)" + exit 12 + fi + + if [ ! -f "$LOCKINGLIBDIR/$LOCKINGLIB" ] + then + echo "$LOCKINGLIBDIR/$LOCKINGLIB does not exist, did you do a \"make install\" ?" + exit 11 + fi + + fi + + if [ "$LOCKING_TYPE" = "1" ] && [ -n "$LOCKINGLIBDIR" -o -n "$LOCKINGLIB" ]; then + echo "Superfluous locking lib parameter, ignoring" + fi +} + +umask 0077 + +parse_args "$@" + +validate_args + + +SCRIPTFILE=/etc/lvm/.lvmconf-script.tmp +TMPFILE=/etc/lvm/.lvmconf-tmp.tmp + + +# Flags so we know which parts of the file we can replace and which need +# adding. These are return codes from grep, so zero means it IS present! +have_type=1 +have_dir=1 +have_library=1 +have_global=1 + +grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' $CONFIGFILE +have_type=$? + +grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' $CONFIGFILE +have_dir=$? + +grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' $CONFIGFILE +have_library=$? + +# Those options are in section "global {" so we must have one if any are present. +if [ "$have_type" = "0" -o "$have_dir" = "0" -o "$have_library" = "0" ] +then + + # See if we can find it... + grep -q '^[[:blank:]]*global[[:blank:]]*{' $CONFIGFILE + have_global=$? + + if [ "$have_global" = "1" ] + then + echo "global keys but no 'global {' found, can't edit file" + exit 13 + fi +fi + +if [ "$LOCKING_TYPE" = "2" ] && [ -z "$LOCKINGLIBDIR" ] && [ "$have_dir" = "1" ]; then + echo "no library_dir specified in $CONFIGFILE" + exit 16 +fi + +# So if we don't have "global {" we need to create one and +# populate it + +if [ "$have_global" = "1" ] +then + if [ -z "$LOCKING_TYPE" ]; then + LOCKING_TYPE=1 + fi + if [ "$LOCKING_TYPE" = "2" ]; then + cat $CONFIGFILE - < $TMPFILE +global { + # Enable locking for cluster LVM + locking_type = $LOCKING_TYPE + library_dir = "$LOCKINGLIBDIR" + locking_library = "$LOCKINGLIB" +} +EOF + fi # if we aren't setting cluster locking, we don't need to create a global section + + if [ $? != 0 ] + then + echo "failed to create temporary config file, $CONFIGFILE not updated" + exit 14 + fi +else + # + # We have a "global {" section, so add or replace the + # locking entries as appropriate + # + + if [ -n "$LOCKING_TYPE" ]; then + if [ "$have_type" = "0" ] + then + SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = $LOCKING_TYPE/g" + else + SEDCMD=" /global[[:blank:]]*{/a\ \ \ \ locking_type = $LOCKING_TYPE" + fi + fi + + if [ -n "$LOCKINGLIBDIR" ]; then + if [ "$have_dir" = "0" ] + then + SEDCMD="${SEDCMD}\ns'^[[:blank:]]*library_dir[[:blank:]]*=.*'\ \ \ \ library_dir = \"$LOCKINGLIBDIR\"'g" + else + SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ library_dir = \"$LOCKINGLIBDIR\"" + fi + + if [ "$have_library" = "0" ] + then + SEDCMD="${SEDCMD}\ns/^[[:blank:]]*locking_library[[:blank:]]*=.*/\ \ \ \ locking_library = \"$LOCKINGLIB\"/g" + else + SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ locking_library = \"$LOCKINGLIB\"" + fi + fi + + if [ "$LOCKING_TYPE" = "1" ]; then + # if we're not using cluster locking, remove the library dir and locking library name + if [ "$have_dir" = "0" ] + then + SEDCMD="${SEDCMD}\n/^[[:blank:]]*library_dir[[:blank:]]*=.*/d" + fi + + if [ "$have_library" = "0" ] + then + SEDCMD="${SEDCMD}\n/^[[:blank:]]*locking_library[[:blank:]]*=.*/d" + fi + fi + + echo -e $SEDCMD > $SCRIPTFILE + sed <$CONFIGFILE >$TMPFILE -f $SCRIPTFILE + if [ $? != 0 ] + then + echo "sed failed, $CONFIGFILE not updated" + exit 15 + fi +fi + +# Now we have a suitably editted config file in a temp place, +# backup the original and copy our new one into place. + +cp $CONFIGFILE $CONFIGFILE.lvmconfold +if [ $? != 0 ] + then + echo "failed to backup old config file, $CONFIGFILE not updated" + exit 2 +fi + +cp $TMPFILE $CONFIGFILE +if [ $? != 0 ] + then + echo "failed to copy new config file into place, check $CONFIGFILE is still OK" + exit 3 +fi + +rm -f $SCRIPTFILE $TMPFILE --- LVM2/scripts/lvmconf.sh 2006/09/20 17:36:47 1.4 +++ LVM2/scripts/lvmconf.sh 2009/11/27 14:32:16 1.5 @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. +# Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. # # This file is part of the lvm2-cluster package. # @@ -36,7 +36,7 @@ while [ -n "$1" ]; do case $1 in --enable-cluster) - LOCKING_TYPE=2 + LOCKING_TYPE=3 shift ;; --disable-cluster) @@ -94,20 +94,18 @@ if [ -n "$LOCKINGLIBDIR" ]; then - [ -z "$LOCKINGLIB" ] && LOCKINGLIB="liblvm2clusterlock.so" - if [ "${LOCKINGLIBDIR:0:1}" != "/" ] then echo "Prefix must be an absolute path name (starting with a /)" exit 12 fi - - if [ ! -f "$LOCKINGLIBDIR/$LOCKINGLIB" ] + + if [ -n "$LOCKINGLIB" ] && [ ! -f "$LOCKINGLIBDIR/$LOCKINGLIB" ] then echo "$LOCKINGLIBDIR/$LOCKINGLIB does not exist, did you do a \"make install\" ?" exit 11 fi - + fi if [ "$LOCKING_TYPE" = "1" ] && [ -n "$LOCKINGLIBDIR" -o -n "$LOCKINGLIB" ]; then @@ -149,7 +147,7 @@ # See if we can find it... grep -q '^[[:blank:]]*global[[:blank:]]*{' $CONFIGFILE have_global=$? - + if [ "$have_global" = "1" ] then echo "global keys but no 'global {' found, can't edit file" @@ -170,13 +168,29 @@ if [ -z "$LOCKING_TYPE" ]; then LOCKING_TYPE=1 fi - if [ "$LOCKING_TYPE" = "2" ]; then + if [ "$LOCKING_TYPE" = "3" ] || [ "$LOCKING_TYPE" = "2" ]; then cat $CONFIGFILE - < $TMPFILE global { # Enable locking for cluster LVM locking_type = $LOCKING_TYPE library_dir = "$LOCKINGLIBDIR" +EOF + if [ $? != 0 ] + then + echo "failed to create temporary config file, $CONFIGFILE not updated" + exit 14 + fi + if [ -n "$LOCKINGLIB" ]; then + cat - <> $TMPFILE locking_library = "$LOCKINGLIB" +EOF + if [ $? != 0 ] + then + echo "failed to create temporary config file, $CONFIGFILE not updated" + exit 16 + fi + fi + cat - <> $TMPFILE } EOF fi # if we aren't setting cluster locking, we don't need to create a global section @@ -184,7 +198,7 @@ if [ $? != 0 ] then echo "failed to create temporary config file, $CONFIGFILE not updated" - exit 14 + exit 17 fi else # @@ -200,7 +214,7 @@ SEDCMD=" /global[[:blank:]]*{/a\ \ \ \ locking_type = $LOCKING_TYPE" fi fi - + if [ -n "$LOCKINGLIBDIR" ]; then if [ "$have_dir" = "0" ] then @@ -208,8 +222,10 @@ else SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ library_dir = \"$LOCKINGLIBDIR\"" fi + fi - if [ "$have_library" = "0" ] + if [ -n "$LOCKINGLIB" ]; then + if [ "$have_library" = "0" ] then SEDCMD="${SEDCMD}\ns/^[[:blank:]]*locking_library[[:blank:]]*=.*/\ \ \ \ locking_library = \"$LOCKINGLIB\"/g" else @@ -217,19 +233,6 @@ fi fi - if [ "$LOCKING_TYPE" = "1" ]; then - # if we're not using cluster locking, remove the library dir and locking library name - if [ "$have_dir" = "0" ] - then - SEDCMD="${SEDCMD}\n/^[[:blank:]]*library_dir[[:blank:]]*=.*/d" - fi - - if [ "$have_library" = "0" ] - then - SEDCMD="${SEDCMD}\n/^[[:blank:]]*locking_library[[:blank:]]*=.*/d" - fi - fi - echo -e $SEDCMD > $SCRIPTFILE sed <$CONFIGFILE >$TMPFILE -f $SCRIPTFILE if [ $? != 0 ] From mbroz@sourceware.org Fri Nov 27 14:35:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Fri, 27 Nov 2009 14:35:00 -0000 Subject: LVM2 ./WHATS_NEW lib/config/defaults.h tools/l ... Message-ID: <20091127143540.12555.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-11-27 14:35:39 Modified files: . : WHATS_NEW lib/config : defaults.h tools : lvconvert.c lvcreate.c Log message: Do not allow creating mirrors of more than 8 images. This is kernel limitation in all kernel versions, so better detect this early. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1334&r2=1.1335 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.53&r2=1.54 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.97&r2=1.98 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.210&r2=1.211 --- LVM2/WHATS_NEW 2009/11/27 14:32:16 1.1334 +++ LVM2/WHATS_NEW 2009/11/27 14:35:38 1.1335 @@ -1,5 +1,6 @@ Version 2.02.57 - ==================================== + Do not allow creating mirrors of more than 8 images. Use locking_type 3 (compiled in cluster locking) in lvmconf. Remove duplicate dm_list macros and functions. Log failure type and recognise type 'F' (flush) in dmeventd mirror plugin. --- LVM2/lib/config/defaults.h 2009/10/05 12:44:21 1.53 +++ LVM2/lib/config/defaults.h 2009/11/27 14:35:39 1.54 @@ -47,6 +47,7 @@ #define DEFAULT_MIRRORLOG "disk" #define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate" #define DEFAULT_MIRROR_DEV_FAULT_POLICY "remove" +#define DEFAULT_MIRROR_MAX_IMAGES 8 /* limited by kernel DM_KCOPYD_MAX_REGIONS */ #define DEFAULT_DMEVENTD_MIRROR_LIB "libdevmapper-event-lvm2mirror.so" #define DEFAULT_DMEVENTD_MONITOR 1 --- LVM2/tools/lvconvert.c 2009/11/03 15:50:44 1.97 +++ LVM2/tools/lvconvert.c 2009/11/27 14:35:39 1.98 @@ -571,6 +571,12 @@ else lp->mirrors += 1; + if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) { + log_error("Only up to %d images in mirror supported currently.", + DEFAULT_MIRROR_MAX_IMAGES); + return 0; + } + if (repair) { cmd->handles_missing_pvs = 1; cmd->partial_activation = 1; --- LVM2/tools/lvcreate.c 2009/11/04 14:47:28 1.210 +++ LVM2/tools/lvcreate.c 2009/11/27 14:35:39 1.211 @@ -500,6 +500,12 @@ return 0; } + if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) { + log_error("Only up to %d images in mirror supported currently.", + DEFAULT_MIRROR_MAX_IMAGES); + return 0; + } + /* * Read ahead. */ From mornfall@sourceware.org Mon Nov 30 14:59:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Mon, 30 Nov 2009 14:59:00 -0000 Subject: LVM2/test Makefile.in Message-ID: <20091130145926.13267.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-30 14:59:26 Modified files: test : Makefile.in Log message: More fixes for the testsuite in the $(builddir) != $(srcdir) situation. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/Makefile.in.diff?cvsroot=lvm2&r1=1.21&r2=1.22 --- LVM2/test/Makefile.in 2009/11/19 12:01:39 1.21 +++ LVM2/test/Makefile.in 2009/11/30 14:59:26 1.22 @@ -25,6 +25,18 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +# Shell quote; +SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) + +T = $(wildcard $(srcdir)/t-*.sh) + +ifeq ("@APPLIB@", "yes") +T += $(srcdir)/lvm2app.sh +all: api/vgtest +api/vgtest: + $(MAKE) -C api vgtest +endif + all: init.sh ./bin/harness t-*.sh @@ -46,21 +58,9 @@ echo 'export PATH' >> $@-t chmod a-w $@-t mv $@-t $@ - -cp $(srcdir)/test-utils.sh . - -cp $(srcdir)/test-lib.sh . - -cp $(T) . - -# Shell quote; -SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) - -T = $(wildcard $(srcdir)/t-*.sh) - -ifeq ("@APPLIB@", "yes") -T += lvm2app.sh -all: api/vgtest -api/vgtest: - $(MAKE) -C api vgtest -endif + test "$(srcdir)" != "." && cp $(srcdir)/test-utils.sh \ + $(srcdir)/test-lib.sh \ + $(T) . Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ From mornfall@sourceware.org Mon Nov 30 15:12:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Mon, 30 Nov 2009 15:12:00 -0000 Subject: LVM2/test/api Makefile.in Message-ID: <20091130151235.11121.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-30 15:12:34 Modified files: test/api : Makefile.in Log message: Fix test/api to work with srcdir != builddir. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/Makefile.in.diff?cvsroot=lvm2&r1=1.10&r2=1.11 --- LVM2/test/api/Makefile.in 2009/10/02 19:10:38 1.10 +++ LVM2/test/api/Makefile.in 2009/11/30 15:12:34 1.11 @@ -26,17 +26,17 @@ INCLUDES += -I../../include LVMLIBS = @LVM2APP_LIB@ -ldevmapper -DEPLIBS = $(top_srcdir)/liblvm/liblvm2app.so $(top_srcdir)/libdm/libdevmapper.so +DEPLIBS = $(top_builddir)/liblvm/liblvm2app.so $(top_builddir)/libdm/libdevmapper.so DEFS += -D_REENTRANT -include $(top_srcdir)/make.tmpl +include $(top_builddir)/make.tmpl -LDFLAGS = -L$(top_srcdir)/libdm -L$(top_srcdir)/liblvm +LDFLAGS = -L$(top_builddir)/libdm -L$(top_builddir)/liblvm ifeq ("@DMEVENTD@", "yes") LVMLIBS += -ldevmapper-event -lpthread - LDFLAGS += -L$(top_srcdir)/daemons/dmeventd + LDFLAGS += -L$(top_builddir)/daemons/dmeventd endif test_OBJECTS = $(test_SOURCES:.c=.o) From mornfall@sourceware.org Mon Nov 30 16:56:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Mon, 30 Nov 2009 16:56:00 -0000 Subject: LVM2/test Makefile.in Message-ID: <20091130165642.3246.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-30 16:56:42 Modified files: test : Makefile.in Log message: Don't fail in the builddir == srcdir case, though. (testsuite) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/Makefile.in.diff?cvsroot=lvm2&r1=1.22&r2=1.23 --- LVM2/test/Makefile.in 2009/11/30 14:59:26 1.22 +++ LVM2/test/Makefile.in 2009/11/30 16:56:42 1.23 @@ -58,9 +58,9 @@ echo 'export PATH' >> $@-t chmod a-w $@-t mv $@-t $@ - test "$(srcdir)" != "." && cp $(srcdir)/test-utils.sh \ - $(srcdir)/test-lib.sh \ - $(T) . + if test "$(srcdir)" != "."; then cp $(srcdir)/test-utils.sh \ + $(srcdir)/test-lib.sh \ + $(T) .; fi Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ From mornfall@sourceware.org Mon Nov 30 16:58:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Mon, 30 Nov 2009 16:58:00 -0000 Subject: LVM2/test Makefile.in Message-ID: <20091130165853.4882.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-30 16:58:53 Modified files: test : Makefile.in Log message: The sourcedir instances of the test scripts are not PHONY. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/Makefile.in.diff?cvsroot=lvm2&r1=1.23&r2=1.24 --- LVM2/test/Makefile.in 2009/11/30 16:56:42 1.23 +++ LVM2/test/Makefile.in 2009/11/30 16:58:53 1.24 @@ -65,9 +65,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -#$(T): init.sh -# ./bin/harness $@ - .bin-dir-stamp: lvm-wrapper rm -rf bin mkdir bin @@ -93,5 +90,5 @@ distclean: clean rm -f Makefile -.PHONY: $(T) clean distclean +.PHONY: clean distclean .NOTPARALLEL: From mornfall@sourceware.org Mon Nov 30 17:17:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Mon, 30 Nov 2009 17:17:00 -0000 Subject: LVM2 doc/example.conf lib/commands/toolcontext ... Message-ID: <20091130171713.32649.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-11-30 17:17:12 Modified files: doc : example.conf lib/commands : toolcontext.c lib/config : defaults.h lib/log : log.c lvm-logging.h test : test-utils.sh Log message: Optionally abort on internal errors (and leverage this option in the testsuite). (This is showing a problem in the pvmove test for me, so I expect the tests to start failing -- this needs to be fixed separately though.) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.diff?cvsroot=lvm2&r1=1.51&r2=1.52 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.88&r2=1.89 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.54&r2=1.55 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/lvm-logging.h.diff?cvsroot=lvm2&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.14&r2=1.15 --- LVM2/doc/example.conf 2009/10/05 12:44:21 1.51 +++ LVM2/doc/example.conf 2009/11/30 17:17:11 1.52 @@ -316,6 +316,10 @@ # The external locking library to load if locking_type is set to 2. # locking_library = "liblvm2clusterlock.so" + + # Treat any internal errors as fatal errors, aborting the process that + # encountered the internal error. Please only enable for debugging. + abort_on_internal_errors = 0 } activation { --- LVM2/lib/commands/toolcontext.c 2009/11/24 16:11:38 1.88 +++ LVM2/lib/commands/toolcontext.c 2009/11/30 17:17:11 1.89 @@ -147,7 +147,9 @@ /* Log message formatting */ init_indent(find_config_tree_int(cmd, "log/indent", - DEFAULT_INDENT)); + DEFAULT_INDENT)); + init_abort_on_internal_errors(find_config_tree_int(cmd, "global/abort_on_internal_errors", + DEFAULT_ABORT_ON_INTERNAL_ERRORS)); cmd->default_settings.msg_prefix = find_config_tree_str(cmd, "log/prefix", --- LVM2/lib/config/defaults.h 2009/11/27 14:35:39 1.54 +++ LVM2/lib/config/defaults.h 2009/11/30 17:17:12 1.55 @@ -85,6 +85,7 @@ #define DEFAULT_VERBOSE 0 #define DEFAULT_LOGLEVEL 0 #define DEFAULT_INDENT 1 +#define DEFAULT_ABORT_ON_INTERNAL_ERRORS 0 #define DEFAULT_UNITS "h" #define DEFAULT_SUFFIX 1 #define DEFAULT_HOSTTAGS 0 --- LVM2/lib/log/log.c 2009/07/16 13:13:33 1.52 +++ LVM2/lib/log/log.c 2009/11/30 17:17:12 1.53 @@ -19,6 +19,7 @@ #include "lvm-string.h" #include "lvm-file.h" #include "defaults.h" +#include "config.h" #include #include @@ -35,6 +36,7 @@ static int _log_suppress = 0; static char _msg_prefix[30] = " "; static int _already_logging = 0; +static int _abort_on_internal_errors = 0; static lvm2_log_fn_t _lvm2_log_fn = NULL; @@ -140,6 +142,11 @@ _indent = indent; } +void init_abort_on_internal_errors(int fatal) +{ + _abort_on_internal_errors = fatal; +} + void reset_lvm_errno(int store_errmsg) { _lvm_errno = 0; @@ -172,9 +179,14 @@ const char *trformat; /* Translated format string */ char *newbuf; int use_stderr = level & _LOG_STDERR; + int internal_error = 0; level &= ~_LOG_STDERR; + if (!strncmp(format, "Internal error:", + strlen("Internal error:"))) + internal_error = 1; + if (_log_suppress == 2) return; @@ -291,6 +303,9 @@ va_end(ap); } + if (internal_error && _abort_on_internal_errors) + abort(); + if (level > debug_level()) return; --- LVM2/lib/log/lvm-logging.h 2009/07/16 03:07:45 1.7 +++ LVM2/lib/log/lvm-logging.h 2009/11/30 17:17:12 1.8 @@ -39,6 +39,7 @@ void init_log_file(const char *log_file, int append); void init_log_direct(const char *log_file, int append); void init_log_while_suspended(int log_while_suspended); +void init_abort_on_internal_errors(int fatal); void fin_log(void); void release_log_memory(void); --- LVM2/test/test-utils.sh 2009/08/02 21:45:45 1.14 +++ LVM2/test/test-utils.sh 2009/11/30 17:17:12 1.15 @@ -199,8 +199,9 @@ archive = 0 } global { + abort_on_internal_errors = 1 library_dir = "$G_root_/lib" - locking_dir = "$G_root_/var/lock/lvm" + locking_dir = "$G_root_/var/lock/lvm" } EOF }