From snitzer@sourceware.org Sat Aug 1 17:07:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Sat, 01 Aug 2009 17:07:00 -0000 Subject: LVM2 ./WHATS_NEW doc/example.conf lib/config/d ... Message-ID: <20090801170738.1959.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-08-01 17:07:37 Modified files: . : WHATS_NEW doc : example.conf lib/config : defaults.h lib/device : device.c device.h lib/format_text: format-text.c lib/metadata : metadata.c man : lvm.conf.5.in Log message: Add devices/data_alignment_offset_detection to lvm.conf. If the pvcreate --dataalignmentoffset option is not specified the start of a PV's aligned data area will be shifted by the associated 'alignment_offset' exposed in sysfs (unless devices/data_alignment_offset_detection is disabled in lvm.conf). Signed-off-by: Mike Snitzer Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1223&r2=1.1224 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.diff?cvsroot=lvm2&r1=1.42&r2=1.43 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.47&r2=1.48 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.h.diff?cvsroot=lvm2&r1=1.40&r2=1.41 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.114&r2=1.115 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.275&r2=1.276 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvm.conf.5.in.diff?cvsroot=lvm2&r1=1.4&r2=1.5 --- LVM2/WHATS_NEW 2009/07/31 18:30:31 1.1223 +++ LVM2/WHATS_NEW 2009/08/01 17:07:36 1.1224 @@ -4,6 +4,7 @@ Added configure --enable-udev_rules --enable-udev_sync. Added configure --with-udev-prefix --with-udevdir. Added udev dir to hold udev rules. + Add devices/data_alignment_offset_detection to lvm.conf. Add --dataalignmentoffset to pvcreate to shift start of aligned data area. Fix _mda_setup() to not check first mda's size before pe_align rounding. Document -I option of clvmd in the man page. --- LVM2/doc/example.conf 2009/07/24 23:29:03 1.42 +++ LVM2/doc/example.conf 2009/08/01 17:07:36 1.43 @@ -104,6 +104,15 @@ # Set to 0 for the default alignment of 64KB or page size, if larger. data_alignment = 0 + # By default, the start of the PV's aligned data area will be shifted by + # the 'alignment_offset' exposed in sysfs. This offset is often 0 but + # may be non-zero; e.g.: certain 4KB sector drives that compensate for + # windows partitioning will have an alignment_offset of 3584 bytes + # (sector 7 is the lowest aligned logical block, the 4KB sectors start + # at LBA -1, and consequently sector 63 is aligned on a 4KB boundary). + # 1 enables; 0 disables. + data_alignment_offset_detection = 1 + # If, while scanning the system for PVs, LVM2 encounters a device-mapper # device that has its I/O suspended, it waits for it to become accessible. # Set this to 1 to skip such devices. This should only be needed --- LVM2/lib/config/defaults.h 2009/07/24 23:29:03 1.47 +++ LVM2/lib/config/defaults.h 2009/08/01 17:07:37 1.48 @@ -34,6 +34,7 @@ #define DEFAULT_MD_COMPONENT_DETECTION 1 #define DEFAULT_MD_CHUNK_ALIGNMENT 1 #define DEFAULT_IGNORE_SUSPENDED_DEVICES 1 +#define DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION 1 #define DEFAULT_LOCK_DIR "/var/lock/lvm" #define DEFAULT_LOCKING_LIB "liblvm2clusterlock.so" --- LVM2/lib/device/device.c 2009/07/09 22:50:45 1.27 +++ LVM2/lib/device/device.c 2009/08/01 17:07:37 1.28 @@ -282,3 +282,74 @@ return 0; } #endif + +#ifdef linux + +static unsigned long _dev_topology_attribute(const char *attribute, + const char *sysfs_dir, + struct device *dev) +{ + char path[PATH_MAX+1], buffer[64]; + FILE *fp; + struct stat info; + unsigned long result = 0UL; + + if (!attribute || !*attribute) + return_0; + + if (!sysfs_dir || !*sysfs_dir) + return_0; + + if (dm_snprintf(path, PATH_MAX, "%s/dev/block/%d:%d/%s", + sysfs_dir, (int)MAJOR(dev->dev), (int)MINOR(dev->dev), + attribute) < 0) { + log_error("dm_snprintf %s failed", attribute); + return 0; + } + + /* check if the desired sysfs attribute exists */ + if (stat(path, &info) < 0) + return 0; + + if (!(fp = fopen(path, "r"))) { + log_sys_error("fopen", path); + return 0; + } + + if (!fgets(buffer, sizeof(buffer), fp)) { + log_sys_error("fgets", path); + goto out; + } + + if (sscanf(buffer, "%lu", &result) != 1) { + log_error("sysfs file %s not in expected format: %s", path, + buffer); + goto out; + } + + log_very_verbose("Device %s %s is %lu bytes.", + dev_name(dev), attribute, result); + +out: + if (fclose(fp)) + log_sys_error("fclose", path); + + return result >> SECTOR_SHIFT; +} + +unsigned long dev_alignment_offset(const char *sysfs_dir, + struct device *dev) +{ + return _dev_topology_attribute("alignment_offset", + sysfs_dir, dev); +} + +#else + +unsigned long dev_alignment_offset(const char *sysfs_dir, + struct device *dev) +{ + return 0UL; +} + +#endif --- LVM2/lib/device/device.h 2009/07/06 19:04:25 1.40 +++ LVM2/lib/device/device.h 2009/08/01 17:07:37 1.41 @@ -100,4 +100,7 @@ int is_partitioned_dev(struct device *dev); +unsigned long dev_alignment_offset(const char *sysfs_dir, + struct device *dev); + #endif --- LVM2/lib/format_text/format-text.c 2009/07/31 14:23:06 1.114 +++ LVM2/lib/format_text/format-text.c 2009/08/01 17:07:37 1.115 @@ -1772,7 +1772,11 @@ "%lu sectors (requested %lu sectors)", pv_dev_name(pv), pv->pe_align, data_alignment); - set_pe_align_offset(pv, data_alignment_offset); + if (set_pe_align_offset(pv, data_alignment_offset) != data_alignment_offset && + data_alignment_offset) + log_warn("WARNING: %s: Overriding data alignment offset to " + "%lu sectors (requested %lu sectors)", + pv_dev_name(pv), pv->pe_align_offset, data_alignment_offset); if (pv->pe_align < pv->pe_align_offset) { log_error("%s: pe_align (%lu sectors) must not be less " --- LVM2/lib/metadata/metadata.c 2009/07/30 17:45:29 1.275 +++ LVM2/lib/metadata/metadata.c 2009/08/01 17:07:37 1.276 @@ -105,6 +105,14 @@ if (!pv->dev) goto out; + if (find_config_tree_bool(pv->fmt->cmd, + "devices/data_alignment_offset_detection", + DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION)) + pv->pe_align_offset = + MAX(pv->pe_align_offset, + dev_alignment_offset(pv->fmt->cmd->sysfs_dir, + pv->dev)); + log_very_verbose("%s: Setting PE alignment offset to %lu sectors.", dev_name(pv->dev), pv->pe_align_offset); --- LVM2/man/lvm.conf.5.in 2009/07/24 23:29:03 1.4 +++ LVM2/man/lvm.conf.5.in 2009/08/01 17:07:37 1.5 @@ -142,10 +142,17 @@ If a Physical Volume is placed directly upon an md device and \fBmd_chunk_alignment\fP is enabled this parameter is ignored. Set to 0 to use the default alignment of 64KB or the page size, if larger. +.IP +\fBdata_alignment_offset_detection\fP \(em If set to 1, and your kernel +provides topology information in sysfs for the Physical Volume, the +start of the aligned data area of the Physical Volume will be shifted +by the alignment_offset exposed in sysfs. .sp To see the location of the first Physical Extent of an existing Physical Volume use \fBpvs -o +pe_start\fP . It will be a multiple of the requested -\fBdata_alignment\fP. +\fBdata_alignment\fP plus the alignment_offset from +\fBdata_alignment_offset_detection\fP (if enabled) or the pvcreate +commandline. .TP \fBlog\fP \(em Default log settings .IP From snitzer@sourceware.org Sat Aug 1 17:08:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Sat, 01 Aug 2009 17:08:00 -0000 Subject: LVM2 ./WHATS_NEW doc/example.conf lib/config/d ... Message-ID: <20090801170845.2245.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-08-01 17:08:44 Modified files: . : WHATS_NEW doc : example.conf lib/config : defaults.h lib/device : device.c device.h lib/metadata : metadata.c man : lvm.conf.5.in Log message: Add devices/data_alignment_detection to lvm.conf. Adds 'data_alignment_detection' config option to the devices section of lvm.conf. If your kernel provides topology information in sysfs (linux >= 2.6.31) for the Physical Volume, the start of data area will be aligned on a multiple of the ??????minimum_io_size?????? or ??????optimal_io_size?????? exposed in sysfs. minimum_io_size is used if optimal_io_size is undefined (0). If both md_chunk_alignment and data_alignment_detection are enabled the result of data_alignment_detection is used. Signed-off-by: Mike Snitzer Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1224&r2=1.1225 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.diff?cvsroot=lvm2&r1=1.43&r2=1.44 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.48&r2=1.49 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.h.diff?cvsroot=lvm2&r1=1.41&r2=1.42 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.276&r2=1.277 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvm.conf.5.in.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/WHATS_NEW 2009/08/01 17:07:36 1.1224 +++ LVM2/WHATS_NEW 2009/08/01 17:08:43 1.1225 @@ -4,6 +4,7 @@ Added configure --enable-udev_rules --enable-udev_sync. Added configure --with-udev-prefix --with-udevdir. Added udev dir to hold udev rules. + Add devices/data_alignment_detection to lvm.conf. Add devices/data_alignment_offset_detection to lvm.conf. Add --dataalignmentoffset to pvcreate to shift start of aligned data area. Fix _mda_setup() to not check first mda's size before pe_align rounding. --- LVM2/doc/example.conf 2009/08/01 17:07:36 1.43 +++ LVM2/doc/example.conf 2009/08/01 17:08:44 1.44 @@ -98,9 +98,21 @@ # 1 enables; 0 disables. md_chunk_alignment = 1 + # By default, the start of a PV's data area will be a multiple of + # the 'minimum_io_size' or 'optimal_io_size' exposed in sysfs. + # - minimum_io_size - the smallest request the device can perform + # w/o incurring a read-modify-write penalty (e.g. MD's chunk size) + # - optimal_io_size - the device's preferred unit of receiving I/O + # (e.g. MD's stripe width) + # minimum_io_size is used if optimal_io_size is undefined (0). + # If md_chunk_alignment is enabled, that detects the optimal_io_size. + # This setting takes precedence over md_chunk_alignment. + # 1 enables; 0 disables. + data_alignment_detection = 1 + # Alignment (in KB) of start of data area when creating a new PV. - # If a PV is placed directly upon an md device and md_chunk_alignment is - # enabled this parameter is ignored. + # If a PV is placed directly upon an md device and md_chunk_alignment or + # data_alignment_detection is enabled this parameter is ignored. # Set to 0 for the default alignment of 64KB or page size, if larger. data_alignment = 0 --- LVM2/lib/config/defaults.h 2009/08/01 17:07:37 1.48 +++ LVM2/lib/config/defaults.h 2009/08/01 17:08:44 1.49 @@ -35,6 +35,7 @@ #define DEFAULT_MD_CHUNK_ALIGNMENT 1 #define DEFAULT_IGNORE_SUSPENDED_DEVICES 1 #define DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION 1 +#define DEFAULT_DATA_ALIGNMENT_DETECTION 1 #define DEFAULT_LOCK_DIR "/var/lock/lvm" #define DEFAULT_LOCKING_LIB "liblvm2clusterlock.so" --- LVM2/lib/device/device.c 2009/08/01 17:07:37 1.28 +++ LVM2/lib/device/device.c 2009/08/01 17:08:44 1.29 @@ -285,13 +285,36 @@ #ifdef linux +static int _primary_dev(const char *sysfs_dir, + struct device *dev, dev_t *result) +{ + char path[PATH_MAX+1]; + struct stat info; + + /* check if dev is a partition */ + if (dm_snprintf(path, PATH_MAX, "%s/dev/block/%d:%d/partition", + sysfs_dir, (int)MAJOR(dev->dev), (int)MINOR(dev->dev)) < 0) { + log_error("dm_snprintf partition failed"); + return 0; + } + + if (stat(path, &info) < 0) + return 0; + + *result = dev->dev - + (MINOR(dev->dev) % max_partitions(MAJOR(dev->dev))); + return 1; +} + static unsigned long _dev_topology_attribute(const char *attribute, const char *sysfs_dir, struct device *dev) { + const char *sysfs_fmt_str = "%s/dev/block/%d:%d/%s"; char path[PATH_MAX+1], buffer[64]; FILE *fp; struct stat info; + dev_t uninitialized_var(primary); unsigned long result = 0UL; if (!attribute || !*attribute) @@ -300,16 +323,32 @@ if (!sysfs_dir || !*sysfs_dir) return_0; - if (dm_snprintf(path, PATH_MAX, "%s/dev/block/%d:%d/%s", - sysfs_dir, (int)MAJOR(dev->dev), (int)MINOR(dev->dev), + if (dm_snprintf(path, PATH_MAX, sysfs_fmt_str, sysfs_dir, + (int)MAJOR(dev->dev), (int)MINOR(dev->dev), attribute) < 0) { log_error("dm_snprintf %s failed", attribute); return 0; } - /* check if the desired sysfs attribute exists */ - if (stat(path, &info) < 0) - return 0; + /* + * check if the desired sysfs attribute exists + * - if not: either the kernel doesn't have topology support + * or the device could be a partition + */ + if (stat(path, &info) < 0) { + if (!_primary_dev(sysfs_dir, dev, &primary)) + return 0; + + /* get attribute from partition's primary device */ + if (dm_snprintf(path, PATH_MAX, sysfs_fmt_str, sysfs_dir, + (int)MAJOR(primary), (int)MINOR(primary), + attribute) < 0) { + log_error("primary dm_snprintf %s failed", attribute); + return 0; + } + if (stat(path, &info) < 0) + return 0; + } if (!(fp = fopen(path, "r"))) { log_sys_error("fopen", path); @@ -344,6 +383,20 @@ sysfs_dir, dev); } +unsigned long dev_minimum_io_size(const char *sysfs_dir, + struct device *dev) +{ + return _dev_topology_attribute("queue/minimum_io_size", + sysfs_dir, dev); +} + +unsigned long dev_optimal_io_size(const char *sysfs_dir, + struct device *dev) +{ + return _dev_topology_attribute("queue/optimal_io_size", + sysfs_dir, dev); +} + #else unsigned long dev_alignment_offset(const char *sysfs_dir, @@ -352,4 +405,16 @@ return 0UL; } +unsigned long dev_minimum_io_size(const char *sysfs_dir, + struct device *dev) +{ + return 0UL; +} + +unsigned long dev_optimal_io_size(const char *sysfs_dir, + struct device *dev) +{ + return 0UL; +} + #endif --- LVM2/lib/device/device.h 2009/08/01 17:07:37 1.41 +++ LVM2/lib/device/device.h 2009/08/01 17:08:44 1.42 @@ -103,4 +103,10 @@ unsigned long dev_alignment_offset(const char *sysfs_dir, struct device *dev); +unsigned long dev_minimum_io_size(const char *sysfs_dir, + struct device *dev); + +unsigned long dev_optimal_io_size(const char *sysfs_dir, + struct device *dev); + #endif --- LVM2/lib/metadata/metadata.c 2009/08/01 17:07:37 1.276 +++ LVM2/lib/metadata/metadata.c 2009/08/01 17:08:44 1.277 @@ -86,6 +86,25 @@ dev_md_stripe_width(pv->fmt->cmd->sysfs_dir, pv->dev)); + /* + * Align to topology's minimum_io_size or optimal_io_size if present + * - minimum_io_size - the smallest request the device can perform + * w/o incurring a read-modify-write penalty (e.g. MD's chunk size) + * - optimal_io_size - the device's preferred unit of receiving I/O + * (e.g. MD's stripe width) + */ + if (find_config_tree_bool(pv->fmt->cmd, + "devices/data_alignment_detection", + DEFAULT_DATA_ALIGNMENT_DETECTION)) { + pv->pe_align = MAX(pv->pe_align, + dev_minimum_io_size(pv->fmt->cmd->sysfs_dir, + pv->dev)); + + pv->pe_align = MAX(pv->pe_align, + dev_optimal_io_size(pv->fmt->cmd->sysfs_dir, + pv->dev)); + } + log_very_verbose("%s: Setting PE alignment to %lu sectors.", dev_name(pv->dev), pv->pe_align); --- LVM2/man/lvm.conf.5.in 2009/08/01 17:07:37 1.5 +++ LVM2/man/lvm.conf.5.in 2009/08/01 17:08:44 1.6 @@ -137,11 +137,23 @@ directly upon an md device, LVM2 will align its data blocks with the md device's stripe-width. .IP +\fBdata_alignment_detection\fP \(em If set to 1, and your kernel provides +topology information in sysfs for the Physical Volume, the start of data +area will be aligned on a multiple of the ??????minimum_io_size?????? or +??????optimal_io_size?????? exposed in sysfs. minimum_io_size is the smallest +request the device can perform without incurring a read-modify-write +penalty (e.g. MD's chunk size). optimal_io_size is the device's +preferred unit of receiving I/O (e.g. MD's stripe width). minimum_io_size +is used if optimal_io_size is undefined (0). If both \fBmd_chunk_alignment\fP +and \fBdata_alignment_detection\fP are enabled the result of +\fBdata_alignment_detection\fP is used. +.IP \fBdata_alignment\fP \(em Default alignment (in KB) of start of data area when creating a new Physical Volume using the \fBlvm2\fP format. If a Physical Volume is placed directly upon an md device and -\fBmd_chunk_alignment\fP is enabled this parameter is ignored. -Set to 0 to use the default alignment of 64KB or the page size, if larger. +\fBmd_chunk_alignment\fP or \fBdata_alignment_detection\fP is enabled +this parameter is ignored. Set to 0 to use the default alignment of +64KB or the page size, if larger. .IP \fBdata_alignment_offset_detection\fP \(em If set to 1, and your kernel provides topology information in sysfs for the Physical Volume, the From snitzer@sourceware.org Sat Aug 1 17:09:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Sat, 01 Aug 2009 17:09:00 -0000 Subject: LVM2/lib/device device.c Message-ID: <20090801170948.2513.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-08-01 17:09:48 Modified files: lib/device : device.c Log message: Improve ability to lookup primary device associated with a partition Improve lib/device/device.c:_primary_dev()'s ability to look up the primary device associated with all partitions; including blkext (e.g. partitions directly on MD). The same will also work for obscure sysfs paths; e.g.: paths with mangled names like the HP cciss driver uses: /sys/block/cciss!c0d0/cciss!c0d0p1/ Signed-off-by: Mike Snitzer Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30 --- LVM2/lib/device/device.c 2009/08/01 17:08:44 1.29 +++ LVM2/lib/device/device.c 2009/08/01 17:09:48 1.30 @@ -13,6 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include /* dirname, basename */ #include "lib.h" #include "lvm-types.h" #include "device.h" @@ -289,21 +290,71 @@ struct device *dev, dev_t *result) { char path[PATH_MAX+1]; + char temp_path[PATH_MAX+1]; + char buffer[64]; struct stat info; + FILE *fp; + uint32_t pri_maj, pri_min; + int ret = 0; /* check if dev is a partition */ if (dm_snprintf(path, PATH_MAX, "%s/dev/block/%d:%d/partition", sysfs_dir, (int)MAJOR(dev->dev), (int)MINOR(dev->dev)) < 0) { log_error("dm_snprintf partition failed"); - return 0; + return ret; } if (stat(path, &info) < 0) - return 0; + return ret; - *result = dev->dev - - (MINOR(dev->dev) % max_partitions(MAJOR(dev->dev))); - return 1; + /* + * extract parent's path from the partition's symlink, e.g.: + * - readlink /sys/dev/block/259:0 = ../../block/md0/md0p1 + * - dirname ../../block/md0/md0p1 = ../../block/md0 + * - basename ../../block/md0/md0 = md0 + * Parent's 'dev' sysfs attribute = /sys/block/md0/dev + */ + if (readlink(dirname(path), temp_path, PATH_MAX) < 0) { + log_sys_error("readlink", path); + return ret; + } + + if (dm_snprintf(path, PATH_MAX, "%s/block/%s/dev", + sysfs_dir, basename(dirname(temp_path))) < 0) { + log_error("dm_snprintf dev failed"); + return ret; + } + + /* finally, parse 'dev' attribute and create corresponding dev_t */ + if (stat(path, &info) < 0) { + log_error("sysfs file %s does not exist", path); + return ret; + } + + fp = fopen(path, "r"); + if (!fp) { + log_sys_error("fopen", path); + return ret; + } + + if (!fgets(buffer, sizeof(buffer), fp)) { + log_sys_error("fgets", path); + goto out; + } + + if (sscanf(buffer, "%d:%d", &pri_maj, &pri_min) != 2) { + log_error("sysfs file %s not in expected MAJ:MIN format: %s", + path, buffer); + goto out; + } + *result = MKDEV(pri_maj, pri_min); + ret = 1; + +out: + if (fclose(fp)) + log_sys_error("fclose", path); + + return ret; } static unsigned long _dev_topology_attribute(const char *attribute, From snitzer@sourceware.org Sat Aug 1 17:11:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Sat, 01 Aug 2009 17:11:00 -0000 Subject: LVM2/lib/device dev-md.c device.c device.h Message-ID: <20090801171102.3016.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-08-01 17:11:02 Modified files: lib/device : dev-md.c device.c device.h Log message: Retrieve MD sysfs attributes for MD partitions Rename private _primary_dev() to a public get_primary_dev() and reuse it to allow retrieval of the MD sysfs attributes (raid level, etc) for MD partitions. Signed-off-by: Mike Snitzer Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-md.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.h.diff?cvsroot=lvm2&r1=1.42&r2=1.43 --- LVM2/lib/device/dev-md.c 2009/07/20 18:44:13 1.16 +++ LVM2/lib/device/dev-md.c 2009/08/01 17:11:02 1.17 @@ -127,20 +127,25 @@ static int _md_sysfs_attribute_snprintf(char *path, size_t size, const char *sysfs_dir, - struct device *dev, + struct device *blkdev, const char *attribute) { struct stat info; + dev_t dev = blkdev->dev; int ret = -1; - if (MAJOR(dev->dev) != md_major()) + if (!sysfs_dir || !*sysfs_dir) return ret; - if (!sysfs_dir || !*sysfs_dir) +check_md_major: + if (MAJOR(dev) != md_major()) { + if (get_primary_dev(sysfs_dir, blkdev, &dev)) + goto check_md_major; return ret; + } ret = dm_snprintf(path, size, "%s/dev/block/%d:%d/md/%s", sysfs_dir, - (int)MAJOR(dev->dev), (int)MINOR(dev->dev), attribute); + (int)MAJOR(dev), (int)MINOR(dev), attribute); if (ret < 0) { log_error("dm_snprintf md %s failed", attribute); return ret; @@ -149,7 +154,7 @@ if (stat(path, &info) < 0) { /* old sysfs structure */ ret = dm_snprintf(path, size, "%s/block/md%d/md/%s", - sysfs_dir, (int)MINOR(dev->dev), attribute); + sysfs_dir, (int)MINOR(dev), attribute); if (ret < 0) { log_error("dm_snprintf old md %s failed", attribute); return ret; --- LVM2/lib/device/device.c 2009/08/01 17:09:48 1.30 +++ LVM2/lib/device/device.c 2009/08/01 17:11:02 1.31 @@ -286,8 +286,8 @@ #ifdef linux -static int _primary_dev(const char *sysfs_dir, - struct device *dev, dev_t *result) +int get_primary_dev(const char *sysfs_dir, + struct device *dev, dev_t *result) { char path[PATH_MAX+1]; char temp_path[PATH_MAX+1]; @@ -387,7 +387,7 @@ * or the device could be a partition */ if (stat(path, &info) < 0) { - if (!_primary_dev(sysfs_dir, dev, &primary)) + if (!get_primary_dev(sysfs_dir, dev, &primary)) return 0; /* get attribute from partition's primary device */ @@ -450,6 +450,12 @@ #else +int get_primary_dev(const char *sysfs_dir, + struct device *dev, dev_t *result) +{ + return 0; +} + unsigned long dev_alignment_offset(const char *sysfs_dir, struct device *dev) { --- LVM2/lib/device/device.h 2009/08/01 17:08:44 1.42 +++ LVM2/lib/device/device.h 2009/08/01 17:11:02 1.43 @@ -100,6 +100,9 @@ int is_partitioned_dev(struct device *dev); +int get_primary_dev(const char *sysfs_dir, + struct device *dev, dev_t *result); + unsigned long dev_alignment_offset(const char *sysfs_dir, struct device *dev); From snitzer@sourceware.org Sat Aug 1 17:14:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Sat, 01 Aug 2009 17:14:00 -0000 Subject: LVM2/lib/device dev-md.c device.c Message-ID: <20090801171453.4548.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-08-01 17:14:52 Modified files: lib/device : dev-md.c device.c Log message: Fix error handling of device-related stat() calls to be ENOENT aware. Signed-off-by: Mike Snitzer Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-md.c.diff?cvsroot=lvm2&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32 --- LVM2/lib/device/dev-md.c 2009/08/01 17:11:02 1.17 +++ LVM2/lib/device/dev-md.c 2009/08/01 17:14:52 1.18 @@ -151,7 +151,11 @@ return ret; } - if (stat(path, &info) < 0) { + if (stat(path, &info) == -1) { + if (errno != ENOENT) { + log_sys_error("stat", path); + return ret; + } /* old sysfs structure */ ret = dm_snprintf(path, size, "%s/block/md%d/md/%s", sysfs_dir, (int)MINOR(dev), attribute); --- LVM2/lib/device/device.c 2009/08/01 17:11:02 1.31 +++ LVM2/lib/device/device.c 2009/08/01 17:14:52 1.32 @@ -304,8 +304,11 @@ return ret; } - if (stat(path, &info) < 0) + if (stat(path, &info) == -1) { + if (errno != ENOENT) + log_sys_error("stat", path); return ret; + } /* * extract parent's path from the partition's symlink, e.g.: @@ -326,8 +329,11 @@ } /* finally, parse 'dev' attribute and create corresponding dev_t */ - if (stat(path, &info) < 0) { - log_error("sysfs file %s does not exist", path); + if (stat(path, &info) == -1) { + if (errno == ENOENT) + log_error("sysfs file %s does not exist", path); + else + log_sys_error("stat", path); return ret; } @@ -386,7 +392,11 @@ * - if not: either the kernel doesn't have topology support * or the device could be a partition */ - if (stat(path, &info) < 0) { + if (stat(path, &info) == -1) { + if (errno != ENOENT) { + log_sys_error("stat", path); + return 0; + } if (!get_primary_dev(sysfs_dir, dev, &primary)) return 0; @@ -397,8 +407,11 @@ log_error("primary dm_snprintf %s failed", attribute); return 0; } - if (stat(path, &info) < 0) + if (stat(path, &info) == -1) { + if (errno != ENOENT) + log_sys_error("stat", path); return 0; + } } if (!(fp = fopen(path, "r"))) { From mornfall@sourceware.org Sun Aug 2 21:01:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Sun, 02 Aug 2009 21:01:00 -0000 Subject: LVM2 ./WHATS_NEW man/lvconvert.8.in Message-ID: <20090802210152.30200.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-08-02 21:01:52 Modified files: . : WHATS_NEW man : lvconvert.8.in Log message: Update synopsis in lvconvert manpage to mention --repair. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1225&r2=1.1226 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.in.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/WHATS_NEW 2009/08/01 17:08:43 1.1225 +++ LVM2/WHATS_NEW 2009/08/02 21:01:51 1.1226 @@ -1,5 +1,6 @@ Version 2.02.51 - ================================ + Update synopsis in lvconvert manpage to mention --repair. Set cookies in activation code and wait for udev to complete processing. Added configure --enable-udev_rules --enable-udev_sync. Added configure --with-udev-prefix --with-udevdir. --- LVM2/man/lvconvert.8.in 2009/06/30 18:39:32 1.5 +++ LVM2/man/lvconvert.8.in 2009/08/02 21:01:52 1.6 @@ -21,6 +21,13 @@ [\-\-version] .br OriginalLogicalVolume[Path] SnapshotLogicalVolume[Path] + +.B lvconvert +\-\-repair +[\-h|\-?|\-\-help] +[\-v|\-\-verbose] +[\-\-version] +LogicalVolume[Path] [PhysicalVolume[Path]...] .SH DESCRIPTION lvconvert will change a linear logical volume to a mirror logical volume or to a snapshot of linear volume and vice versa. From mornfall@sourceware.org Sun Aug 2 21:03:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Sun, 02 Aug 2009 21:03:00 -0000 Subject: LVM2 ./WHATS_NEW lib/locking/no_locking.c Message-ID: <20090802210309.20342.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-08-02 21:03:09 Modified files: . : WHATS_NEW lib/locking : no_locking.c Log message: Allow LV suspend while --ignorelockingfailure is in force. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1226&r2=1.1227 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/no_locking.c.diff?cvsroot=lvm2&r1=1.17&r2=1.18 --- LVM2/WHATS_NEW 2009/08/02 21:01:51 1.1226 +++ LVM2/WHATS_NEW 2009/08/02 21:03:09 1.1227 @@ -1,5 +1,6 @@ Version 2.02.51 - ================================ + Allow LV suspend while --ignorelockingfailure is in force. Update synopsis in lvconvert manpage to mention --repair. Set cookies in activation code and wait for udev to complete processing. Added configure --enable-udev_rules --enable-udev_sync. --- LVM2/lib/locking/no_locking.c 2009/07/15 06:11:25 1.17 +++ LVM2/lib/locking/no_locking.c 2009/08/02 21:03:09 1.18 @@ -70,7 +70,8 @@ const char *resource, uint32_t flags) { - if ((flags & LCK_TYPE_MASK) == LCK_WRITE) { + if ((flags & LCK_TYPE_MASK) == LCK_WRITE && + (flags & LCK_SCOPE_MASK) == LCK_VG) { log_error("Write locks are prohibited with --ignorelockingfailure."); return 0; } From mornfall@sourceware.org Sun Aug 2 21:45:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Sun, 02 Aug 2009 21:45:00 -0000 Subject: LVM2/test test-utils.sh t-vgsplit-stacked.sh Message-ID: <20090802214545.8477.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-08-02 21:45:45 Modified files: test : test-utils.sh Added files: test : t-vgsplit-stacked.sh Log message: Add test for RHBZ 481793 (passing, thanks to vg_read changes checked in previously). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-stacked.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.13&r2=1.14 /cvs/lvm2/LVM2/test/t-vgsplit-stacked.sh,v --> standard output revision 1.1 --- LVM2/test/t-vgsplit-stacked.sh +++ - 2009-08-02 21:45:45.854012000 +0000 @@ -0,0 +1,18 @@ +. ./test-utils.sh + +prepare_lvmconf '[ "a/dev\/mirror/", "a/dev\/mapper\/.*$/", "r/.*/" ]' +aux prepare_devs 3 + +pvcreate $devs +vgcreate $vg1 $dev1 $dev2 +lvcreate -n $lv1 -l 100%FREE $vg1 + +#top VG +pvcreate $G_dev_/$vg1/$lv1 +vgcreate $vg $G_dev_/$vg1/$lv1 $dev3 + +vgchange -a n $vg +vgchange -a n $vg1 + +# this should fail but not segfault, RHBZ 481793. +not vgsplit $vg $vg1 $dev3 --- LVM2/test/test-utils.sh 2009/05/13 21:29:10 1.13 +++ LVM2/test/test-utils.sh 2009/08/02 21:45:45 1.14 @@ -178,11 +178,14 @@ } prepare_lvmconf() { + local filter="$1" + test -z "$filter" && \ + filter='[ "a/dev\/mirror/", "a/dev\/mapper\/.*pv[0-9_]*$/", "r/.*/" ]' cat > $G_root_/etc/lvm.conf <<-EOF devices { dir = "$G_dev_" scan = "$G_dev_" - filter = [ "a/dev\/mirror/", "a/dev\/mapper\/.*pv[0-9_]*$/", "r/.*/" ] + filter = $filter cache_dir = "$G_root_/etc" sysfs_scan = 0 } From mornfall@sourceware.org Sun Aug 2 21:56:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Sun, 02 Aug 2009 21:56:00 -0000 Subject: LVM2/tools lvconvert.c Message-ID: <20090802215630.11769.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-08-02 21:56:29 Modified files: tools : lvconvert.c Log message: Slightly refactor mirror log conversions in lvconvert. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.89&r2=1.90 --- LVM2/tools/lvconvert.c 2009/07/15 05:47:55 1.89 +++ LVM2/tools/lvconvert.c 2009/08/02 21:56:29 1.90 @@ -496,6 +496,33 @@ } } +static int _using_corelog(struct logical_volume *lv) +{ + return !first_seg(_original_lv(lv))->log_lv; +} + +static int _lv_update_log_type(struct cmd_context *cmd, + struct lvconvert_params *lp, + struct logical_volume *lv, + int corelog) +{ + struct logical_volume *original_lv = _original_lv(lv); + if (_using_corelog(lv) && !corelog) { + if (!add_mirror_log(cmd, original_lv, 1, + adjusted_mirror_region_size( + lv->vg->extent_size, + lv->le_count, + lp->region_size), + lp->pvh, lp->alloc)) + return_0; + } else if (!_using_corelog(lv) && corelog) { + if (!remove_mirror_log(cmd, original_lv, + lp->pv_count ? lp->pvh : NULL)) + return_0; + } + return 1; +} + static int _lvconvert_mirrors(struct cmd_context *cmd, struct logical_volume *lv, struct lvconvert_params *lp) { @@ -503,7 +530,6 @@ uint32_t existing_mirrors; const char *mirrorlog; unsigned corelog = 0; - struct logical_volume *original_lv; int r = 0; struct logical_volume *log_lv; int failed_mirrors = 0, failed_log = 0; @@ -688,20 +714,8 @@ * insertion to make the end result consistent with * linear-to-mirror conversion. */ - original_lv = _original_lv(lv); - if (!first_seg(original_lv)->log_lv && !corelog) { - if (!add_mirror_log(cmd, original_lv, 1, - adjusted_mirror_region_size( - lv->vg->extent_size, - lv->le_count, - lp->region_size), - lp->pvh, lp->alloc)) - return_0; - } else if (first_seg(original_lv)->log_lv && corelog) { - if (!remove_mirror_log(cmd, original_lv, - lp->pv_count ? lp->pvh : NULL)) - return_0; - } + if (!_lv_update_log_type(cmd, lp, lv, corelog)) + return_0; /* Insert a temporary layer for syncing, * only if the original lv is using disk log. */ if (seg->log_lv && !_insert_lvconvert_layer(cmd, lv)) { @@ -722,24 +736,10 @@ } if (lp->mirrors == existing_mirrors) { - /* - * Convert Mirror log type - */ - original_lv = _original_lv(lv); - if (!first_seg(original_lv)->log_lv && !corelog) { - if (!add_mirror_log(cmd, original_lv, 1, - adjusted_mirror_region_size( - lv->vg->extent_size, - lv->le_count, - lp->region_size), - lp->pvh, lp->alloc)) - return_0; - } else if (first_seg(original_lv)->log_lv && corelog) { - if (!remove_mirror_log(cmd, original_lv, - lp->pv_count ? lp->pvh : NULL)) + if (_using_corelog(lv) != corelog) { + if (!_lv_update_log_type(cmd, lp, lv, corelog)) return_0; } else { - /* No change */ log_error("Logical volume %s already has %" PRIu32 " mirror(s).", lv->name, lp->mirrors - 1); From mornfall@sourceware.org Sun Aug 2 21:59:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Sun, 02 Aug 2009 21:59:00 -0000 Subject: LVM2 ./WHATS_NEW test/t-mirror-lvconvert.sh to ... Message-ID: <20090802215921.13790.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-08-02 21:59:21 Modified files: . : WHATS_NEW test : t-mirror-lvconvert.sh tools : lvconvert.c Log message: Make lvconvert honour log mirror options combined with downconversion. (RHBZ 463272) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1227&r2=1.1228 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-mirror-lvconvert.sh.diff?cvsroot=lvm2&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91 --- LVM2/WHATS_NEW 2009/08/02 21:03:09 1.1227 +++ LVM2/WHATS_NEW 2009/08/02 21:59:21 1.1228 @@ -1,5 +1,6 @@ Version 2.02.51 - ================================ + Make lvconvert honour log mirror options combined with downconversion. Allow LV suspend while --ignorelockingfailure is in force. Update synopsis in lvconvert manpage to mention --repair. Set cookies in activation code and wait for udev to complete processing. --- LVM2/test/t-mirror-lvconvert.sh 2009/06/01 14:43:28 1.10 +++ LVM2/test/t-mirror-lvconvert.sh 2009/08/02 21:59:21 1.11 @@ -321,3 +321,9 @@ check_mirror_count_ $vg/$lv1 2 check_mirror_log_ $vg/$lv1 check_and_cleanup_lvs_ + +# BZ 463272: disk log mirror convert option is lost if downconvert option is also given +prepare_lvs_ +lvcreate -l1 -m2 --corelog -n $lv1 $vg +lvconvert -m1 --mirrorlog disk $vg/$lv1 +check_mirror_log_ $vg/$lv1 --- LVM2/tools/lvconvert.c 2009/08/02 21:56:29 1.90 +++ LVM2/tools/lvconvert.c 2009/08/02 21:59:21 1.91 @@ -673,6 +673,9 @@ (corelog || lp->mirrors == 1) ? 1U : 0U, remove_pvs, 0)) return_0; + if (lp->mirrors > 1 && + !_lv_update_log_type(cmd, lp, lv, corelog)) + return_0; } else if (!(lv->status & MIRRORED)) { /* * Converting from linear to mirror From agk@sourceware.org Mon Aug 3 10:58:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 03 Aug 2009 10:58:00 -0000 Subject: LVM2/man lvchange.8.in Message-ID: <20090803105841.24659.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-03 10:58:41 Modified files: man : lvchange.8.in Log message: lvchange --noudevsync Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvchange.8.in.diff?cvsroot=lvm2&r1=1.3&r2=1.4 --- LVM2/man/lvchange.8.in 2008/11/12 15:01:36 1.3 +++ LVM2/man/lvchange.8.in 2009/08/03 10:58:40 1.4 @@ -12,6 +12,7 @@ [\-\-ignorelockingfailure] [\-\-ignoremonitoring] [\-\-monitor {y|n}] +[\-\-noudevsync] [\-M|\-\-persistent y|n] [\-\-minor minor] [\-P|\-\-partial] [\-p|\-\-permission r|rw] [\-r/\-\-readahead ReadAheadSectors|auto|none] @@ -61,6 +62,13 @@ \fBmirror_image_fault_policy\fP and \fBmirror_log_fault_policy\fP set in \fBlvm.conf\fP. .TP +.I \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. +.TP .I \-\-ignoremonitoring Make no attempt to interact with dmeventd unless \-\-monitor is specified. From agk@sourceware.org Mon Aug 3 11:01:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 03 Aug 2009 11:01:00 -0000 Subject: LVM2/libdm libdm-common.c Message-ID: <20090803110127.31230.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-03 11:01:26 Modified files: libdm : libdm-common.c Log message: deal with error-related FIXMEs Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.69&r2=1.70 --- LVM2/libdm/libdm-common.c 2009/07/31 17:51:46 1.69 +++ LVM2/libdm/libdm-common.c 2009/08/03 11:01:26 1.70 @@ -818,7 +818,13 @@ static int _get_cookie_sem(uint32_t cookie, int *semid) { - /* FIXME Ensure cookie has COOKIE_MAGIC prefix */ + if (!(cookie >> 16 & COOKIE_MAGIC)) { + log_error("Could not continue to access notification " + "semaphore identified by cookie value %" + PRIu32 " (0x%x). Incorrect cookie prefix."); + return 0; + } + if ((*semid = semget((key_t) cookie, 1, 0)) >= 0) return 1; @@ -836,11 +842,10 @@ cookie, cookie); break; default: - /* FIXME errno use missing */ log_error("Failed to access notification " "semaphore identified by cookie " - "value %" PRIu32 " (0x%x)", - cookie, cookie); + "value %" PRIu32 " (0x%x): %s", + cookie, cookie, strerror(errno)); break; } @@ -851,26 +856,42 @@ { struct sembuf sb = {0, 1, 0}; - /* FIXME errno use missing */ - return semop(semid, &sb, 1) == 0; + if (semop(semid, &sb, 1) < 0) { + log_error("semid %d: semop failed: %s", semid, strerror(errno)); + return 0; + } + + return 1; } static int _udev_notify_sem_dec(int semid) { - /* FIXME Think we should have IPC_NOWAIT here in case something went wrong and it's already 0 */ - struct sembuf sb = {0, -1, 0}; + struct sembuf sb = {0, -1, IPC_NOWAIT}; + + if (semop(semid, &sb, 1) < 0) { + switch (errno) { + case EAGAIN: + log_error("semid %d: semop failed: " + "incorrect semaphore state", + semid); + break; + default: + log_error("semid %d: semop failed: %s", + semid, strerror(errno)); + break; + } + return 0; + } - /* FIXME errno use missing */ - return semop(semid, &sb, 1) == 0; + return 1; } static int _udev_notify_sem_destroy(int semid, uint32_t cookie) { - /* FIXME errno use missing */ if (semctl(semid, 0, IPC_RMID, 0) < 0) { log_error("Could not cleanup notification semaphore " - "identified by cookie value %" PRIu32 " (0x%x)", - cookie, cookie); + "identified by cookie value %" PRIu32 " (0x%x): %s", + cookie, cookie, strerror(errno)); return 0; } @@ -914,22 +935,21 @@ "notification semaphore"); goto bad; case ENOSPC: - /* FIXME Suggest what to check & do */ log_error("Limit for the maximum number " - "of semaphores reached"); + "of semaphores reached. You can " + "check and set the limits in " + "/proc/sys/kernel/sem."); goto bad; default: - /* FIXME Use errno */ - log_error("Failed to create " - "notification semaphore"); + log_error("Failed to create notification " + "semaphore: %s", strerror(errno)); goto bad; } } } while (!base_cookie); if (semctl(gen_semid, 0, SETVAL, 1) < 0) { - /* FIXME Use errno and give gen_semid */ - log_error("Failed to initialize notification semaphore"); + log_error("semid %d: semctl failed: %s", gen_semid, strerror(errno)); /* We have to destroy just created semaphore * so it won't stay in the system. */ _udev_notify_sem_destroy(gen_semid, gen_cookie); @@ -1027,10 +1047,9 @@ if (semop(semid, &sb, 1) < 0) { if (errno == EINTR) goto repeat_wait; - /* FIXME missing errno use */ log_error("Could not set wait state for notification semaphore " - "identified by cookie value %" PRIu32 " (0x%x)", - cookie, cookie); + "identified by cookie value %" PRIu32 " (0x%x): %s", + cookie, cookie, strerror(errno)); _udev_notify_sem_destroy(semid, cookie); return 0; } From agk@sourceware.org Mon Aug 3 11:20:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 03 Aug 2009 11:20:00 -0000 Subject: LVM2 tools/dmsetup.c libdm/libdm-common.c lib/ ... Message-ID: <20090803112017.17487.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-03 11:20:16 Modified files: tools : dmsetup.c libdm : libdm-common.c lib/activate : dev_manager.c Log message: cleanup some ignored return values & 'stack's Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.118&r2=1.119 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.154&r2=1.155 --- LVM2/tools/dmsetup.c 2009/07/31 17:51:46 1.118 +++ LVM2/tools/dmsetup.c 2009/08/03 11:20:15 1.119 @@ -593,7 +593,7 @@ goto out; } - dm_udev_wait(cookie); + (void) dm_udev_wait(cookie); r = 1; @@ -631,7 +631,7 @@ goto out; } - dm_udev_wait(cookie); + (void) dm_udev_wait(cookie); r = 1; --- LVM2/libdm/libdm-common.c 2009/08/03 11:01:26 1.70 +++ LVM2/libdm/libdm-common.c 2009/08/03 11:20:16 1.71 @@ -1065,7 +1065,7 @@ return 1; if (!_get_cookie_sem(cookie, &semid)) - return 0; + return_0; return _udev_notify_sem_destroy(semid, cookie); } --- LVM2/lib/activate/dev_manager.c 2009/07/31 18:30:31 1.154 +++ LVM2/lib/activate/dev_manager.c 2009/08/03 11:20:16 1.155 @@ -1133,10 +1133,11 @@ dm_tree_set_cookie(root, 0); if (!dm_tree_deactivate_children(root, uuid, strlen(uuid))) { - dm_udev_cleanup(dm_tree_get_cookie(root)); + (void) dm_udev_cleanup(dm_tree_get_cookie(root)); return_0; } - dm_udev_wait(dm_tree_get_cookie(root)); + if (!dm_udev_wait(dm_tree_get_cookie(root))) + stack; } return 1; @@ -1171,10 +1172,11 @@ /* Deactivate LV and all devices it references that nothing else has open. */ dm_tree_set_cookie(root, 0); if (!dm_tree_deactivate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) { - dm_udev_cleanup(dm_tree_get_cookie(root)); + (void) dm_udev_cleanup(dm_tree_get_cookie(root)); goto_out; } - dm_udev_wait(dm_tree_get_cookie(root)); + if (!dm_udev_wait(dm_tree_get_cookie(root))) + stack; if (!_remove_lv_symlinks(dm, root)) log_error("Failed to remove all device symlinks associated with %s.", lv->name); break; @@ -1195,10 +1197,11 @@ /* Preload any devices required before any suspensions */ dm_tree_set_cookie(root, 0); if (!dm_tree_preload_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) { - dm_udev_cleanup(dm_tree_get_cookie(root)); + (void) dm_udev_cleanup(dm_tree_get_cookie(root)); goto_out; } - dm_udev_wait(dm_tree_get_cookie(root)); + if (!dm_udev_wait(dm_tree_get_cookie(root))) + stack; if (dm_tree_node_size_changed(root)) dm->flush_required = 1; @@ -1206,10 +1209,11 @@ if (action == ACTIVATE) { dm_tree_set_cookie(root, 0); if (!dm_tree_activate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) { - dm_udev_cleanup(dm_tree_get_cookie(root)); + (void) dm_udev_cleanup(dm_tree_get_cookie(root)); goto_out; } - dm_udev_wait(dm_tree_get_cookie(root)); + if (!dm_udev_wait(dm_tree_get_cookie(root))) + stack; } if (!_create_lv_symlinks(dm, root)) { From wysochanski@sourceware.org Mon Aug 3 12:11:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 03 Aug 2009 12:11:00 -0000 Subject: LVM2/liblvm lvm2app.h lvm_vg.c Message-ID: <20090803121145.22909.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-03 12:11:45 Modified files: liblvm : lvm2app.h lvm_vg.c Log message: Move FIXME from user visible lvm2app.h to lvm_vg.c Author: Dave Wysochanski Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm2app.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_vg.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25 --- LVM2/liblvm/lvm2app.h 2009/07/29 18:38:27 1.2 +++ LVM2/liblvm/lvm2app.h 2009/08/03 12:11:45 1.3 @@ -265,7 +265,6 @@ /** * Scan all devices on the system for VGs and LVM metadata. - * FIXME: Elaborate on when to use, side-effects, .cache file, etc * * \return * 0 (success) or -1 (failure). --- LVM2/liblvm/lvm_vg.c 2009/07/29 13:26:01 1.24 +++ LVM2/liblvm/lvm_vg.c 2009/08/03 12:11:45 1.25 @@ -309,6 +309,9 @@ return get_vgids((struct cmd_context *)libh, 0); } +/* + * FIXME: Elaborate on when to use, side-effects, .cache file, etc + */ int lvm_scan(lvm_t libh) { if (!lvmcache_label_scan((struct cmd_context *)libh, 2)) From agk@sourceware.org Mon Aug 3 18:01:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 03 Aug 2009 18:01:00 -0000 Subject: LVM2 lib/activate/dev_manager.c tools/dmsetup. ... Message-ID: <20090803180151.29215.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-03 18:01:49 Modified files: lib/activate : dev_manager.c tools : dmsetup.c libdm : .exported_symbols libdevmapper.h libdm-common.c libdm-deptree.c libdm/ioctl : libdm-iface.c libdm-targets.h Log message: Manage without dm_udev_cleanup? Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.155&r2=1.156 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.119&r2=1.120 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/.exported_symbols.diff?cvsroot=lvm2&r1=1.41&r2=1.42 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.94&r2=1.95 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-targets.h.diff?cvsroot=lvm2&r1=1.24&r2=1.25 --- LVM2/lib/activate/dev_manager.c 2009/08/03 11:20:16 1.155 +++ LVM2/lib/activate/dev_manager.c 2009/08/03 18:01:45 1.156 @@ -1114,6 +1114,7 @@ struct dm_tree_node *child; char *vgname, *lvname, *layer; const char *name, *uuid; + int r; while ((child = dm_tree_next_child(&handle, root, 0))) { if (!(name = dm_tree_node_get_name(child))) @@ -1132,12 +1133,12 @@ continue; dm_tree_set_cookie(root, 0); - if (!dm_tree_deactivate_children(root, uuid, strlen(uuid))) { - (void) dm_udev_cleanup(dm_tree_get_cookie(root)); - return_0; - } + r = dm_tree_deactivate_children(root, uuid, strlen(uuid)); if (!dm_udev_wait(dm_tree_get_cookie(root))) stack; + + if (!r) + return_0; } return 1; @@ -1171,12 +1172,11 @@ case DEACTIVATE: /* Deactivate LV and all devices it references that nothing else has open. */ dm_tree_set_cookie(root, 0); - if (!dm_tree_deactivate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) { - (void) dm_udev_cleanup(dm_tree_get_cookie(root)); - goto_out; - } + r = dm_tree_deactivate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1); if (!dm_udev_wait(dm_tree_get_cookie(root))) stack; + if (!r) + goto_out; if (!_remove_lv_symlinks(dm, root)) log_error("Failed to remove all device symlinks associated with %s.", lv->name); break; @@ -1196,24 +1196,22 @@ /* Preload any devices required before any suspensions */ dm_tree_set_cookie(root, 0); - if (!dm_tree_preload_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) { - (void) dm_udev_cleanup(dm_tree_get_cookie(root)); - goto_out; - } + r = dm_tree_preload_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1); if (!dm_udev_wait(dm_tree_get_cookie(root))) stack; + if (!r) + goto_out; if (dm_tree_node_size_changed(root)) dm->flush_required = 1; if (action == ACTIVATE) { dm_tree_set_cookie(root, 0); - if (!dm_tree_activate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) { - (void) dm_udev_cleanup(dm_tree_get_cookie(root)); - goto_out; - } + r = dm_tree_activate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1); if (!dm_udev_wait(dm_tree_get_cookie(root))) stack; + if (!r) + goto_out; } if (!_create_lv_symlinks(dm, root)) { --- LVM2/tools/dmsetup.c 2009/08/03 11:20:15 1.119 +++ LVM2/tools/dmsetup.c 2009/08/03 18:01:46 1.120 @@ -588,12 +588,8 @@ dm_udev_set_sync_support(0); if (!dm_task_set_cookie(dmt, &cookie) || - !dm_task_run(dmt)) { - (void) dm_udev_cleanup(cookie); + !dm_task_run(dmt)) goto out; - } - - (void) dm_udev_wait(cookie); r = 1; @@ -601,6 +597,7 @@ r = _display_info(dmt); out: + (void) dm_udev_wait(cookie); dm_task_destroy(dmt); return r; @@ -626,16 +623,13 @@ goto out; if (!dm_task_set_cookie(dmt, &cookie) || - !dm_task_run(dmt)) { - (void) dm_udev_cleanup(cookie); + !dm_task_run(dmt)) goto out; - } - - (void) dm_udev_wait(cookie); r = 1; out: + (void) dm_udev_wait(cookie); dm_task_destroy(dmt); return r; @@ -816,24 +810,18 @@ _read_ahead_flags)) goto out; - if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie)) { - (void) dm_udev_cleanup(cookie); + if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie)) goto out; - } r = dm_task_run(dmt); - if (udev_wait_flag) { - if (r) - (void) dm_udev_wait(cookie); - else - (void) dm_udev_cleanup(cookie); - } - if (r && display && _switches[VERBOSE_ARG]) r = _display_info(dmt); out: + if (udev_wait_flag) + (void) dm_udev_wait(cookie); + dm_task_destroy(dmt); return r; } --- LVM2/libdm/.exported_symbols 2009/07/31 18:30:31 1.41 +++ LVM2/libdm/.exported_symbols 2009/08/03 18:01:47 1.42 @@ -161,4 +161,3 @@ dm_udev_get_sync_support dm_udev_complete dm_udev_wait -dm_udev_cleanup --- LVM2/libdm/libdevmapper.h 2009/07/31 18:30:32 1.94 +++ LVM2/libdm/libdevmapper.h 2009/08/03 18:01:47 1.95 @@ -1023,6 +1023,5 @@ int dm_udev_get_sync_support(void); int dm_udev_complete(uint32_t cookie); int dm_udev_wait(uint32_t cookie); -int dm_udev_cleanup(uint32_t cookie); #endif /* LIB_DEVICE_MAPPER_H */ --- LVM2/libdm/libdm-common.c 2009/08/03 11:20:16 1.71 +++ LVM2/libdm/libdm-common.c 2009/08/03 18:01:47 1.72 @@ -174,6 +174,7 @@ dmt->no_open_count = 0; dmt->read_ahead = DM_READ_AHEAD_AUTO; dmt->read_ahead_flags = 0; + dmt->cookie_set = 0; return dmt; } @@ -799,11 +800,6 @@ return 1; } -int dm_udev_cleanup(uint32_t cookie) -{ - return 1; -} - #else /* UDEV_SYNC_SUPPORT */ void dm_udev_set_sync_support(int sync_with_udev) @@ -821,7 +817,8 @@ if (!(cookie >> 16 & COOKIE_MAGIC)) { log_error("Could not continue to access notification " "semaphore identified by cookie value %" - PRIu32 " (0x%x). Incorrect cookie prefix."); + PRIu32 " (0x%x). Incorrect cookie prefix.", + cookie, cookie); return 0; } @@ -952,7 +949,7 @@ log_error("semid %d: semctl failed: %s", gen_semid, strerror(errno)); /* We have to destroy just created semaphore * so it won't stay in the system. */ - _udev_notify_sem_destroy(gen_semid, gen_cookie); + (void) _udev_notify_sem_destroy(gen_semid, gen_cookie); goto bad; } @@ -996,6 +993,7 @@ } dmt->event_nr = *cookie; + dmt->cookie_set = 1; return 1; bad: @@ -1039,7 +1037,7 @@ "semaphore identified by cookie value %" PRIu32 " (0x%x) " "to initialize waiting for incoming notifications.", cookie, cookie); - _udev_notify_sem_destroy(semid, cookie); + (void) _udev_notify_sem_destroy(semid, cookie); return 0; } @@ -1050,23 +1048,11 @@ log_error("Could not set wait state for notification semaphore " "identified by cookie value %" PRIu32 " (0x%x): %s", cookie, cookie, strerror(errno)); - _udev_notify_sem_destroy(semid, cookie); + (void) _udev_notify_sem_destroy(semid, cookie); return 0; } return _udev_notify_sem_destroy(semid, cookie); } -int dm_udev_cleanup(uint32_t cookie) -{ - int semid; - - if (!cookie || !dm_udev_get_sync_support() || !dm_cookie_supported()) - return 1; - - if (!_get_cookie_sem(cookie, &semid)) - return_0; - - return _udev_notify_sem_destroy(semid, cookie); -} #endif /* UDEV_SYNC_SUPPORT */ --- LVM2/libdm/libdm-deptree.c 2009/07/31 18:30:32 1.54 +++ LVM2/libdm/libdm-deptree.c 2009/08/03 18:01:47 1.55 @@ -845,9 +845,6 @@ r = dm_task_run(dmt); - if (!r) - (void) dm_udev_complete(*cookie); - /* FIXME Until kernel returns actual name so dm-ioctl.c can handle it */ rm_dev_node(name); @@ -888,9 +885,6 @@ r = dm_task_run(dmt); - if (!r) - (void) dm_udev_complete(*cookie); - out: dm_task_destroy(dmt); @@ -934,8 +928,6 @@ if ((r = dm_task_run(dmt))) r = dm_task_get_info(dmt, newinfo); - else - (void) dm_udev_complete(*cookie); out: dm_task_destroy(dmt); --- LVM2/libdm/ioctl/libdm-iface.c 2009/07/31 15:53:12 1.59 +++ LVM2/libdm/ioctl/libdm-iface.c 2009/08/03 18:01:48 1.60 @@ -1742,9 +1742,18 @@ if (!_open_control()) return 0; + /* FIXME Detect and warn if cookie set but should not be. */ repeat_ioctl: - if (!(dmi = _do_dm_ioctl(dmt, command, _ioctl_buffer_double_factor))) + if (!(dmi = _do_dm_ioctl(dmt, command, _ioctl_buffer_double_factor))) { + /* + * If an operation that uses a cookie fails, decrement the + * semaphore instead of udev. + * FIXME Review error paths: found one where uevent fired too. + */ + if (dmt->cookie_set) + dm_udev_complete(dmt->event_nr); return 0; + } if (dmi->flags & DM_BUFFER_FULL_FLAG) { switch (dmt->type) { --- LVM2/libdm/ioctl/libdm-targets.h 2009/06/17 20:55:25 1.24 +++ LVM2/libdm/ioctl/libdm-targets.h 2009/08/03 18:01:48 1.25 @@ -60,6 +60,7 @@ int skip_lockfs; int suppress_identical_reload; uint64_t existing_table_size; + int cookie_set; char *uuid; }; From agk@sourceware.org Mon Aug 3 18:09:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 03 Aug 2009 18:09:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/dev_manager.c Message-ID: <20090803180926.10360.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-03 18:09:26 Modified files: . : WHATS_NEW lib/activate : dev_manager.c Log message: Only create LV symlinks on ACTIVATE not PRELOAD. (This is the udev behaviour - but does this change break anything?) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1228&r2=1.1229 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.156&r2=1.157 --- LVM2/WHATS_NEW 2009/08/02 21:59:21 1.1228 +++ LVM2/WHATS_NEW 2009/08/03 18:09:25 1.1229 @@ -1,5 +1,6 @@ Version 2.02.51 - ================================ + Only change LV symlinks on ACTIVATE not PRELOAD. Make lvconvert honour log mirror options combined with downconversion. Allow LV suspend while --ignorelockingfailure is in force. Update synopsis in lvconvert manpage to mention --repair. --- LVM2/lib/activate/dev_manager.c 2009/08/03 18:01:45 1.156 +++ LVM2/lib/activate/dev_manager.c 2009/08/03 18:09:26 1.157 @@ -1212,12 +1212,12 @@ stack; if (!r) goto_out; + if (!_create_lv_symlinks(dm, root)) { + log_error("Failed to create symlinks for %s.", lv->name); + goto out; + } } - if (!_create_lv_symlinks(dm, root)) { - log_error("Failed to create symlinks for %s.", lv->name); - goto out; - } break; default: log_error("_tree_action: Action %u not supported.", action); From agk@sourceware.org Mon Aug 3 18:31:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 03 Aug 2009 18:31:00 -0000 Subject: LVM2/lib/activate fs.c Message-ID: <20090803183153.21886.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-03 18:31:53 Modified files: lib/activate : fs.c Log message: Add warnings to check udev did what it was meant to. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.c.diff?cvsroot=lvm2&r1=1.44&r2=1.45 --- LVM2/lib/activate/fs.c 2008/12/19 14:22:48 1.44 +++ LVM2/lib/activate/fs.c 2009/08/03 18:31:53 1.45 @@ -194,9 +194,14 @@ return 0; } - if (lstat(lv_path, &buf) || !S_ISLNK(buf.st_mode)) { - if (errno == ENOENT) - return 1; + if (lstat(lv_path, &buf) && errno == ENOENT) + return 1; + else if (dm_udev_get_sync_support()) + log_warn("The link %s should have been removed by udev " + "but it is still present. Falling back to " + "direct link removal.", lv_path); + + if (!S_ISLNK(buf.st_mode)) { log_error("%s not symbolic link - not removing", lv_path); return 0; } From agk@sourceware.org Mon Aug 3 18:33:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 03 Aug 2009 18:33:00 -0000 Subject: LVM2/libdm libdm-common.c Message-ID: <20090803183308.23850.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-03 18:33:08 Modified files: libdm : libdm-common.c Log message: Add udev checks. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73 --- LVM2/libdm/libdm-common.c 2009/08/03 18:01:47 1.72 +++ LVM2/libdm/libdm-common.c 2009/08/03 18:33:08 1.73 @@ -355,7 +355,9 @@ dev_name); return 0; } - } + } else if (dm_udev_get_sync_support()) + log_warn("%s not set up by udev: Falling back to direct " + "node creation.", path); old_mask = umask(0); if (mknod(path, S_IFBLK | mode, dev) < 0) { @@ -426,6 +428,9 @@ if (stat(path, &info) < 0) return 1; + else if (dm_udev_get_sync_support()) + log_warn("Node %s was not removed by udev. " + "Falling back to direct node removal.", path); if (unlink(path) < 0) { log_error("Unable to unlink device node for '%s'", dev_name); From agk@sourceware.org Mon Aug 3 18:44:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Mon, 03 Aug 2009 18:44:00 -0000 Subject: LVM2 libdm/misc/dm-ioctl.h udev/Makefile.in ud ... Message-ID: <20090803184456.27876.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-03 18:44:55 Modified files: libdm/misc : dm-ioctl.h udev : Makefile.in Added files: udev : 10-dm.rules.in 11-dm-permissions.rules 11-lvm.rules 12-dm-disk.rules 95-dm-notify.rules Log message: Add default udev rules. Update dm-ioctl.h comments. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/misc/dm-ioctl.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/10-dm.rules.in.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/11-dm-permissions.rules.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/11-lvm.rules.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/12-dm-disk.rules.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/95-dm-notify.rules.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/Makefile.in.diff?cvsroot=lvm2&r1=1.1&r2=1.2 --- LVM2/libdm/misc/dm-ioctl.h 2008/10/30 15:31:33 1.1 +++ LVM2/libdm/misc/dm-ioctl.h 2009/08/03 18:44:54 1.2 @@ -125,6 +125,16 @@ uint32_t target_count; /* in/out */ int32_t open_count; /* out */ uint32_t flags; /* in/out */ + + /* + * event_nr holds either the event number (input and output) or the + * udev cookie value (input only). + * The DM_DEV_WAIT ioctl takes an event number as input. + * The DM_SUSPEND, DM_DEV_REMOVE and DM_DEV_RENAME ioctls + * use the field as a cookie to return in the DM_COOKIE + * variable with the uevents they issue. + * For output, the ioctls return the event number, not the cookie. + */ uint32_t event_nr; /* in/out */ uint32_t padding; @@ -258,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 14 +#define DM_VERSION_MINOR 15 #define DM_VERSION_PATCHLEVEL 0 -#define DM_VERSION_EXTRA "-ioctl (2008-04-23)" +#define DM_VERSION_EXTRA "-ioctl (2009-04-01)" /* Status bits */ #define DM_READONLY_FLAG (1 << 0) /* In/Out */ /cvs/lvm2/LVM2/udev/10-dm.rules.in,v --> standard output revision 1.1 --- LVM2/udev/10-dm.rules.in +++ - 2009-08-03 18:44:55.584662000 +0000 @@ -0,0 +1,44 @@ +# Udev rules for device-mapper devices. +# +# These rules create a DM control node in /dev/(DM_DIR) directory. +# The rules also create nodes named dm-x (x is a number) in /dev +# directory and symlinks to these nodes with names given by +# the actual DM names. Some udev environment variables are set +# for use in later rules: +# DM_NAME - actual DM device's name +# DM_UUID - UUID set for DM device (blank if not specified) +# DM_SUSPENDED - suspended state of DM device (0 or 1) + +KERNEL=="device-mapper", NAME="(DM_DIR)/control" + +SUBSYSTEM!="block", GOTO="dm_end" +KERNEL!="dm-[0-9]*", GOTO="dm_end" +ACTION!="add|change", GOTO="dm_end" + +# Normally, we operate on "change" events only. But when +# coldplugging, there's an "add" event present. We have to +# recognize this and do our actions in this particular +# situation, too. Also, we don't want the nodes to be +# created prematurely on "add" events while not coldplugging. +ACTION=="add", ENV{STARTUP}!="1", NAME="", GOTO="dm_end" + +# "dm" sysfs subdirectory is available in newer versions of DM +# only (kernels >= 2.6.29). We have to check for its existence +# and use dmsetup tool instead to get the DM name, uuid and +# suspended state if the "dm" subdirectory is not present. +# The "suspended" item was added even later (kernels >= ???), +# so we also have to call dmsetup if the kernel version used +# is in between these releases. +TEST=="dm", ENV{DM_NAME}="$attr{dm/name}", ENV{DM_UUID}="$attr{dm/uuid}", ENV{DM_SUSPENDED}="$attr{dm/suspended}" +TEST!="dm", IMPORT{program}="/sbin/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o name,uuid,suspended" +ENV{DM_SUSPENDED}!="?*", IMPORT{program}="/sbin/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o suspended" + +# dmsetup tool provides suspended state information in textual +# form with values "Suspended"/"Active". We translate it to +# 0/1 respectively to be consistent with sysfs values. +ENV{DM_SUSPENDED}=="Active", ENV{DM_SUSPENDED}="0" +ENV{DM_SUSPENDED}=="Suspended", ENV{DM_SUSPENDED}="1" + +ENV{DM_NAME}=="?*", NAME="$kernel", SYMLINK+="(DM_DIR)/$env{DM_NAME}" + +LABEL="dm_end" /cvs/lvm2/LVM2/udev/11-dm-permissions.rules,v --> standard output revision 1.1 --- LVM2/udev/11-dm-permissions.rules +++ - 2009-08-03 18:44:55.696036000 +0000 @@ -0,0 +1,18 @@ +# Udev rules for device-mapper devices. +# +# These rules set permissions for DM devices. There are some environment +# variables set that can be used: +# DM_NAME - actual DM device's name +# DM_UUID - UUID set for DM device (blank if not specified) +# DM_SUSPENDED - suspended state of DM device (0 or 1) +# DM_LV_NAME - logical volume name (not set if LVM device not present) +# DM_VG_NAME - volume group name (not set if LVM device not present) +# DM_LV_LAYER - logical volume layer (not set if LVM device not present) + +SUBSYSTEM!="block", GOTO="dm_end" +KERNEL!="dm-[0-9]*", GOTO="dm_end" +ACTION!="change", GOTO="dm_end" + +#ENV{DM_NAME}=="my_device", OWNER:="peter", GROUP:="peter", MODE:="644" + +LABEL="dm_end" /cvs/lvm2/LVM2/udev/11-lvm.rules,v --> standard output revision 1.1 --- LVM2/udev/11-lvm.rules +++ - 2009-08-03 18:44:55.810941000 +0000 @@ -0,0 +1,32 @@ +# Udev rules for LVM. +# +# These rules create symlinks for LVM logical volumes in +# /dev/VG directory (VG is an actual VG name). Some udev +# environment variables are set (they can be used in later +# rules as well): +# DM_LV_NAME - logical volume name +# DM_VG_NAME - volume group name +# DM_LV_LAYER - logical volume layer (blank if not set) + +SUBSYSTEM!="block", GOTO="lvm_end" +KERNEL!="dm-[0-9]*", GOTO="lvm_end" +ACTION!="add|change", GOTO="lvm_end" +ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end" + +# Normally, we operate on "change" events only. But when +# coldplugging, there's an "add" event present. We have +# to recognize this and do our actions in this particular +# situation, too. +ACTION=="add", ENV{STARTUP}!="1", GOTO="lvm_end" + +# Use DM name and split it up into its VG/LV/layer constituents. +IMPORT{program}="/sbin/dmsetup namesplit --nameprefixes --noheadings --rows $env{DM_NAME}" + +# Do not create symlinks for hidden subdevices. +ENV{DM_LV_NAME}=="?*_mlog", GOTO="lvm_end" +ENV{DM_LV_NAME}=="?*_mimage_[0-9]*", GOTO="lvm_end" + +# 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}" + +LABEL="lvm_end" /cvs/lvm2/LVM2/udev/12-dm-disk.rules,v --> standard output revision 1.1 --- LVM2/udev/12-dm-disk.rules +++ - 2009-08-03 18:44:55.952611000 +0000 @@ -0,0 +1,30 @@ +# Udev rules for device-mapper devices. +# +# These rules create symlinks in /dev/disk directory. +# Symlinks that depend on probing filesystem type, +# label and uuid are created only if the device is not +# suspended. + +SUBSYSTEM!="block", GOTO="dm_end" +KERNEL!="dm-[0-9]*", GOTO="dm_end" +ACTION!="add|change", GOTO="dm_end" +ENV{DM_NAME}!="?*", GOTO="dm_end" + +# Normally, we operate on "change" events only. But when +# coldplugging, there's an "add" event present. We have to +# recognize this and do our actions in this particular +# situation, too. +ACTION=="add", ENV{STARTUP}!="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_end" + +IMPORT{program}="vol_id --export $tempnode" +OPTIONS="link_priority=-100" +ENV{DM_LV_LAYER}=="?*", OPTIONS="link_priority=-90" +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}" + +LABEL="dm_end" /cvs/lvm2/LVM2/udev/95-dm-notify.rules,v --> standard output revision 1.1 --- LVM2/udev/95-dm-notify.rules +++ - 2009-08-03 18:44:56.223676000 +0000 @@ -0,0 +1,16 @@ +# Udev rules for device-mapper devices. +# +# These rules are responsible for sending a notification to a process +# waiting for completion of udev rules. The process is identified by +# a cookie value sent within "change" and "remove" events (the cookie +# value is set before by that process for every action requested). +# Also, it sets default permissions for DM devices if not set already. + +SUBSYSTEM!="block", GOTO="dm_end" +KERNEL!="dm-[0-9]*", GOTO="dm_end" +ACTION!="change|remove", GOTO="dm_end" + +ACTION=="change", OWNER:="root", GROUP:="root", MODE:="600" +ENV{DM_COOKIE}=="?*", RUN+="/sbin/dmsetup udevcomplete $env{DM_COOKIE}" + +LABEL="dm_end" --- LVM2/udev/Makefile.in 2009/07/31 18:41:19 1.1 +++ LVM2/udev/Makefile.in 2009/08/03 18:44:54 1.2 @@ -14,3 +14,32 @@ srcdir = . top_srcdir = .. + +DM_RULES=10-dm.rules 12-dm-disk.rules 95-dm-notify.rules +LVM_RULES=11-lvm.rules +DM_DIR=$(shell grep "\#define DM_DIR" $(top_srcdir)/libdm/misc/dm-ioctl.h | awk '{print $$3}') + +CLEAN_TARGETS=10-dm.rules + +include $(top_srcdir)/make.tmpl + +%: %.in + $(SED) -e "s/(DM_DIR)/$(DM_DIR)/" $< >$@ + +install_lvm2: $(LVM_RULES) + @echo "Installing $(LVM_RULES) in $(udevdir)" + @for f in $(LVM_RULES); \ + do \ + $(RM) $(udevdir)/$$f; \ + $(INSTALL) -c -D $(OWNER) $(GROUP) -m 644 $$f $(udevdir)/$$f; \ + done + +install_device-mapper: $(DM_RULES) + @echo "Installing $(DM_RULES) in $(udevdir)" + @for f in $(DM_RULES); \ + do \ + $(RM) $(udevdir)/$$f; \ + $(INSTALL) -c -D $(OWNER) $(GROUP) -m 644 $$f $(udevdir)/$$f; \ + done + +install: install_lvm2 install_device-mapper From prajnoha@sourceware.org Tue Aug 4 08:05:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Tue, 04 Aug 2009 08:05:00 -0000 Subject: LVM2/udev 10-dm.rules.in 11-lvm.rules Message-ID: <20090804080507.23077.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-04 08:05:06 Modified files: udev : 10-dm.rules.in 11-lvm.rules Log message: Fix a typo in udev rule (splitname, NOT namesplit) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/10-dm.rules.in.diff?cvsroot=lvm2&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/11-lvm.rules.diff?cvsroot=lvm2&r1=1.1&r2=1.2 --- LVM2/udev/10-dm.rules.in 2009/08/03 18:44:54 1.1 +++ LVM2/udev/10-dm.rules.in 2009/08/04 08:05:06 1.2 @@ -26,7 +26,7 @@ # only (kernels >= 2.6.29). We have to check for its existence # and use dmsetup tool instead to get the DM name, uuid and # suspended state if the "dm" subdirectory is not present. -# The "suspended" item was added even later (kernels >= ???), +# The "suspended" item was added even later (kernels >= 2.6.31), # so we also have to call dmsetup if the kernel version used # is in between these releases. TEST=="dm", ENV{DM_NAME}="$attr{dm/name}", ENV{DM_UUID}="$attr{dm/uuid}", ENV{DM_SUSPENDED}="$attr{dm/suspended}" --- LVM2/udev/11-lvm.rules 2009/08/03 18:44:54 1.1 +++ LVM2/udev/11-lvm.rules 2009/08/04 08:05:06 1.2 @@ -20,7 +20,7 @@ ACTION=="add", ENV{STARTUP}!="1", GOTO="lvm_end" # Use DM name and split it up into its VG/LV/layer constituents. -IMPORT{program}="/sbin/dmsetup namesplit --nameprefixes --noheadings --rows $env{DM_NAME}" +IMPORT{program}="/sbin/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}" # Do not create symlinks for hidden subdevices. ENV{DM_LV_NAME}=="?*_mlog", GOTO="lvm_end" From prajnoha@sourceware.org Tue Aug 4 08:09:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Tue, 04 Aug 2009 08:09:00 -0000 Subject: LVM2/man lvconvert.8.in lvcreate.8.in lvextend ... Message-ID: <20090804080953.24615.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-04 08:09:52 Modified files: man : lvconvert.8.in lvcreate.8.in lvextend.8.in lvreduce.8.in lvremove.8.in lvrename.8.in lvresize.8.in pvmove.8.in vgchange.8.in vgremove.8.in Log message: '--noudevsync' -- update relevant man pages Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.in.diff?cvsroot=lvm2&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvcreate.8.in.diff?cvsroot=lvm2&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvextend.8.in.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvreduce.8.in.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvremove.8.in.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvrename.8.in.diff?cvsroot=lvm2&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvresize.8.in.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/pvmove.8.in.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/vgchange.8.in.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/vgremove.8.in.diff?cvsroot=lvm2&r1=1.2&r2=1.3 --- LVM2/man/lvconvert.8.in 2009/08/02 21:01:52 1.6 +++ LVM2/man/lvconvert.8.in 2009/08/04 08:09:52 1.7 @@ -7,6 +7,7 @@ [\-A|\-\-alloc AllocationPolicy] [\-b|\-\-background] [\-f|\-\-force] [\-i|\-\-interval Seconds] [\-h|\-?|\-\-help] +[\-\-noudevsync] [\-v|\-\-verbose] [\-y|\-\-yes] [\-\-version] LogicalVolume[Path] [PhysicalVolume[Path]...] @@ -16,6 +17,7 @@ .B lvconvert \-s|\-\-snapshot [\-c|\-\-chunksize ChunkSize] [\-h|\-?|\-\-help] +[\-\-noudevsync] [\-v|\-\-verbose] [\-Z|\-\-zero y|n] [\-\-version] @@ -67,6 +69,13 @@ Report progress as a percentage at regular intervals. .br .TP +.I \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. +.TP .I \-\-repair Repair a mirror after suffering a disk failure. The mirror will be brought back into a consistent state. By default, the original number of mirrors will be --- LVM2/man/lvcreate.8.in 2009/07/06 19:13:26 1.8 +++ LVM2/man/lvcreate.8.in 2009/08/04 08:09:52 1.9 @@ -6,7 +6,7 @@ [\-\-addtag Tag] [\-\-alloc AllocationPolicy] [\-A|\-\-autobackup y|n] [\-C|\-\-contiguous y|n] [\-d|\-\-debug] -[\-h|\-?|\-\-help] +[\-h|\-?|\-\-help] [\-\-noudevsync] [\-i|\-\-stripes Stripes [\-I|\-\-stripesize StripeSize]] {\-l|\-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}] | \-L|\-\-size LogicalVolumeSize[bBsSkKmMgGtTpPeE]} @@ -25,6 +25,7 @@ {\-l|\-\-extents LogicalExtentsNumber[%{VG|FREE}] | \-L|\-\-size LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [\-c|\-\-chunksize ChunkSize] +[\-\-noudevsync] \-n|\-\-name SnapshotLogicalVolumeName {{\-s|\-\-snapshot} OriginalLogicalVolumePath | @@ -117,6 +118,13 @@ Without this option a default names of "lvol#" will be generated where # is the LVM internal number of the logical volume. .TP +.I \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. +.TP .I \-p, \-\-permission r|rw Set access permissions to read only or read and write. .br --- LVM2/man/lvextend.8.in 2009/07/06 19:13:26 1.3 +++ LVM2/man/lvextend.8.in 2009/08/04 08:09:52 1.4 @@ -5,6 +5,7 @@ .B lvextend [\-\-alloc AllocationPolicy] [\-A|\-\-autobackup y|n] [\-d|\-\-debug] [\-h|\-?|\-\-help] +[\-\-noudevsync] [\-i|\-\-stripes Stripes [\-I|\-\-stripesize StripeSize]] {\-l|\-\-extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] | \-L|\-\-size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]} @@ -21,6 +22,13 @@ .SH OPTIONS See \fBlvm\fP for common options. .TP +.I \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. +.TP .I \-l, \-\-extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] Extend or set the logical volume size in units of logical extents. With the + sign the value is added to the actual size --- LVM2/man/lvreduce.8.in 2009/07/07 19:28:57 1.4 +++ LVM2/man/lvreduce.8.in 2009/08/04 08:09:52 1.5 @@ -5,6 +5,7 @@ .B lvreduce [\-A|\-\-autobackup y|n] [\-d|\-\-debug] [\-f|\-\-force] [\-h|\-?|\-\-help] +[\-\-noudevsync] {\-l|\-\-extents [\-]LogicalExtentsNumber[%{VG|LV|FREE}] | \-L|\-\-size [\-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [\-t|\-\-test] @@ -36,6 +37,13 @@ .I \-f, \-\-force Force size reduction without any question. .TP +.I \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. +.TP .I \-l, \-\-extents [\-]LogicalExtentsNumber[%{VG|LV|FREE}] Reduce or set the logical volume size in units of logical extents. With the - sign the value will be subtracted from --- LVM2/man/lvremove.8.in 2008/11/17 18:20:13 1.3 +++ LVM2/man/lvremove.8.in 2009/08/04 08:09:52 1.4 @@ -5,6 +5,7 @@ .B lvremove [\-A|\-\-autobackup y|n] [\-d|\-\-debug] [\-f|\-\-force] [\-h|\-?|\-\-help] +[\-\-noudevsync] [\-t|\-\-test] [\-v|\-\-verbose] LogicalVolumePath [LogicalVolumePath...] .SH DESCRIPTION @@ -22,6 +23,13 @@ .TP .I \-f, \-\-force Remove active logical volumes without confirmation. +.TP +.I \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. .SH EXAMPLES Remove the active logical volume lvol1 in volume group vg00 without asking for confirmation: --- LVM2/man/lvrename.8.in 2008/10/08 12:50:13 1.1 +++ LVM2/man/lvrename.8.in 2009/08/04 08:09:52 1.2 @@ -7,6 +7,7 @@ .RB [ \-d | \-\-debug ] .RB [ \-f | \-\-force ] .RB [ \-h | \-\-help ] +.RB [ \-\-noudevsync ] .RB [ \-t | \-\-test ] .RB [ \-v | \-\-verbose ] .RB [ \-\-version ] @@ -22,6 +23,13 @@ .IR NewLogicalVolume { Name | Path }. .SH OPTIONS See \fBlvm\fP for common options. +.TP +.BR \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. .SH EXAMPLE To rename .B lvold --- LVM2/man/lvresize.8.in 2009/07/06 19:13:26 1.4 +++ LVM2/man/lvresize.8.in 2009/08/04 08:09:52 1.5 @@ -5,6 +5,7 @@ .B lvresize [\-\-alloc AllocationPolicy] [\-A|\-\-autobackup y|n] [\-d|\-\-debug] [\-h|\-?|\-\-help] +[\-\-noudevsync] [\-i|\-\-stripes Stripes [\-I|\-\-stripesize StripeSize]] {\-l|\-\-extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] | \-L|\-\-size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]} @@ -25,6 +26,13 @@ .SH OPTIONS See \fBlvm\fP for common options. .TP +.I \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. +.TP .I \-l, \-\-extents [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] Change or set the logical volume size in units of logical extents. With the + or - sign the value is added to or subtracted from the actual size --- LVM2/man/pvmove.8.in 2008/11/12 15:01:36 1.2 +++ LVM2/man/pvmove.8.in 2009/08/04 08:09:52 1.3 @@ -6,8 +6,8 @@ [\-\-abort] [\-\-alloc AllocationPolicy] [\-b|\-\-background] -[\-d|\-\-debug] [\-h|\-\-help] [\-i|\-\-interval Seconds] [\-v|\-\-verbose] -[\-n|\-\-name LogicalVolume] +[\-d|\-\-debug] [\-h|\-\-help] [\-i|\-\-interval Seconds] +[\-\-noudevsync] [\-v|\-\-verbose] [\-n|\-\-name LogicalVolume] [SourcePhysicalVolume[:PE[-PE]...] [DestinationPhysicalVolume[:PE[-PE]...]...]] .SH DESCRIPTION .B pvmove @@ -73,6 +73,13 @@ .I \-\-abort Abort any moves in progress. .TP +.I \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. +.TP .I \-b, \-\-background Run the daemon in the background. .TP --- LVM2/man/vgchange.8.in 2009/07/06 19:13:26 1.3 +++ LVM2/man/vgchange.8.in 2009/08/04 08:09:52 1.4 @@ -18,6 +18,7 @@ .RB [ \-h | \-\-help] .RB [ \-\-ignorelockingfailure] .RB [ \-\-ignoremonitoring] +.RB [ \-\-noudevsync ] .RB [ \-l | \-\-logicalvolume .IR MaxLogicalVolumes ] .RB [ -p | \-\-maxphysicalvolumes @@ -86,6 +87,13 @@ set in .BR lvm.conf (5). .TP +.BR \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. +.TP .BR \-\-ignoremonitoring Make no attempt to interact with dmeventd unless .BR \-\-monitor --- LVM2/man/vgremove.8.in 2008/11/12 15:01:36 1.2 +++ LVM2/man/vgremove.8.in 2009/08/04 08:09:52 1.3 @@ -4,7 +4,7 @@ .SH SYNOPSIS .B vgremove [\-d|\-\-debug] [\-f|\-\-force] [\-h|\-?|\-\-help] -[\-t|\-\-test] [\-v|\-\-verbose] +[\-\-noudevsync] [\-t|\-\-test] [\-v|\-\-verbose] VolumeGroupName [VolumeGroupName...] .SH DESCRIPTION vgremove allows you to remove one or more volume groups. @@ -21,6 +21,13 @@ .BR \-f ", " \-\-force Force the removal of any logical volumes on the volume group without confirmation. +.TP +.BR \-\-noudevsync +Disable udev synchronisation. The +process will not wait for notification from udev. +It will continue irrespective of any possible udev processing +in the background. You should only use this if udev is not running +or has rules that ignore the devices LVM2 creates. .SH SEE ALSO .BR lvm (8), .BR lvremove (8), From agk@sourceware.org Tue Aug 4 15:36:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 04 Aug 2009 15:36:00 -0000 Subject: LVM2 ./WHATS_NEW doc/example.conf lib/activate ... Message-ID: <20090804153616.22860.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-04 15:36:15 Modified files: . : WHATS_NEW doc : example.conf lib/activate : dev_manager.c lib/commands : toolcontext.c toolcontext.h lib/config : defaults.h tools : lvmcmdline.c Log message: Add activation/udev_sync to lvm.conf. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1229&r2=1.1230 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.diff?cvsroot=lvm2&r1=1.44&r2=1.45 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.157&r2=1.158 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.83&r2=1.84 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.h.diff?cvsroot=lvm2&r1=1.32&r2=1.33 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.49&r2=1.50 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.104&r2=1.105 --- LVM2/WHATS_NEW 2009/08/03 18:09:25 1.1229 +++ LVM2/WHATS_NEW 2009/08/04 15:36:13 1.1230 @@ -1,5 +1,6 @@ Version 2.02.51 - ================================ + Add activation/udev_sync to lvm.conf. Only change LV symlinks on ACTIVATE not PRELOAD. Make lvconvert honour log mirror options combined with downconversion. Allow LV suspend while --ignorelockingfailure is in force. --- LVM2/doc/example.conf 2009/08/01 17:08:44 1.44 +++ LVM2/doc/example.conf 2009/08/04 15:36:14 1.45 @@ -301,6 +301,16 @@ } activation { + # Set to 0 to disable udev syncronisation (if compiled into the binaries). + # Processes will not wait for notification from udev. + # They will continue irrespective of any possible udev processing + # in the background. You should only use this if udev is not running + # or has rules that ignore the devices LVM2 creates. + # The command line argument --nodevsync takes precedence over this setting. + # If set to 1 when udev is not running, and there are LVM2 processes + # waiting for udev, run 'dmsetup udevcomplete' manually to wake them up. + udev_sync = 1 + # How to fill in missing stripes if activating an incomplete volume. # Using "error" will make inaccessible parts of the device return # I/O errors on access. You can instead use a device path, in which --- LVM2/lib/activate/dev_manager.c 2009/08/03 18:09:26 1.157 +++ LVM2/lib/activate/dev_manager.c 2009/08/04 15:36:14 1.158 @@ -455,6 +455,8 @@ dm->target_state = NULL; + dm_udev_set_sync_support(cmd->current_settings.udev_sync); + return dm; bad: --- LVM2/lib/commands/toolcontext.c 2009/07/21 20:00:04 1.83 +++ LVM2/lib/commands/toolcontext.c 2009/08/04 15:36:14 1.84 @@ -265,6 +265,10 @@ return 0; } + cmd->default_settings.udev_sync = find_config_tree_int(cmd, + "activation/udev_sync", + DEFAULT_UDEV_SYNC); + cmd->stripe_filler = find_config_tree_str(cmd, "activation/missing_stripe_filler", DEFAULT_STRIPE_FILLER); --- LVM2/lib/commands/toolcontext.h 2009/07/13 19:49:49 1.32 +++ LVM2/lib/commands/toolcontext.h 2009/08/04 15:36:14 1.33 @@ -34,6 +34,7 @@ int archive; /* should we archive ? */ int backup; /* should we backup ? */ int read_ahead; /* DM_READ_AHEAD_NONE or _AUTO */ + int udev_sync; int cache_vgmetadata; const char *msg_prefix; struct format_type *fmt; --- LVM2/lib/config/defaults.h 2009/08/01 17:08:44 1.49 +++ LVM2/lib/config/defaults.h 2009/08/04 15:36:14 1.50 @@ -68,6 +68,7 @@ #define DEFAULT_PVMETADATACOPIES 1 #define DEFAULT_LABELSECTOR UINT64_C(1) #define DEFAULT_READ_AHEAD "auto" +#define DEFAULT_UDEV_SYNC 0 #define DEFAULT_EXTENT_SIZE 4096 /* In KB */ #define DEFAULT_MAX_PV 0 #define DEFAULT_MAX_LV 0 --- LVM2/tools/lvmcmdline.c 2009/07/27 21:01:58 1.104 +++ LVM2/tools/lvmcmdline.c 2009/08/04 15:36:15 1.105 @@ -830,6 +830,9 @@ } else init_trust_cache(0); + if (arg_count(cmd, noudevsync_ARG)) + cmd->current_settings.udev_sync = 0; + /* Handle synonyms */ if (!_merge_synonym(cmd, resizable_ARG, resizeable_ARG) || !_merge_synonym(cmd, allocation_ARG, allocatable_ARG) || From prajnoha@sourceware.org Tue Aug 4 15:53:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Tue, 04 Aug 2009 15:53:00 -0000 Subject: LVM2/tools args.h commands.h Message-ID: <20090804155304.30059.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-04 15:53:04 Modified files: tools : args.h commands.h Log message: Add --noudevsync option for relevant LVM tools. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/args.h.diff?cvsroot=lvm2&r1=1.66&r2=1.67 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.130&r2=1.131 --- LVM2/tools/args.h 2009/07/30 17:45:29 1.66 +++ LVM2/tools/args.h 2009/08/04 15:53:04 1.67 @@ -62,6 +62,7 @@ arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", size_kb_arg, 0) arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0) arg(virtualsize_ARG, '\0', "virtualsize", size_mb_arg, 0) +arg(noudevsync_ARG, '\0', "noudevsync", NULL, 0) /* Allow some variations */ arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0) --- LVM2/tools/commands.h 2009/07/30 17:45:30 1.130 +++ LVM2/tools/commands.h 2009/08/04 15:53:04 1.131 @@ -72,6 +72,7 @@ "\t[--ignorelockingfailure]\n" "\t[--ignoremonitoring]\n" "\t[--monitor {y|n}]\n" + "\t[--noudevsync]\n" "\t[-M|--persistent y|n] [--major major] [--minor minor]\n" "\t[-P|--partial] " "\n" "\t[-p|--permission r|rw]\n" @@ -86,8 +87,9 @@ alloc_ARG, autobackup_ARG, available_ARG, contiguous_ARG, force_ARG, ignorelockingfailure_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG, - monitor_ARG, partial_ARG, permission_ARG, persistent_ARG, readahead_ARG, - resync_ARG, refresh_ARG, addtag_ARG, deltag_ARG, test_ARG, yes_ARG) + monitor_ARG, noudevsync_ARG, partial_ARG, permission_ARG, persistent_ARG, + readahead_ARG, resync_ARG, refresh_ARG, addtag_ARG, deltag_ARG, test_ARG, + yes_ARG) xx(lvconvert, "Change logical volume layout", @@ -102,6 +104,7 @@ "\t[-f|--force]\n" "\t[-h|-?|--help]\n" "\t[-i|--interval seconds]\n" + "\t[--noudevsync]\n" "\t[-v|--verbose]\n" "\t[-y|--yes]\n" "\t[--version]" "\n" @@ -112,14 +115,15 @@ "\t[-c|--chunksize]\n" "\t[-d|--debug]\n" "\t[-h|-?|--help]\n" + "\t[--noudevsync]\n" "\t[-v|--verbose]\n" "\t[-Z|--zero {y|n}]\n" "\t[--version]" "\n" "\tOriginalLogicalVolume[Path] SnapshotLogicalVolume[Path]\n", alloc_ARG, background_ARG, chunksize_ARG, corelog_ARG, interval_ARG, - mirrorlog_ARG, mirrors_ARG, regionsize_ARG, repair_ARG, snapshot_ARG, - test_ARG, use_policies_ARG, yes_ARG, force_ARG, zero_ARG) + mirrorlog_ARG, mirrors_ARG, noudevsync_ARG, regionsize_ARG, repair_ARG, + snapshot_ARG, test_ARG, use_policies_ARG, yes_ARG, force_ARG, zero_ARG) xx(lvcreate, "Create a logical volume", @@ -137,6 +141,7 @@ "\t[-M|--persistent {y|n}] [--major major] [--minor minor]\n" "\t[-m|--mirrors Mirrors [--nosync] [{--mirrorlog {disk|core}|--corelog}]]\n" "\t[-n|--name LogicalVolumeName]\n" + "\t[--noudevsync]\n" "\t[-p|--permission {r|rw}]\n" "\t[-r|--readahead ReadAheadSectors|auto|none]\n" "\t[-R|--regionsize MirrorLogRegionSize]\n" @@ -162,6 +167,7 @@ "\t -L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}\n" "\t[-M|--persistent {y|n}] [--major major] [--minor minor]\n" "\t[-n|--name LogicalVolumeName]\n" + "\t[--noudevsync]\n" "\t[-p|--permission {r|rw}]\n" "\t[-r|--readahead ReadAheadSectors|auto|none]\n" "\t[-t|--test]\n" @@ -172,9 +178,10 @@ addtag_ARG, alloc_ARG, autobackup_ARG, chunksize_ARG, contiguous_ARG, corelog_ARG, extents_ARG, major_ARG, minor_ARG, mirrorlog_ARG, mirrors_ARG, - name_ARG, nosync_ARG, permission_ARG, persistent_ARG, readahead_ARG, - regionsize_ARG, size_ARG, snapshot_ARG, stripes_ARG, stripesize_ARG, - test_ARG, type_ARG, virtualoriginsize_ARG, virtualsize_ARG, zero_ARG) + name_ARG, nosync_ARG, noudevsync_ARG, permission_ARG, persistent_ARG, + readahead_ARG, regionsize_ARG, size_ARG, snapshot_ARG, stripes_ARG, + stripesize_ARG, test_ARG, type_ARG, virtualoriginsize_ARG, virtualsize_ARG, + zero_ARG) xx(lvdisplay, "Display information about a logical volume", @@ -231,6 +238,7 @@ "\t -L|--size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]}\n" "\t[-m|--mirrors Mirrors]\n" "\t[-n|--nofsck]\n" + "\t[--noudevsync]\n" "\t[-r|--resizefs]\n" "\t[-t|--test]\n" "\t[--type VolumeType]\n" @@ -239,8 +247,8 @@ "\tLogicalVolume[Path] [ PhysicalVolumePath... ]\n", alloc_ARG, autobackup_ARG, extents_ARG, force_ARG, mirrors_ARG, - nofsck_ARG, resizefs_ARG, size_ARG, stripes_ARG, stripesize_ARG, - test_ARG, type_ARG) + nofsck_ARG, noudevsync_ARG, resizefs_ARG, size_ARG, stripes_ARG, + stripesize_ARG, test_ARG, type_ARG) xx(lvmchange, "With the device mapper, this is obsolete and does nothing.", @@ -300,6 +308,7 @@ "\t{-l|--extents [-]LogicalExtentsNumber[%{VG|LV|FREE}] |\n" "\t -L|--size [-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]}\n" "\t[-n|--nofsck]\n" + "\t[--noudevsync]\n" "\t[-r|--resizefs]\n" "\t[-t|--test]\n" "\t[-v|--verbose]\n" @@ -307,8 +316,8 @@ "\t[--version]" "\n" "\tLogicalVolume[Path]\n", - autobackup_ARG, force_ARG, extents_ARG, nofsck_ARG, resizefs_ARG, - size_ARG, test_ARG, yes_ARG) + autobackup_ARG, force_ARG, extents_ARG, nofsck_ARG, noudevsync_ARG, + resizefs_ARG, size_ARG, test_ARG, yes_ARG) xx(lvremove, "Remove logical volume(s) from the system", @@ -318,12 +327,13 @@ "\t[-d|--debug]\n" "\t[-f|--force]\n" "\t[-h|--help]\n" + "\t[--noudevsync]\n" "\t[-t|--test]\n" "\t[-v|--verbose]\n" "\t[--version]" "\n" "\tLogicalVolume[Path] [LogicalVolume[Path]...]\n", - autobackup_ARG, force_ARG, test_ARG) + autobackup_ARG, force_ARG, noudevsync_ARG, test_ARG) xx(lvrename, "Rename a logical volume", @@ -332,13 +342,14 @@ "\t[-A|--autobackup {y|n}] " "\n" "\t[-d|--debug] " "\n" "\t[-h|-?|--help] " "\n" + "\t[--noudevsync]\n" "\t[-t|--test] " "\n" "\t[-v|--verbose]" "\n" "\t[--version] " "\n" "\t{ OldLogicalVolumePath NewLogicalVolumePath |" "\n" "\t VolumeGroupName OldLogicalVolumeName NewLogicalVolumeName }\n", - autobackup_ARG, test_ARG) + autobackup_ARG, noudevsync_ARG, test_ARG) xx(lvresize, "Resize a logical volume", @@ -353,6 +364,7 @@ "\t{-l|--extents [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] |\n" "\t -L|--size [+|-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]}\n" "\t[-n|--nofsck]\n" + "\t[--noudevsync]\n" "\t[-r|--resizefs]\n" "\t[-t|--test]\n" "\t[--type VolumeType]\n" @@ -361,8 +373,8 @@ "\tLogicalVolume[Path] [ PhysicalVolumePath... ]\n", alloc_ARG, autobackup_ARG, extents_ARG, force_ARG, nofsck_ARG, - resizefs_ARG, size_ARG, stripes_ARG, stripesize_ARG, test_ARG, - type_ARG) + noudevsync_ARG, resizefs_ARG, size_ARG, stripes_ARG, stripesize_ARG, + test_ARG, type_ARG) xx(lvs, "Display information about logical volumes", @@ -551,6 +563,7 @@ "\t[-d|--debug]\n " "\t[-h|-?|--help]\n" "\t[-i|--interval seconds]\n" + "\t[--noudevsync]\n" "\t[-t|--test]\n " "\t[-v|--verbose]\n " "\t[--version]\n" @@ -560,7 +573,7 @@ "\t[DestinationPhysicalVolume[:PhysicalExtent[-PhysicalExtent]...]...]\n", abort_ARG, alloc_ARG, autobackup_ARG, background_ARG, - interval_ARG, name_ARG, test_ARG) + interval_ARG, name_ARG, noudevsync_ARG, test_ARG) xx(pvremove, "Remove LVM label(s) from physical volume(s)", @@ -674,6 +687,7 @@ "\t[--ignorelockingfailure]\n" "\t[--ignoremonitoring]\n" "\t[--monitor {y|n}]\n" + "\t[--noudevsync]\n" "\t[--refresh]\n" "\t[-t|--test]" "\n" "\t[-u|--uuid] " "\n" @@ -691,9 +705,9 @@ addtag_ARG, alloc_ARG, allocation_ARG, autobackup_ARG, available_ARG, clustered_ARG, deltag_ARG, ignorelockingfailure_ARG, ignoremonitoring_ARG, - logicalvolume_ARG, maxphysicalvolumes_ARG, monitor_ARG, partial_ARG, - physicalextentsize_ARG, refresh_ARG, resizeable_ARG, resizable_ARG, - test_ARG, uuid_ARG) + logicalvolume_ARG, maxphysicalvolumes_ARG, monitor_ARG, noudevsync_ARG, + partial_ARG, physicalextentsize_ARG, refresh_ARG, resizeable_ARG, + resizable_ARG, test_ARG, uuid_ARG) xx(vgck, "Check the consistency of volume group(s)", @@ -879,12 +893,13 @@ "\t[-d|--debug]\n" "\t[-f|--force]\n" "\t[-h|--help]\n" + "\t[--noudevsync]\n" "\t[-t|--test]\n" "\t[-v|--verbose]\n" "\t[--version]" "\n" "\tVolumeGroupName [VolumeGroupName...]\n", - force_ARG, test_ARG) + force_ARG, noudevsync_ARG, test_ARG) xx(vgrename, "Rename a volume group", From prajnoha@sourceware.org Tue Aug 4 15:55:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Tue, 04 Aug 2009 15:55:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20090804155545.31718.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-04 15:55:44 Modified files: . : WHATS_NEW Log message: Add --noudevsync option for relevant LVM tools. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1230&r2=1.1231 --- LVM2/WHATS_NEW 2009/08/04 15:36:13 1.1230 +++ LVM2/WHATS_NEW 2009/08/04 15:55:43 1.1231 @@ -1,5 +1,6 @@ Version 2.02.51 - ================================ + Add --noudevsync option for relevant LVM tools. Add activation/udev_sync to lvm.conf. Only change LV symlinks on ACTIVATE not PRELOAD. Make lvconvert honour log mirror options combined with downconversion. From snitzer@sourceware.org Tue Aug 4 16:02:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Tue, 04 Aug 2009 16:02:00 -0000 Subject: LVM2/test t-pvcreate-usage.sh t-pvcreate-opera ... Message-ID: <20090804160239.24370.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-08-04 16:02:39 Modified files: test : t-pvcreate-usage.sh Added files: test : t-pvcreate-operation-md.sh Log message: Added basic pvcreate --dataalignmentoffset testing to t-pvcreate-usage.sh Added topology testing via new test/t-pvcreate-operation-md.sh - requires mdadm and rawhide kernel for full test coverage Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pvcreate-operation-md.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pvcreate-usage.sh.diff?cvsroot=lvm2&r1=1.11&r2=1.12 /cvs/lvm2/LVM2/test/t-pvcreate-operation-md.sh,v --> standard output revision 1.1 --- LVM2/test/t-pvcreate-operation-md.sh +++ - 2009-08-04 16:02:39.741117000 +0000 @@ -0,0 +1,112 @@ +# Copyright (C) 2009 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions +# of the GNU General Public License v.2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# skip this test if mdadm or sfdisk (or others) aren't available +which mdadm || exit 200 +which sfdisk || exit 200 +which perl || exit 200 +which awk || exit 200 +which cut || exit 200 + +. ./test-utils.sh + +prepare_lvmconf '[ "a|/dev/md.*|", "a/dev\/mapper\/.*$/", "r/.*/" ]' +aux prepare_devs 2 + +# Have MD use a non-standard name to avoid colliding with an existing MD device +# - mdadm >= 3.0 requires that non-standard device names be in /dev/md/ +# - newer mdadm _completely_ defers to udev to create the associated device node +mdadm_maj=$(mdadm --version 2>&1 | perl -pi -e 's|.* v(\d+).*|\1|') +[ $mdadm_maj -ge 3 ] && \ + mddev=/dev/md/md_lvm_test0 || \ + mddev=/dev/md_lvm_test0 + +cleanup_md() { + # sleeps offer hack to defeat: 'md: md127 still in use' + # see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25 + sleep 2 + mdadm --stop $mddev + if [ -b "$mddev" ]; then + # mdadm doesn't always cleanup the device node + sleep 2 + rm -f $mddev + fi + teardown_ +} + +# create 2 disk MD raid0 array (stripe_width=128K) +[ -b "$mddev" ] && exit 200 +mdadm --create $mddev --auto=md --level 0 --raid-devices=2 --chunk 64 $dev1 $dev2 +trap 'aux cleanup_md' EXIT # cleanup this MD device at the end of the test + +# Test alignment of PV on MD without any MD-aware or topology-aware detection +# - should treat $mddev just like any other block device +pv_align="192.00K" +pvcreate --metadatasize 128k \ + --config 'devices {md_chunk_alignment=0 data_alignment_detection=0 data_alignment_offset_detection=0}' \ + $mddev +check_pv_field_ $mddev pe_start $pv_align + +# Test md_chunk_alignment independent of topology-aware detection +pv_align="256.00K" +pvcreate --metadatasize 128k \ + --config 'devices {data_alignment_detection=0 data_alignment_offset_detection=0}' \ + $mddev +check_pv_field_ $mddev pe_start $pv_align + +# Get linux minor version +linux_minor=$(echo `uname -r` | cut -d'.' -f3 | cut -d'-' -f1) + +# Test newer topology-aware alignment detection +if [ $linux_minor -gt 31 ]; then + pv_align="256.00K" + pvcreate --metadatasize 128k \ + --config 'devices { md_chunk_alignment=0 }' $mddev + check_pv_field_ $mddev pe_start $pv_align +fi + +# partition MD array directly, depends on blkext in Linux >= 2.6.28 +if [ $linux_minor -gt 27 ]; then + # create one partition + sfdisk $mddev < parent lookup via sysfs paths + not pvcreate --metadatasize 128k $mddev + + # verify alignment_offset is accounted for in pe_start + # - topology infrastructure is available in Linux >= 2.6.31 + # - also tests partition -> parent lookup via sysfs paths + + # Oh joy: need to lookup /sys/block/md127 rather than /sys/block/md_lvm_test0 + mddev_maj_min=$(ls -lL $mddev | awk '{ print $5 $6 }' | perl -pi -e 's|,|:|') + mddev_p_sysfs_name=$(echo /sys/dev/block/${mddev_maj_min}/*p1) + base_mddev_p=`basename $mddev_p_sysfs_name` + mddev_p=/dev/${base_mddev_p} + + # Checking for 'alignment_offset' in sysfs implies Linux >= 2.6.31 + sysfs_alignment_offset=/sys/dev/block/${mddev_maj_min}/${base_mddev_p}/alignment_offset + [ -f $sysfs_alignment_offset ] && \ + alignment_offset=`cat $sysfs_alignment_offset` || \ + alignment_offset=0 + + if [ "$alignment_offset" = "512" ]; then + pv_align="256.50K" + pvcreate --metadatasize 128k $mddev_p + check_pv_field_ $mddev_p pe_start $pv_align + pvremove $mddev_p + elif [ "$alignment_offset" = "2048" ]; then + pv_align="258.00K" + pvcreate --metadatasize 128k $mddev_p + check_pv_field_ $mddev_p pe_start $pv_align + pvremove $mddev_p + fi +fi --- LVM2/test/t-pvcreate-usage.sh 2009/06/06 16:40:39 1.11 +++ LVM2/test/t-pvcreate-usage.sh 2009/08/04 16:02:39 1.12 @@ -116,6 +116,18 @@ pvcreate --metadatasize 128k --metadatacopies 2 --dataalignment 3.5k $dev1 check_pv_field_ $dev1 pe_start $pv_align +# data area is aligned to 64k by default, +# data area start is shifted by the specified alignment_offset +pv_align="195.50K" +pvcreate --metadatasize 128k --dataalignmentoffset 7s $dev1 +check_pv_field_ $dev1 pe_start $pv_align + +# 2nd metadata area is created without problems when +# data area start is shifted by the specified alignment_offset +pvcreate --metadatasize 128k --metadatacopies 2 --dataalignmentoffset 7s $dev1 +check_pv_field_ $dev1 pv_mda_count 2 +# FIXME: compare start of 2nd mda with and without --dataalignmentoffset + #COMM 'pv with LVM1 compatible data alignment can be convereted' #compatible == LVM1_PE_ALIGN == 64k pvcreate --dataalignment 256k $dev1 From agk@sourceware.org Tue Aug 4 21:44:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Tue, 04 Aug 2009 21:44:00 -0000 Subject: LVM2/lib/activate fs.c Message-ID: <20090804214439.28008.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-04 21:44:27 Modified files: lib/activate : fs.c Log message: detect udev mk_link problems Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.c.diff?cvsroot=lvm2&r1=1.45&r2=1.46 --- LVM2/lib/activate/fs.c 2009/08/03 18:31:53 1.45 +++ LVM2/lib/activate/fs.c 2009/08/04 21:44:20 1.46 @@ -107,7 +107,7 @@ { char lv_path[PATH_MAX], link_path[PATH_MAX], lvm1_group_path[PATH_MAX]; char vg_path[PATH_MAX]; - struct stat buf; + struct stat buf, buf_lp; if (dm_snprintf(vg_path, sizeof(vg_path), "%s%s", dev_dir, vg_name) == -1) { @@ -161,12 +161,34 @@ return 0; } + if (dm_udev_get_sync_support()) { + /* Check udev created the correct link. */ + if (!stat(link_path, &buf_lp) && + !stat(lv_path, &buf)) { + if (buf_lp.st_rdev == buf.st_rdev) + return 1; + else + log_warn("Symlink %s that should have been " + "created by udev does not have " + "correct target. Falling back to " + "direct link creation", lv_path); + } else + log_warn("Symlink %s that should have been " + "created by udev could not be checked " + "for its correctness. Falling back to " + "direct link creation.", lv_path); + + } + log_very_verbose("Removing %s", lv_path); if (unlink(lv_path) < 0) { log_sys_error("unlink", lv_path); return 0; } - } + } else if (dm_udev_get_sync_support()) + log_warn("The link should had been created by udev " + "but it was not found. Falling back to " + "direct link creation.", lv_path); log_very_verbose("Linking %s -> %s", lv_path, link_path); if (symlink(link_path, lv_path) < 0) { From prajnoha@sourceware.org Wed Aug 5 09:12:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Wed, 05 Aug 2009 09:12:00 -0000 Subject: LVM2/lib/activate fs.c Message-ID: <20090805091247.6698.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-05 09:12:44 Modified files: lib/activate : fs.c Log message: Forgotten '%s' in one of _mk_link warning messages. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47 --- LVM2/lib/activate/fs.c 2009/08/04 21:44:20 1.46 +++ LVM2/lib/activate/fs.c 2009/08/05 09:12:44 1.47 @@ -186,7 +186,7 @@ return 0; } } else if (dm_udev_get_sync_support()) - log_warn("The link should had been created by udev " + log_warn("The link %s should had been created by udev " "but it was not found. Falling back to " "direct link creation.", lv_path); From ccaulfield@sourceware.org Wed Aug 5 14:18:00 2009 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Wed, 05 Aug 2009 14:18:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/clvmd/lvm-functions.c Message-ID: <20090805141836.17430.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: ccaulfield@sourceware.org 2009-08-05 14:18:36 Modified files: . : WHATS_NEW daemons/clvmd : lvm-functions.c Log message: Fix locking in clvmd The changes to remove LCK_NONBLOCK from the LVM locks broke clvmd because the code was clearly wrong but working anyway! The constant was being masked rather than the variable that was supposed to match against it. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1231&r2=1.1232 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.67&r2=1.68 --- LVM2/WHATS_NEW 2009/08/04 15:55:43 1.1231 +++ LVM2/WHATS_NEW 2009/08/05 14:18:35 1.1232 @@ -1,5 +1,6 @@ Version 2.02.51 - ================================ + Fix locking in clvmd (2.02.50). Add --noudevsync option for relevant LVM tools. Add activation/udev_sync to lvm.conf. Only change LV symlinks on ACTIVATE not PRELOAD. --- LVM2/daemons/clvmd/lvm-functions.c 2009/07/24 18:15:07 1.67 +++ LVM2/daemons/clvmd/lvm-functions.c 2009/08/05 14:18:35 1.68 @@ -479,29 +479,29 @@ cmd->partial_activation = (lock_flags & LCK_PARTIAL_MODE) ? 1 : 0; - switch (command) { - case LCK_LV_EXCLUSIVE & LCK_MASK: + switch (command & LCK_MASK) { + case LCK_LV_EXCLUSIVE: status = do_activate_lv(resource, lock_flags, LKM_EXMODE); break; - case LCK_LV_SUSPEND & LCK_MASK: + case LCK_LV_SUSPEND: status = do_suspend_lv(resource); if (!status) suspended++; break; case LCK_UNLOCK: - case LCK_LV_RESUME & LCK_MASK: /* if active */ + case LCK_LV_RESUME: /* if active */ status = do_resume_lv(resource); if (!status) suspended--; break; - case LCK_LV_ACTIVATE & LCK_MASK: + case LCK_LV_ACTIVATE: status = do_activate_lv(resource, lock_flags, LKM_CRMODE); break; - case LCK_LV_DEACTIVATE & LCK_MASK: + case LCK_LV_DEACTIVATE: status = do_deactivate_lv(resource, lock_flags); break; From agk@sourceware.org Wed Aug 5 19:50:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 05 Aug 2009 19:50:00 -0000 Subject: LVM2/libdm libdm-common.c Message-ID: <20090805195009.6429.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-05 19:50:08 Modified files: libdm : libdm-common.c Log message: Additional logging Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74 --- LVM2/libdm/libdm-common.c 2009/08/03 18:33:08 1.73 +++ LVM2/libdm/libdm-common.c 2009/08/05 19:50:08 1.74 @@ -854,41 +854,50 @@ return 0; } -static int _udev_notify_sem_inc(int semid) +static int _udev_notify_sem_inc(uint32_t cookie, int semid) { struct sembuf sb = {0, 1, 0}; if (semop(semid, &sb, 1) < 0) { - log_error("semid %d: semop failed: %s", semid, strerror(errno)); + log_error("semid %d: semop failed for cookie 0x%" PRIx32 ": %s", + semid, cookie, strerror(errno)); return 0; } + log_debug("Udev cookie 0x%" PRIx32 " (semid %d) incremented", + cookie, semid); + return 1; } -static int _udev_notify_sem_dec(int semid) +static int _udev_notify_sem_dec(uint32_t cookie, int semid) { struct sembuf sb = {0, -1, IPC_NOWAIT}; if (semop(semid, &sb, 1) < 0) { switch (errno) { case EAGAIN: - log_error("semid %d: semop failed: " + log_error("semid %d: semop failed for cookie " + "0x%" PRIx32 ": " "incorrect semaphore state", - semid); + semid, cookie); break; default: - log_error("semid %d: semop failed: %s", - semid, strerror(errno)); + log_error("semid %d: semop failed for cookie " + "0x%" PRIx32 ": %s", + semid, cookie, strerror(errno)); break; } return 0; } + log_debug("Udev cookie 0x%" PRIx32 " (semid %d) decremented", + cookie, semid); + return 1; } -static int _udev_notify_sem_destroy(int semid, uint32_t cookie) +static int _udev_notify_sem_destroy(uint32_t cookie, int semid) { if (semctl(semid, 0, IPC_RMID, 0) < 0) { log_error("Could not cleanup notification semaphore " @@ -897,6 +906,9 @@ return 0; } + log_debug("Udev cookie 0x%" PRIx32 " (semid %d) destroyed", cookie, + semid); + return 1; } @@ -950,14 +962,20 @@ } } while (!base_cookie); + log_debug("Udev cookie 0x%" PRIx32 " (semid %d) created", + gen_cookie, gen_semid); + if (semctl(gen_semid, 0, SETVAL, 1) < 0) { log_error("semid %d: semctl failed: %s", gen_semid, strerror(errno)); /* We have to destroy just created semaphore * so it won't stay in the system. */ - (void) _udev_notify_sem_destroy(gen_semid, gen_cookie); + (void) _udev_notify_sem_destroy(gen_cookie, gen_semid); goto bad; } + log_debug("Udev cookie 0x%" PRIx32 " (semid %d) incremented", + gen_cookie, gen_semid); + if (close(fd)) stack; @@ -990,7 +1008,7 @@ } else if (!_udev_notify_sem_create(cookie, &semid)) goto_bad; - if (!_udev_notify_sem_inc(semid)) { + if (!_udev_notify_sem_inc(*cookie, semid)) { log_error("Could not set notification semaphore " "identified by cookie value %" PRIu32 " (0x%x)", *cookie, *cookie); @@ -999,6 +1017,10 @@ dmt->event_nr = *cookie; dmt->cookie_set = 1; + + log_debug("Udev cookie 0x%" PRIx32 " (semid %d) assigned to dm_task", + dmt->event_nr, semid); + return 1; bad: @@ -1016,7 +1038,7 @@ if (!_get_cookie_sem(cookie, &semid)) return_0; - if (!_udev_notify_sem_dec(semid)) { + if (!_udev_notify_sem_dec(cookie, semid)) { log_error("Could not signal waiting process using notification " "semaphore identified by cookie value %" PRIu32 " (0x%x)", cookie, cookie); @@ -1037,15 +1059,18 @@ if (!_get_cookie_sem(cookie, &semid)) return_0; - if (!_udev_notify_sem_dec(semid)) { + if (!_udev_notify_sem_dec(cookie, semid)) { log_error("Failed to set a proper state for notification " "semaphore identified by cookie value %" PRIu32 " (0x%x) " "to initialize waiting for incoming notifications.", cookie, cookie); - (void) _udev_notify_sem_destroy(semid, cookie); + (void) _udev_notify_sem_destroy(cookie, semid); return 0; } + log_debug("Udev cookie 0x%" PRIx32 " (semid %d): Waiting for zero", + cookie, semid); + repeat_wait: if (semop(semid, &sb, 1) < 0) { if (errno == EINTR) @@ -1053,11 +1078,11 @@ log_error("Could not set wait state for notification semaphore " "identified by cookie value %" PRIu32 " (0x%x): %s", cookie, cookie, strerror(errno)); - (void) _udev_notify_sem_destroy(semid, cookie); + (void) _udev_notify_sem_destroy(cookie, semid); return 0; } - return _udev_notify_sem_destroy(semid, cookie); + return _udev_notify_sem_destroy(cookie, semid); } #endif /* UDEV_SYNC_SUPPORT */ From prajnoha@sourceware.org Thu Aug 6 15:00:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Thu, 06 Aug 2009 15:00:00 -0000 Subject: LVM2/libdm libdm-common.c Message-ID: <20090806150026.12694.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-06 15:00:25 Modified files: libdm : libdm-common.c Log message: Detect udev problems in _rename_dev_node. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.74&r2=1.75 --- LVM2/libdm/libdm-common.c 2009/08/05 19:50:08 1.74 +++ LVM2/libdm/libdm-common.c 2009/08/06 15:00:25 1.75 @@ -381,6 +381,29 @@ return 1; } +static int _rm_dev_node(const char *dev_name) +{ + char path[PATH_MAX]; + struct stat info; + + _build_dev_path(path, sizeof(path), dev_name); + + if (stat(path, &info) < 0) + return 1; + else if (dm_udev_get_sync_support()) + log_warn("Node %s was not removed by udev. " + "Falling back to direct node removal.", path); + + if (unlink(path) < 0) { + log_error("Unable to unlink device node for '%s'", dev_name); + return 0; + } + + log_debug("Removed %s", path); + + return 1; +} + static int _rename_dev_node(const char *old_name, const char *new_name) { char oldpath[PATH_MAX]; @@ -396,6 +419,19 @@ "is already present", newpath); return 0; } + else if (dm_udev_get_sync_support()) { + if (stat(oldpath, &info) < 0 && + errno == ENOENT) + /* assume udev already deleted this */ + return 1; + else { + log_warn("The node %s should have been renamed to %s " + "by udev but old node is still present. " + "Falling back to direct old node removal.", + oldpath, newpath); + return _rm_dev_node(old_name); + } + } if (unlink(newpath) < 0) { if (errno == EPERM) { @@ -407,6 +443,11 @@ return 0; } } + else if (dm_udev_get_sync_support()) + log_warn("The node %s should have been renamed to %s " + "by udev but new node is not present. " + "Falling back to direct node rename.", + oldpath, newpath); if (rename(oldpath, newpath) < 0) { log_error("Unable to rename device node from '%s' to '%s'", @@ -419,29 +460,6 @@ return 1; } -static int _rm_dev_node(const char *dev_name) -{ - char path[PATH_MAX]; - struct stat info; - - _build_dev_path(path, sizeof(path), dev_name); - - if (stat(path, &info) < 0) - return 1; - else if (dm_udev_get_sync_support()) - log_warn("Node %s was not removed by udev. " - "Falling back to direct node removal.", path); - - if (unlink(path) < 0) { - log_error("Unable to unlink device node for '%s'", dev_name); - return 0; - } - - log_debug("Removed %s", path); - - return 1; -} - #ifdef linux static int _open_dev_node(const char *dev_name) { From prajnoha@sourceware.org Thu Aug 6 15:02:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Thu, 06 Aug 2009 15:02:00 -0000 Subject: LVM2/libdm/ioctl libdm-iface.c Message-ID: <20090806150202.2968.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-06 15:02:01 Modified files: libdm/ioctl : libdm-iface.c Log message: Fix failure situations in dm_task_run for udev sync. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.60&r2=1.61 --- LVM2/libdm/ioctl/libdm-iface.c 2009/08/03 18:01:48 1.60 +++ LVM2/libdm/ioctl/libdm-iface.c 2009/08/06 15:02:01 1.61 @@ -1486,6 +1486,18 @@ return _process_all_v4(dmt); } +/* + * If an operation that uses a cookie fails, decrement the + * semaphore instead of udev. + */ +static int _udev_complete(struct dm_task *dmt) +{ + if (dmt->cookie_set) + return dm_udev_complete(dmt->event_nr); + + return 1; +} + static int _create_and_load_v4(struct dm_task *dmt) { struct dm_task *task; @@ -1494,17 +1506,20 @@ /* Use new task struct to create the device */ if (!(task = dm_task_create(DM_DEVICE_CREATE))) { log_error("Failed to create device-mapper task struct"); + _udev_complete(dmt); return 0; } /* Copy across relevant fields */ if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { dm_task_destroy(task); + _udev_complete(dmt); return 0; } if (dmt->uuid && !dm_task_set_uuid(task, dmt->uuid)) { dm_task_destroy(task); + _udev_complete(dmt); return 0; } @@ -1516,18 +1531,22 @@ r = dm_task_run(task); dm_task_destroy(task); - if (!r) - return r; + if (!r) { + _udev_complete(dmt); + return 0; + } /* Next load the table */ if (!(task = dm_task_create(DM_DEVICE_RELOAD))) { log_error("Failed to create device-mapper task struct"); + _udev_complete(dmt); return 0; } /* Copy across relevant fields */ if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { dm_task_destroy(task); + _udev_complete(dmt); return 0; } @@ -1540,8 +1559,10 @@ task->head = NULL; task->tail = NULL; dm_task_destroy(task); - if (!r) + if (!r) { + _udev_complete(dmt); goto revert; + } /* Use the original structure last so the info will be correct */ dmt->type = DM_DEVICE_RESUME; @@ -1557,6 +1578,7 @@ dmt->type = DM_DEVICE_REMOVE; dm_free(dmt->uuid); dmt->uuid = NULL; + dmt->cookie_set = 0; if (!dm_task_run(dmt)) log_error("Failed to revert device creation."); @@ -1739,19 +1761,15 @@ if ((dmt->type == DM_DEVICE_RELOAD) && dmt->suppress_identical_reload) return _reload_with_suppression_v4(dmt); - if (!_open_control()) + if (!_open_control()) { + _udev_complete(dmt); return 0; + } /* FIXME Detect and warn if cookie set but should not be. */ repeat_ioctl: if (!(dmi = _do_dm_ioctl(dmt, command, _ioctl_buffer_double_factor))) { - /* - * If an operation that uses a cookie fails, decrement the - * semaphore instead of udev. - * FIXME Review error paths: found one where uevent fired too. - */ - if (dmt->cookie_set) - dm_udev_complete(dmt->event_nr); + _udev_complete(dmt); return 0; } From prajnoha@sourceware.org Thu Aug 6 15:04:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Thu, 06 Aug 2009 15:04:00 -0000 Subject: LVM2 libdm/libdevmapper.h libdm/libdm-common.c ... Message-ID: <20090806150431.28587.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-06 15:04:30 Modified files: libdm : libdevmapper.h libdm-common.c tools : dmsetup.c Log message: Add 'udevcomplete_all' command for dmsetup. Export DM_COOKIE_MAGIC in libdevmapper.h. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.95&r2=1.96 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.75&r2=1.76 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.120&r2=1.121 --- LVM2/libdm/libdevmapper.h 2009/08/03 18:01:47 1.95 +++ LVM2/libdm/libdevmapper.h 2009/08/06 15:04:30 1.96 @@ -1014,6 +1014,8 @@ void dm_report_field_set_value(struct dm_report_field *field, const void *value, const void *sortvalue); +#define DM_COOKIE_MAGIC 0x0D4D + int dm_cookie_supported(void); /* --- LVM2/libdm/libdm-common.c 2009/08/06 15:00:25 1.75 +++ LVM2/libdm/libdm-common.c 2009/08/06 15:04:30 1.76 @@ -39,7 +39,6 @@ #endif #define DEV_DIR "/dev/" -#define COOKIE_MAGIC 0x0D4D static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR; @@ -837,7 +836,7 @@ static int _get_cookie_sem(uint32_t cookie, int *semid) { - if (!(cookie >> 16 & COOKIE_MAGIC)) { + if (cookie >> 16 != DM_COOKIE_MAGIC) { log_error("Could not continue to access notification " "semaphore identified by cookie value %" PRIu32 " (0x%x). Incorrect cookie prefix.", @@ -952,7 +951,7 @@ goto bad; } - gen_cookie = COOKIE_MAGIC << 16 | base_cookie; + gen_cookie = DM_COOKIE_MAGIC << 16 | base_cookie; if (base_cookie && (gen_semid = semget((key_t) gen_cookie, 1, 0600 | IPC_CREAT | IPC_EXCL)) < 0) { @@ -1093,6 +1092,9 @@ if (semop(semid, &sb, 1) < 0) { if (errno == EINTR) goto repeat_wait; + else if (errno == EIDRM) + return 1; + log_error("Could not set wait state for notification semaphore " "identified by cookie value %" PRIu32 " (0x%x): %s", cookie, cookie, strerror(errno)); --- LVM2/tools/dmsetup.c 2009/08/03 18:01:46 1.120 +++ LVM2/tools/dmsetup.c 2009/08/06 15:04:30 1.121 @@ -40,6 +40,12 @@ #include #include +#ifdef UDEV_SYNC_SUPPORT +# include +# include +# include +#endif + /* FIXME Unused so far */ #undef HAVE_SYS_STATVFS_H @@ -273,6 +279,34 @@ struct dm_split_name *split_name; }; +static char _yes_no_prompt(const char *prompt, ...) +{ + int c = 0, ret = 0; + va_list ap; + + do { + if (c == '\n' || !c) { + va_start(ap, prompt); + vprintf(prompt, ap); + va_end(ap); + } + + if ((c = getchar()) == EOF) { + ret = 'n'; + break; + } + + c = tolower(c); + if ((c == 'y') || (c == 'n')) + ret = c; + } while (!ret || c != '\n'); + + if (c != '\n') + printf("\n"); + + return ret; +} + static struct dm_task *_get_deps_task(int major, int minor) { struct dm_task *dmt; @@ -763,6 +797,62 @@ return dm_udev_complete(cookie); } +#ifndef UDEV_SYNC_SUPPORT +static int _udevcomplete_all(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) +{ + return 1; +} + +#else + +static int _udevcomplete_all(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) +{ + int max_id, id, sid; + struct seminfo sinfo; + struct semid_ds sdata; + int counter = 0; + + log_warn("This operation will destroy all semaphores with keys " + "that have a prefix %" PRIu16 " (0x%" PRIx16 ").", + DM_COOKIE_MAGIC, DM_COOKIE_MAGIC); + + if (_yes_no_prompt("Do you really want to continue? [y/n]: ") == 'n') { + log_print("Semaphores with keys prefixed by %" PRIu16 + " (0x%" PRIx16 ") NOT destroyed.", + DM_COOKIE_MAGIC, DM_COOKIE_MAGIC); + return 1; + } + + if ((max_id = semctl(0, 0, SEM_INFO, &sinfo)) < 0) { + log_sys_error("semctl", "SEM_INFO"); + return 0; + } + + for (id = 0; id <= max_id; id++) { + if ((sid = semctl(id, 0, SEM_STAT, &sdata)) < 0) + continue; + + if (sdata.sem_perm.__key >> 16 == DM_COOKIE_MAGIC) { + if (semctl(sid, 0, IPC_RMID, 0) < 0) { + log_error("Could not cleanup notification semaphore " + "with semid %d and cookie value " + "%" PRIu32 " (0x%" PRIx32 ")", sid, + sdata.sem_perm.__key, sdata.sem_perm.__key); + continue; + } + + counter++; + } + } + + log_print("%d semaphores with keys prefixed by " + "%" PRIu16 " (0x%" PRIx16 ") destroyed.", + counter, DM_COOKIE_MAGIC, DM_COOKIE_MAGIC); + + return 1; +} +#endif + static int _version(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) { char version[80]; @@ -2294,6 +2384,7 @@ {"wait", " []", 0, 2, _wait}, {"mknodes", "[]", 0, 1, _mknodes}, {"udevcomplete", "", 1, 1, _udevcomplete}, + {"udevcomplete_all", "", 0, 0, _udevcomplete_all}, {"targets", "", 0, 0, _targets}, {"version", "", 0, 0, _version}, {"setgeometry", " ", 5, 5, _setgeometry}, From prajnoha@sourceware.org Thu Aug 6 15:05:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Thu, 06 Aug 2009 15:05:00 -0000 Subject: LVM2/tools dmsetup.c Message-ID: <20090806150511.30932.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-06 15:05:11 Modified files: tools : dmsetup.c Log message: Add 'udevcookies' command for dmsetup. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.121&r2=1.122 --- LVM2/tools/dmsetup.c 2009/08/06 15:04:30 1.121 +++ LVM2/tools/dmsetup.c 2009/08/06 15:05:10 1.122 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -853,6 +854,45 @@ } #endif +static int _udevcookies(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) +{ + int max_id, id, sid; + struct seminfo sinfo; + struct semid_ds sdata; + int val; + char *time_str; + + if ((max_id = semctl(0, 0, SEM_INFO, &sinfo)) < 0) { + log_sys_error("sem_ctl", "SEM_INFO"); + return 0; + } + + printf("cookie semid value last_semop_time\n"); + + for (id = 0; id <= max_id; id++) { + if ((sid = semctl(id, 0, SEM_STAT, &sdata)) < 0) + continue; + + if (sdata.sem_perm.__key >> 16 == DM_COOKIE_MAGIC) { + if ((val = semctl(sid, 0, GETVAL)) < 0) { + log_error("semid %d: sem_ctl failed for " + "cookie 0x%" PRIx32 ": %s", + sid, sdata.sem_perm.__key, + strerror(errno)); + continue; + } + + time_str = ctime((const time_t *) &sdata.sem_otime); + + printf("0x%-10x %-10d %-10d %s", sdata.sem_perm.__key, + sid, val, time_str ? time_str : "unknown"); + } + } + + return 1; +} + + static int _version(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) { char version[80]; @@ -2385,6 +2425,7 @@ {"mknodes", "[]", 0, 1, _mknodes}, {"udevcomplete", "", 1, 1, _udevcomplete}, {"udevcomplete_all", "", 0, 0, _udevcomplete_all}, + {"udevcookies", "", 0, 0, _udevcookies}, {"targets", "", 0, 0, _targets}, {"version", "", 0, 0, _version}, {"setgeometry", " ", 5, 5, _setgeometry}, From prajnoha@sourceware.org Thu Aug 6 15:10:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Thu, 06 Aug 2009 15:10:00 -0000 Subject: LVM2/udev 12-dm-permissions.rules Message-ID: <20090806151059.2607.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-06 15:10:58 Added files: udev : 12-dm-permissions.rules Log message: Rename template rule file 11-dm-permissions.rules to 12-dm-permissions.rules. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/12-dm-permissions.rules.diff?cvsroot=lvm2&r1=NONE&r2=1.1 /cvs/lvm2/LVM2/udev/12-dm-permissions.rules,v --> standard output revision 1.1 --- LVM2/udev/12-dm-permissions.rules +++ - 2009-08-06 15:10:58.968635000 +0000 @@ -0,0 +1,18 @@ +# Udev rules for device-mapper devices. +# +# These rules set permissions for DM devices. There are some environment +# variables set that can be used: +# DM_NAME - actual DM device's name +# DM_UUID - UUID set for DM device (blank if not specified) +# DM_SUSPENDED - suspended state of DM device (0 or 1) +# DM_LV_NAME - logical volume name (not set if LVM device not present) +# DM_VG_NAME - volume group name (not set if LVM device not present) +# DM_LV_LAYER - logical volume layer (not set if LVM device not present) + +SUBSYSTEM!="block", GOTO="dm_end" +KERNEL!="dm-[0-9]*", GOTO="dm_end" +ACTION!="change", GOTO="dm_end" + +#ENV{DM_NAME}=="my_device", OWNER:="peter", GROUP:="peter", MODE:="644" + +LABEL="dm_end" From prajnoha@sourceware.org Thu Aug 6 15:28:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Thu, 06 Aug 2009 15:28:00 -0000 Subject: LVM2/udev 11-dm-permissions.rules Message-ID: <20090806152805.9289.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-06 15:28:05 Removed files: udev : 11-dm-permissions.rules Log message: Remove 11-dm-permissions.rules (is now in 12-dm-permissions.rules). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/11-dm-permissions.rules.diff?cvsroot=lvm2&r1=1.1&r2=NONE From prajnoha@sourceware.org Thu Aug 6 15:56:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Thu, 06 Aug 2009 15:56:00 -0000 Subject: LVM2/tools dmsetup.c Message-ID: <20090806155651.23427.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-06 15:56:51 Modified files: tools : dmsetup.c Log message: Fix semaphore includes in dmsetup for udev sync. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.122&r2=1.123 --- LVM2/tools/dmsetup.c 2009/08/06 15:05:10 1.122 +++ LVM2/tools/dmsetup.c 2009/08/06 15:56:50 1.123 @@ -280,34 +280,6 @@ struct dm_split_name *split_name; }; -static char _yes_no_prompt(const char *prompt, ...) -{ - int c = 0, ret = 0; - va_list ap; - - do { - if (c == '\n' || !c) { - va_start(ap, prompt); - vprintf(prompt, ap); - va_end(ap); - } - - if ((c = getchar()) == EOF) { - ret = 'n'; - break; - } - - c = tolower(c); - if ((c == 'y') || (c == 'n')) - ret = c; - } while (!ret || c != '\n'); - - if (c != '\n') - printf("\n"); - - return ret; -} - static struct dm_task *_get_deps_task(int major, int minor) { struct dm_task *dmt; @@ -804,8 +776,41 @@ return 1; } +static int _udevcookies(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) +{ + return 1; +} + #else +static char _yes_no_prompt(const char *prompt, ...) +{ + int c = 0, ret = 0; + va_list ap; + + do { + if (c == '\n' || !c) { + va_start(ap, prompt); + vprintf(prompt, ap); + va_end(ap); + } + + if ((c = getchar()) == EOF) { + ret = 'n'; + break; + } + + c = tolower(c); + if ((c == 'y') || (c == 'n')) + ret = c; + } while (!ret || c != '\n'); + + if (c != '\n') + printf("\n"); + + return ret; +} + static int _udevcomplete_all(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) { int max_id, id, sid; @@ -852,7 +857,6 @@ return 1; } -#endif static int _udevcookies(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) { @@ -891,7 +895,7 @@ return 1; } - +#endif static int _version(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused))) { From agk@sourceware.org Thu Aug 6 16:30:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 06 Aug 2009 16:30:00 -0000 Subject: LVM2 WHATS_NEW_DM Message-ID: <20090806163035.30133.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-06 16:30:35 Modified files: . : WHATS_NEW_DM Log message: pre-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.291&r2=1.292 --- LVM2/WHATS_NEW_DM 2009/07/31 18:30:31 1.291 +++ LVM2/WHATS_NEW_DM 2009/08/06 16:30:34 1.292 @@ -1,6 +1,6 @@ -Version 1.02.36 - -================================ - Add udevcomplete and --noudevwait to dmsetup. +Version 1.02.36 - 6th August 2009 +================================= + Add udevcookies, udevcomplete, udevcomplete_all and --noudevwait to dmsetup. Add libdevmapper functions to support synchronisation with udev. Version 1.02.35 - 28th July 2009 From agk@sourceware.org Thu Aug 6 17:08:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 06 Aug 2009 17:08:00 -0000 Subject: LVM2 ./VERSION ./VERSION_DM ./WHATS_NEW libdm/ ... Message-ID: <20090806170804.13976.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-06 17:08:02 Modified files: . : VERSION VERSION_DM WHATS_NEW libdm : .exported_symbols Log message: pre-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.205&r2=1.206 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1232&r2=1.1233 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/.exported_symbols.diff?cvsroot=lvm2&r1=1.42&r2=1.43 --- LVM2/VERSION 2009/07/28 20:47:40 1.205 +++ LVM2/VERSION 2009/08/06 17:08:01 1.206 @@ -1 +1 @@ -2.02.51(1)-cvs (2009-07-28) +2.02.51(1)-cvs (2009-08-06) --- LVM2/VERSION_DM 2009/07/28 20:47:40 1.17 +++ LVM2/VERSION_DM 2009/08/06 17:08:01 1.18 @@ -1 +1 @@ -1.02.36-cvs (2009-07-28) +1.02.36-cvs (2009-08-06) --- LVM2/WHATS_NEW 2009/08/05 14:18:35 1.1232 +++ LVM2/WHATS_NEW 2009/08/06 17:08:01 1.1233 @@ -1,5 +1,5 @@ -Version 2.02.51 - -================================ +Version 2.02.51 - 6th August 2009 +================================= Fix locking in clvmd (2.02.50). Add --noudevsync option for relevant LVM tools. Add activation/udev_sync to lvm.conf. --- LVM2/libdm/.exported_symbols 2009/08/03 18:01:47 1.42 +++ LVM2/libdm/.exported_symbols 2009/08/06 17:08:01 1.43 @@ -157,6 +157,7 @@ dm_list_prev dm_list_next dm_list_size +dm_cookie_supported dm_udev_set_sync_support dm_udev_get_sync_support dm_udev_complete From agk@sourceware.org Thu Aug 6 19:32:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 06 Aug 2009 19:32:00 -0000 Subject: LVM2 VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Message-ID: <20090806193227.25785.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-06 19:32:27 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.206&r2=1.207 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.18&r2=1.19 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1233&r2=1.1234 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.292&r2=1.293 --- LVM2/VERSION 2009/08/06 17:08:01 1.206 +++ LVM2/VERSION 2009/08/06 19:32:26 1.207 @@ -1 +1 @@ -2.02.51(1)-cvs (2009-08-06) +2.02.52(1)-cvs (2009-08-06) --- LVM2/VERSION_DM 2009/08/06 17:08:01 1.18 +++ LVM2/VERSION_DM 2009/08/06 19:32:26 1.19 @@ -1 +1 @@ -1.02.36-cvs (2009-08-06) +1.02.37-cvs (2009-08-06) --- LVM2/WHATS_NEW 2009/08/06 17:08:01 1.1233 +++ LVM2/WHATS_NEW 2009/08/06 19:32:26 1.1234 @@ -1,3 +1,6 @@ +Version 2.02.52 - +================================= + Version 2.02.51 - 6th August 2009 ================================= Fix locking in clvmd (2.02.50). --- LVM2/WHATS_NEW_DM 2009/08/06 16:30:34 1.292 +++ LVM2/WHATS_NEW_DM 2009/08/06 19:32:26 1.293 @@ -1,3 +1,6 @@ +Version 1.02.37 - +================================= + Version 1.02.36 - 6th August 2009 ================================= Add udevcookies, udevcomplete, udevcomplete_all and --noudevwait to dmsetup. From wysochanski@sourceware.org Fri Aug 7 21:22:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Fri, 07 Aug 2009 21:22:00 -0000 Subject: LVM2/test/api test.c Message-ID: <20090807212238.32206.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-07 21:22:37 Modified files: test/api : test.c Log message: Update test/api/test.c to call lvm_vg_create and lvm_vg_remove. Also fix a couple bugs. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/test.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25 --- LVM2/test/api/test.c 2009/07/29 14:06:31 1.24 +++ LVM2/test/api/test.c 2009/08/07 21:22:37 1.25 @@ -81,6 +81,10 @@ "Issue a lvm_vg_open() API call on VG 'vgname'\n"); printf("'vg_close vgname': " "Issue a lvm_vg_close() API call on VG 'vgname'\n"); + printf("'vg_create vgname: " + "Issue a lvm_vg_create() to create VG 'vgname'\n"); + printf("'vg_remove vgname: " + "Issue a lvm_vg_remove() to remove VG 'vgname'\n"); printf("'config_reload': " "Issue a lvm_config_reload() API to reload LVM config\n"); printf("'config_override' device: " @@ -351,24 +355,70 @@ return; } vg = _lookup_vg_by_name(argv, argc); - if (vg) - rc = lvm_vg_write(vg); + if (!vg) { + printf("Can't find vg_name %s\n", argv[1]); + return; + } + rc = lvm_vg_write(vg); _lvm_status_to_pass_fail(rc); printf("writing VG %s\n", lvm_vg_get_name(vg)); } +static void _vg_create(char **argv, int argc, lvm_t libh) +{ + vg_t *vg; + + if (argc < 2) { + printf ("Please enter vg_name\n"); + return; + } + vg = lvm_vg_create(libh, argv[1]); + if (!vg || !lvm_vg_get_name(vg)) { + printf("Error creating %s\n", argv[1]); + return; + } + + printf("Success creating vg %s\n", argv[1]); + dm_hash_insert(_vgname_hash, lvm_vg_get_name(vg), vg); + dm_hash_insert(_vgid_hash, lvm_vg_get_uuid(vg), vg); +} + +static void _vg_remove(char **argv, int argc) +{ + vg_t *vg; + int rc = 0; + + if (argc < 2) { + printf ("Please enter vg_name\n"); + return; + } + vg = _lookup_vg_by_name(argv, argc); + if (!vg) { + printf("Can't find vg_name %s\n", argv[1]); + return; + } + rc = lvm_vg_remove(vg); + _lvm_status_to_pass_fail(rc); + printf("removing VG\n"); +} + static void _vg_close(char **argv, int argc) { vg_t *vg; + int rc = 0; if (argc < 2) { printf ("Please enter vg_name\n"); return; } vg = _lookup_and_remove_vg(argv[1]); - if (vg) - lvm_vg_close(vg); - /* FIXME: remove LVs from lvname_hash */ + if (!vg) { + printf("Can't find vg_name %s\n", argv[1]); + return; + } + rc = lvm_vg_close(vg); + _lvm_status_to_pass_fail(rc); + printf("closing VG\n"); } static void _show_one_vg(vg_t *vg) @@ -593,6 +643,10 @@ _vg_open(argv, argc, libh); } else if (!strcmp(argv[0], "vg_close")) { _vg_close(argv, argc); + } else if (!strcmp(argv[0], "vg_create")) { + _vg_create(argv, argc, libh); + } else if (!strcmp(argv[0], "vg_remove")) { + _vg_remove(argv, argc); } else if (!strcmp(argv[0], "lv_activate")) { _lv_activate(argv, argc); } else if (!strcmp(argv[0], "lv_deactivate")) { From wysochanski@sourceware.org Mon Aug 10 17:15:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 10 Aug 2009 17:15:00 -0000 Subject: LVM2/lib/metadata metadata.c Message-ID: <20090810171502.3160.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-10 17:15:02 Modified files: lib/metadata : metadata.c Log message: Remove useless _pv_write wrapper. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.277&r2=1.278 --- LVM2/lib/metadata/metadata.c 2009/08/01 17:08:44 1.277 +++ LVM2/lib/metadata/metadata.c 2009/08/10 17:15:01 1.278 @@ -45,10 +45,6 @@ uint64_t *label_sector, int warnings, int scan_label_only); -static int _pv_write(struct cmd_context *cmd __attribute((unused)), - struct physical_volume *pv, - struct dm_list *mdas, int64_t label_sector); - static struct physical_volume *_find_pv_by_name(struct cmd_context *cmd, const char *pv_name); @@ -2995,18 +2991,10 @@ return _get_pvs(cmd, NULL); } -/* FIXME: liblvm todo - make into function that takes handle */ int pv_write(struct cmd_context *cmd __attribute((unused)), struct physical_volume *pv, struct dm_list *mdas, int64_t label_sector) { - return _pv_write(cmd, pv, mdas, label_sector); -} - -static int _pv_write(struct cmd_context *cmd __attribute((unused)), - struct physical_volume *pv, - struct dm_list *mdas, int64_t label_sector) -{ if (!pv->fmt->ops->pv_write) { log_error("Format does not support writing physical volumes"); return 0; @@ -3037,7 +3025,7 @@ return 0; } - if (!_pv_write(cmd, pv, NULL, INT64_C(-1))) { + if (!pv_write(cmd, pv, NULL, INT64_C(-1))) { log_error("Failed to clear metadata from physical " "volume \"%s\" after removal from \"%s\"", pv_dev_name(pv), old_vg_name); From wysochanski@sourceware.org Mon Aug 10 17:23:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 10 Aug 2009 17:23:00 -0000 Subject: LVM2/man lvconvert.8.in lvcreate.8.in lvextend ... Message-ID: <20090810172305.5775.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-10 17:23:05 Modified files: man : lvconvert.8.in lvcreate.8.in lvextend.8.in lvresize.8.in Log message: Update man pages to clarify usage of PE ranges. Author: Dave Wysochanski Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.in.diff?cvsroot=lvm2&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvcreate.8.in.diff?cvsroot=lvm2&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvextend.8.in.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvresize.8.in.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/man/lvconvert.8.in 2009/08/04 08:09:52 1.7 +++ LVM2/man/lvconvert.8.in 2009/08/10 17:23:04 1.8 @@ -10,7 +10,8 @@ [\-\-noudevsync] [\-v|\-\-verbose] [\-y|\-\-yes] [\-\-version] -LogicalVolume[Path] [PhysicalVolume[Path]...] +.br +LogicalVolume[Path] [PhysicalVolume[Path][:PE[-PE]]...] .br .br @@ -124,6 +125,12 @@ .br converts logical volume "vg00/lvol2" to snapshot of original volume "vg00/lvol1" +.br +"lvconvert -m1 vg00/lvol1 /dev/sda:0-15 /dev/sdb:0-15" +.br +converts linear logical volume "vg00/lvol1" to a two-way mirror, using physical +extents /dev/sda:0-15 and /dev/sdb:0-15 for allocation of new extents. + .SH SEE ALSO .BR lvm (8), .BR vgcreate (8), --- LVM2/man/lvcreate.8.in 2009/08/04 08:09:52 1.9 +++ LVM2/man/lvcreate.8.in 2009/08/10 17:23:04 1.10 @@ -17,7 +17,7 @@ [\-p|\-\-permission r|rw] [\-r|\-\-readahead ReadAheadSectors|auto|none] [\-t|\-\-test] [\-v|\-\-verbose] [\-Z|\-\-zero y|n] -VolumeGroupName [PhysicalVolumePath...] +VolumeGroupName [PhysicalVolumePath[:PE[-PE]]...] .br .br @@ -209,6 +209,13 @@ .br creates a sparse device named /dev/vg1/sparse of size 1TB with space for just under 100MB of actual data on it. +.br + +"lvcreate -L 64M -n lvol1 vg00 /dev/sda:0-7 /dev/sdb:0-7" +.br +creates a linear logical volume "vg00/lvol1" using physical extents +/dev/sda:0-7 and /dev/sdb:0-7 for allocation of extents. + .SH SEE ALSO .BR lvm (8), --- LVM2/man/lvextend.8.in 2009/08/04 08:09:52 1.4 +++ LVM2/man/lvextend.8.in 2009/08/10 17:23:04 1.5 @@ -10,7 +10,7 @@ {\-l|\-\-extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] | \-L|\-\-size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [\-t|\-\-test] -[\-v|\-\-verbose] LogicalVolumePath [PhysicalVolumePath...] +[\-v|\-\-verbose] LogicalVolumePath [PhysicalVolumePath[:PE[-PE]]...] .SH DESCRIPTION lvextend allows you to extend the size of a logical volume. Extension of snapshot logical volumes (see @@ -68,6 +68,13 @@ "lvextend /dev/vg01/lvol01 /dev/sdk3" tries to extend the size of that logical volume by the amount of free space on physical volume /dev/sdk3. This is equivalent to specifying "-l +100%PVS" on the command line. + +.br +"lvextend -L+16M vg01/lvol01 /dev/sda:8-9 /dev/sdb:8-9" +.br +tries to extend a logical volume "vg01/lvol01" by 16MB using physical extents +/dev/sda:8-9 and /dev/sdb:8-9 for allocation of extents. + .SH SEE ALSO .BR lvm (8), .BR lvcreate (8), --- LVM2/man/lvresize.8.in 2009/08/04 08:09:52 1.5 +++ LVM2/man/lvresize.8.in 2009/08/10 17:23:04 1.6 @@ -10,7 +10,7 @@ {\-l|\-\-extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] | \-L|\-\-size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [\-t|\-\-test] -[\-v|\-\-verbose] LogicalVolumePath [PhysicalVolumePath...] +[\-v|\-\-verbose] LogicalVolumePath [PhysicalVolumePath[:PE[-PE]]...] .SH DESCRIPTION lvresize allows you to resize a logical volume. Be careful when reducing a logical volume's size, because data in the reduced @@ -66,6 +66,13 @@ must use a single value throughout. .br StripeSize must be 2^n (n = 2 to 9) +.SH Examples +.br +"lvresize -L+16M vg1/lv1 /dev/sda:0-1 /dev/sdb:0-1" +.br +tries to extend a logical volume "vg1/lv1" by 16MB using physical extents +/dev/sda:0-1 and /dev/sdb:0-1 for allocation of extents. + .SH SEE ALSO .BR lvm (8), .BR lvconvert (8), From ccaulfield@sourceware.org Thu Aug 13 10:39:00 2009 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Thu, 13 Aug 2009 10:39:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd.c Message-ID: <20090813103942.13382.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: ccaulfield@sourceware.org 2009-08-13 10:39:42 Modified files: . : WHATS_NEW daemons/clvmd : clvmd.c Log message: Fix compilation warning in clvmd.c Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1234&r2=1.1235 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60 --- LVM2/WHATS_NEW 2009/08/06 19:32:26 1.1234 +++ LVM2/WHATS_NEW 2009/08/13 10:39:41 1.1235 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Fix compile warning in clvmd. Version 2.02.51 - 6th August 2009 ================================= --- LVM2/daemons/clvmd/clvmd.c 2009/06/15 12:15:23 1.59 +++ LVM2/daemons/clvmd/clvmd.c 2009/08/13 10:39:41 1.60 @@ -110,6 +110,8 @@ typedef enum {IF_AUTO, IF_CMAN, IF_GULM, IF_OPENAIS, IF_COROSYNC} if_type_t; +typedef void *(lvm_pthread_fn_t)(void*); + /* Prototypes for code further down */ static void sigusr2_handler(int sig); static void sighup_handler(int sig); @@ -138,7 +140,7 @@ static int local_rendezvous_callback(struct local_client *thisfd, char *buf, int len, const char *csid, struct local_client **new_client); -static void *lvm_thread_fn(void *); +static void lvm_thread_fn(void *) __attribute__ ((noreturn)); static int add_to_lvmqueue(struct local_client *client, struct clvm_header *msg, int msglen, const char *csid); static int distribute_command(struct local_client *thisfd); @@ -461,7 +463,7 @@ /* Don't let anyone else to do work until we are started */ pthread_mutex_lock(&lvm_start_mutex); - pthread_create(&lvm_thread, NULL, lvm_thread_fn, + pthread_create(&lvm_thread, NULL, (lvm_pthread_fn_t*)lvm_thread_fn, (void *)(long)using_gulm); /* Tell the rest of the cluster our version number */ @@ -1797,7 +1799,7 @@ /* * Routine that runs in the "LVM thread". */ -static __attribute__ ((noreturn)) void *lvm_thread_fn(void *arg) +static void lvm_thread_fn(void *arg) { struct dm_list *cmdl, *tmp; sigset_t ss; From wysochanski@sourceware.org Thu Aug 13 12:03:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 13 Aug 2009 12:03:00 -0000 Subject: LVM2/tools vgextend.c Message-ID: <20090813120347.6299.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-13 12:03:47 Modified files: tools : vgextend.c Log message: Fix vgextend error path - if ORPHAN lock fails, unlock and release vg. Full changes - Fix vgextend error path when lock_vol(VG_ORPHANS) fails - Move lock_vol(VG_ORPHANS) before archive(vg) - safe & simpler error paths - Remove legacy comment/code that no longer applies Found in review - Milan Broz Signed-off-by: Dave Wysochanski Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49 --- LVM2/tools/vgextend.c 2009/07/24 15:01:44 1.48 +++ LVM2/tools/vgextend.c 2009/08/13 12:03:46 1.49 @@ -43,21 +43,15 @@ return ECMD_FAILED; } -/********** FIXME - log_print("maximum logical volume size is %s", - (dummy = lvm_show_size(LVM_LV_SIZE_MAX(vg) / 2, LONG))); - dm_free(dummy); - dummy = NULL; -**********/ - - if (!archive(vg)) - goto error; - if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) { log_error("Can't get lock for orphan PVs"); + unlock_and_release_vg(cmd, vg, vg_name); return ECMD_FAILED; } + if (!archive(vg)) + goto error; + /* extend vg */ if (!vg_extend(vg, argc, argv)) goto error; From wysochanski@sourceware.org Thu Aug 13 12:04:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 13 Aug 2009 12:04:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20090813120402.10096.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-13 12:04:01 Modified files: . : WHATS_NEW Log message: Update WHATS_NEW for recent checkins. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1235&r2=1.1236 --- LVM2/WHATS_NEW 2009/08/13 10:39:41 1.1235 +++ LVM2/WHATS_NEW 2009/08/13 12:04:01 1.1236 @@ -1,6 +1,10 @@ Version 2.02.52 - ================================= + Fix vgextend error path - if ORPHAN lock fails, unlock / release vg (2.02.49). Fix compile warning in clvmd. + Update lv{convert|create|extend|resize} man pages - clarify use of PE ranges. + Remove useless _pv_write wrapper. + Update test/api/test.c to call lvm_vg_create and lvm_vg_remove. Version 2.02.51 - 6th August 2009 ================================= From wysochanski@sourceware.org Thu Aug 13 12:16:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 13 Aug 2009 12:16:00 -0000 Subject: LVM2 liblvm/lvm2app.h liblvm/lvm_lv.c liblvm/l ... Message-ID: <20090813121646.5522.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-13 12:16:45 Modified files: liblvm : lvm2app.h lvm_lv.c lvm_vg.c test/api : test.c vgtest.c Log message: Make lvm2app vg_t handle definition consistent with lvm_t. This patch update vg_t handle to be consistent with lvm_t - define as a pointer to internal struct volume_group. Author: Dave Wysochanski Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm2app.h.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_lv.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_vg.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/test.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/vgtest.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10 --- LVM2/liblvm/lvm2app.h 2009/08/03 12:11:45 1.3 +++ LVM2/liblvm/lvm2app.h 2009/08/13 12:16:45 1.4 @@ -112,7 +112,7 @@ * return a read-write object, but open functions have the argument mode to * define if the object can be modified or not. */ -typedef struct volume_group vg_t; +typedef struct volume_group *vg_t; /** * Logical Volume object. @@ -285,7 +285,7 @@ * begin with a "#" and should be filtered out and not used. * * To process the list, use the dm_list iterator functions. For example: - * vg_t *vg; + * vg_t vg; * struct dm_list *vgnames; * struct lvm_str_list *strl; * @@ -350,7 +350,7 @@ * * \return non-NULL VG handle (success) or NULL (failure). */ -vg_t *lvm_vg_open(lvm_t libh, const char *vgname, const char *mode, +vg_t lvm_vg_open(lvm_t libh, const char *vgname, const char *mode, uint32_t flags); /** @@ -374,7 +374,7 @@ * \return * non-NULL vg handle (success) or NULL (failure) */ -vg_t *lvm_vg_create(lvm_t libh, const char *vg_name); +vg_t lvm_vg_create(lvm_t libh, const char *vg_name); /** * Write a VG to disk. @@ -389,7 +389,7 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_vg_write(vg_t *vg); +int lvm_vg_write(vg_t vg); /** * Remove a VG from the system. @@ -403,7 +403,7 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_vg_remove(vg_t *vg); +int lvm_vg_remove(vg_t vg); /** * Close a VG opened with lvm_vg_create or lvm_vg_open. @@ -417,7 +417,7 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_vg_close(vg_t *vg); +int lvm_vg_close(vg_t vg); /** * Extend a VG by adding a device. @@ -440,7 +440,7 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_vg_extend(vg_t *vg, const char *device); +int lvm_vg_extend(vg_t vg, const char *device); /** * Reduce a VG by removing an unused device. @@ -459,7 +459,7 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_vg_reduce(vg_t *vg, const char *device); +int lvm_vg_reduce(vg_t vg, const char *device); /** * Set the extent size of a VG. @@ -478,7 +478,7 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_vg_set_extent_size(vg_t *vg, uint32_t new_size); +int lvm_vg_set_extent_size(vg_t vg, uint32_t new_size); /** * Get the current metadata sequence number of a volume group. @@ -493,7 +493,7 @@ * \return * Metadata sequence number. */ -uint64_t lvm_vg_get_seqno(const vg_t *vg); +uint64_t lvm_vg_get_seqno(const vg_t vg); /** * Get the current name of a volume group. @@ -507,7 +507,7 @@ * \return * Copy of the uuid string. */ -char *lvm_vg_get_uuid(const vg_t *vg); +char *lvm_vg_get_uuid(const vg_t vg); /** * Get the current uuid of a volume group. @@ -521,7 +521,7 @@ * \return * Copy of the name. */ -char *lvm_vg_get_name(const vg_t *vg); +char *lvm_vg_get_name(const vg_t vg); /** * Get the current size in bytes of a volume group. @@ -532,7 +532,7 @@ * \return * Size in bytes. */ -uint64_t lvm_vg_get_size(const vg_t *vg); +uint64_t lvm_vg_get_size(const vg_t vg); /** * Get the current unallocated space in bytes of a volume group. @@ -543,7 +543,7 @@ * \return * Free size in bytes. */ -uint64_t lvm_vg_get_free_size(const vg_t *vg); +uint64_t lvm_vg_get_free_size(const vg_t vg); /** * Get the current extent size in bytes of a volume group. @@ -554,7 +554,7 @@ * \return * Extent size in bytes. */ -uint64_t lvm_vg_get_extent_size(const vg_t *vg); +uint64_t lvm_vg_get_extent_size(const vg_t vg); /** * Get the current number of total extents of a volume group. @@ -565,7 +565,7 @@ * \return * Extent count. */ -uint64_t lvm_vg_get_extent_count(const vg_t *vg); +uint64_t lvm_vg_get_extent_count(const vg_t vg); /** * Get the current number of free extents of a volume group. @@ -576,7 +576,7 @@ * \return * Free extent count. */ -uint64_t lvm_vg_get_free_extent_count(const vg_t *vg); +uint64_t lvm_vg_get_free_extent_count(const vg_t vg); /** * Get the current number of physical volumes of a volume group. @@ -587,7 +587,7 @@ * \return * Physical volume count. */ -uint64_t lvm_vg_get_pv_count(const vg_t *vg); +uint64_t lvm_vg_get_pv_count(const vg_t vg); /************************** logical volume handling *************************/ @@ -601,7 +601,7 @@ * A list of lv_list_t structures containing lv handles for this vg. * If no LVs exist on the given VG, NULL is returned. */ -struct dm_list *lvm_vg_list_lvs(vg_t *vg); +struct dm_list *lvm_vg_list_lvs(vg_t vg); /** * Create a linear logical volume. @@ -623,7 +623,7 @@ * non-NULL handle to an LV object created, or NULL if creation fails. * */ -lv_t *lvm_vg_create_lv_linear(vg_t *vg, const char *name, uint64_t size); +lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size); /** * Activate a logical volume. @@ -767,7 +767,7 @@ * A list of pv_list_t structures containing pv handles for this vg. * If no PVs exist on the given VG, NULL is returned. */ -struct dm_list *lvm_vg_list_pvs(vg_t *vg); +struct dm_list *lvm_vg_list_pvs(vg_t vg); /** * Get the current uuid of a logical volume. --- LVM2/liblvm/lvm_lv.c 2009/07/29 16:47:53 1.14 +++ LVM2/liblvm/lvm_lv.c 2009/08/13 12:16:45 1.15 @@ -70,7 +70,7 @@ /* Set defaults for non-segment specific LV parameters */ static void _lv_set_default_params(struct lvcreate_params *lp, - vg_t *vg, const char *lvname, + vg_t vg, const char *lvname, uint64_t extents) { lp->zero = 1; @@ -101,7 +101,7 @@ * lvm_vg_write. However, this appears to be non-trivial change until * lv_create_single is refactored by segtype. */ -lv_t *lvm_vg_create_lv_linear(vg_t *vg, const char *name, uint64_t size) +lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size) { struct lvcreate_params lp; uint64_t extents; --- LVM2/liblvm/lvm_vg.c 2009/08/03 12:11:45 1.25 +++ LVM2/liblvm/lvm_vg.c 2009/08/13 12:16:45 1.26 @@ -25,9 +25,9 @@ #include #include -vg_t *lvm_vg_create(lvm_t libh, const char *vg_name) +vg_t lvm_vg_create(lvm_t libh, const char *vg_name) { - vg_t *vg; + struct volume_group *vg; vg = vg_create((struct cmd_context *)libh, vg_name); /* FIXME: error handling is still TBD */ @@ -36,10 +36,10 @@ return NULL; } vg->open_mode = 'w'; - return (vg_t *) vg; + return (vg_t) vg; } -int lvm_vg_extend(vg_t *vg, const char *device) +int lvm_vg_extend(vg_t vg, const char *device) { if (vg_read_error(vg)) return -1; @@ -72,7 +72,7 @@ return 0; } -int lvm_vg_reduce(vg_t *vg, const char *device) +int lvm_vg_reduce(vg_t vg, const char *device) { if (vg_read_error(vg)) return -1; @@ -84,7 +84,7 @@ return 0; } -int lvm_vg_set_extent_size(vg_t *vg, uint32_t new_size) +int lvm_vg_set_extent_size(vg_t vg, uint32_t new_size) { if (vg_read_error(vg)) return -1; @@ -96,7 +96,7 @@ return 0; } -int lvm_vg_write(vg_t *vg) +int lvm_vg_write(vg_t vg) { struct pv_list *pvl; @@ -137,7 +137,7 @@ return 0; } -int lvm_vg_close(vg_t *vg) +int lvm_vg_close(vg_t vg) { if (vg_read_error(vg) == FAILED_LOCKING) vg_release(vg); @@ -146,7 +146,7 @@ return 0; } -int lvm_vg_remove(vg_t *vg) +int lvm_vg_remove(vg_t vg) { if (vg_read_error(vg)) return -1; @@ -158,11 +158,11 @@ return 0; } -vg_t *lvm_vg_open(lvm_t libh, const char *vgname, const char *mode, +vg_t lvm_vg_open(lvm_t libh, const char *vgname, const char *mode, uint32_t flags) { uint32_t internal_flags = 0; - vg_t *vg; + struct volume_group *vg; if (!strncmp(mode, "w", 1)) internal_flags |= READ_FOR_UPDATE; @@ -180,10 +180,10 @@ /* FIXME: combine this with locking ? */ vg->open_mode = mode[0]; - return (vg_t *) vg; + return (vg_t) vg; } -struct dm_list *lvm_vg_list_pvs(vg_t *vg) +struct dm_list *lvm_vg_list_pvs(vg_t vg) { struct dm_list *list; pv_list_t *pvs; @@ -210,7 +210,7 @@ return list; } -struct dm_list *lvm_vg_list_lvs(vg_t *vg) +struct dm_list *lvm_vg_list_lvs(vg_t vg) { struct dm_list *list; lv_list_t *lvs; @@ -237,43 +237,43 @@ return list; } -uint64_t lvm_vg_get_seqno(const vg_t *vg) +uint64_t lvm_vg_get_seqno(const vg_t vg) { return vg_seqno(vg); } /* FIXME: invalid handle? return INTMAX? */ -uint64_t lvm_vg_get_size(const vg_t *vg) +uint64_t lvm_vg_get_size(const vg_t vg) { return vg_size(vg); } -uint64_t lvm_vg_get_free_size(const vg_t *vg) +uint64_t lvm_vg_get_free_size(const vg_t vg) { return vg_free(vg); } -uint64_t lvm_vg_get_extent_size(const vg_t *vg) +uint64_t lvm_vg_get_extent_size(const vg_t vg) { return vg_extent_size(vg); } -uint64_t lvm_vg_get_extent_count(const vg_t *vg) +uint64_t lvm_vg_get_extent_count(const vg_t vg) { return vg_extent_count(vg); } -uint64_t lvm_vg_get_free_extent_count(const vg_t *vg) +uint64_t lvm_vg_get_free_extent_count(const vg_t vg) { return vg_free_count(vg); } -uint64_t lvm_vg_get_pv_count(const vg_t *vg) +uint64_t lvm_vg_get_pv_count(const vg_t vg) { return vg_pv_count(vg); } -char *lvm_vg_get_uuid(const vg_t *vg) +char *lvm_vg_get_uuid(const vg_t vg) { char uuid[64] __attribute((aligned(8))); @@ -284,7 +284,7 @@ return strndup((const char *)uuid, 64); } -char *lvm_vg_get_name(const vg_t *vg) +char *lvm_vg_get_name(const vg_t vg) { char *name; --- LVM2/test/api/test.c 2009/08/07 21:22:37 1.25 +++ LVM2/test/api/test.c 2009/08/13 12:16:45 1.26 @@ -152,9 +152,9 @@ return lv; } -static vg_t *_lookup_vg_by_name(char **argv, int argc) +static vg_t _lookup_vg_by_name(char **argv, int argc) { - vg_t *vg; + vg_t vg; if (argc < 2) { printf ("Please enter vg_name\n"); @@ -203,7 +203,7 @@ } static void _vg_reduce(char **argv, int argc, lvm_t libh) { - vg_t *vg; + vg_t vg; struct dm_list *pvs; if (argc < 2) { @@ -264,7 +264,7 @@ static void _vg_extend(char **argv, int argc, lvm_t libh) { - vg_t *vg; + vg_t vg; struct dm_list *pvs; if (argc < 2) { @@ -293,7 +293,7 @@ static void _vg_open(char **argv, int argc, lvm_t libh) { - vg_t *vg; + vg_t vg; struct dm_list *lvs; struct dm_list *pvs; @@ -330,9 +330,9 @@ _add_pvs_to_pvname_hash(pvs); } /* Lookup the vg and remove it from the vgname and vgid hashes */ -static vg_t *_lookup_and_remove_vg(const char *vgname) +static vg_t _lookup_and_remove_vg(const char *vgname) { - vg_t *vg=NULL; + vg_t vg=NULL; if ((vg = dm_hash_lookup(_vgname_hash, vgname))) { dm_hash_remove(_vgid_hash, lvm_vg_get_uuid(vg)); @@ -347,7 +347,7 @@ static void _vg_write(char **argv, int argc) { - vg_t *vg; + vg_t vg; int rc = 0; if (argc < 2) { @@ -366,7 +366,7 @@ static void _vg_create(char **argv, int argc, lvm_t libh) { - vg_t *vg; + vg_t vg; if (argc < 2) { printf ("Please enter vg_name\n"); @@ -385,7 +385,7 @@ static void _vg_remove(char **argv, int argc) { - vg_t *vg; + vg_t vg; int rc = 0; if (argc < 2) { @@ -404,7 +404,7 @@ static void _vg_close(char **argv, int argc) { - vg_t *vg; + vg_t vg; int rc = 0; if (argc < 2) { @@ -421,7 +421,7 @@ printf("closing VG\n"); } -static void _show_one_vg(vg_t *vg) +static void _show_one_vg(vg_t vg) { printf("%s (%s): sz=%"PRIu64", free=%"PRIu64", #pv=%"PRIu64 ", seq#=%"PRIu64"\n", @@ -439,7 +439,7 @@ { struct dm_list *pvs; struct lvm_pv_list *pvl; - vg_t *vg; + vg_t vg; if (!(vg = _lookup_vg_by_name(argv, argc))) return; @@ -494,7 +494,7 @@ { struct dm_list *lvs; struct lvm_lv_list *lvl; - vg_t *vg; + vg_t vg; if (!(vg = _lookup_vg_by_name(argv, argc))) return; @@ -568,7 +568,7 @@ static void _vg_create_lv_linear(char **argv, int argc) { - vg_t *vg; + vg_t vg; lv_t *lv; if (argc < 4) { --- LVM2/test/api/vgtest.c 2009/07/29 14:06:31 1.9 +++ LVM2/test/api/vgtest.c 2009/08/13 12:16:45 1.10 @@ -24,7 +24,7 @@ #include "lvm2app.h" lvm_t handle; -vg_t *vg; +vg_t vg; const char *vg_name = "my_vg"; const char *device = "/dev/loop3"; const char *device2 = "/dev/loop4"; From wysochanski@sourceware.org Thu Aug 13 12:17:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 13 Aug 2009 12:17:00 -0000 Subject: LVM2 liblvm/lvm2app.h liblvm/lvm_lv.c test/api ... Message-ID: <20090813121732.6849.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-13 12:17:32 Modified files: liblvm : lvm2app.h lvm_lv.c test/api : test.c Log message: Make lvm2app lv_t handle definition consistent with lvm_t. This patch update lv_t handle to be consistent with lvm_t - define as a pointer to internal struct logical_volume. Author: Dave Wysochanski Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm2app.h.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_lv.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/test.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27 --- LVM2/liblvm/lvm2app.h 2009/08/13 12:16:45 1.4 +++ LVM2/liblvm/lvm2app.h 2009/08/13 12:17:32 1.5 @@ -121,7 +121,7 @@ * group. Changes will be written to disk when the volume group gets * committed to disk. */ -typedef struct logical_volume lv_t; +typedef struct logical_volume *lv_t; /** * Physical volume object. @@ -139,7 +139,7 @@ */ typedef struct lvm_lv_list { struct dm_list list; - lv_t *lv; + lv_t lv; } lv_list_t; /** @@ -623,7 +623,7 @@ * non-NULL handle to an LV object created, or NULL if creation fails. * */ -lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size); +lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size); /** * Activate a logical volume. @@ -639,7 +639,7 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_lv_activate(lv_t *lv); +int lvm_lv_activate(lv_t lv); /** * Deactivate a logical volume. @@ -652,7 +652,7 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_lv_deactivate(lv_t *lv); +int lvm_lv_deactivate(lv_t lv); /** * Remove a logical volume from a volume group. @@ -669,7 +669,7 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_vg_remove_lv(lv_t *lv); +int lvm_vg_remove_lv(lv_t lv); /** * Get the current name of a logical volume. @@ -683,7 +683,7 @@ * \return * Copy of the uuid string. */ -char *lvm_lv_get_uuid(const lv_t *lv); +char *lvm_lv_get_uuid(const lv_t lv); /** * Get the current uuid of a logical volume. @@ -697,7 +697,7 @@ * \return * Copy of the name. */ -char *lvm_lv_get_name(const lv_t *lv); +char *lvm_lv_get_name(const lv_t lv); /** * Get the current size in bytes of a logical volume. @@ -708,7 +708,7 @@ * \return * Size in bytes. */ -uint64_t lvm_lv_get_size(const lv_t *lv); +uint64_t lvm_lv_get_size(const lv_t lv); /** * Get the current activation state of a logical volume. @@ -719,7 +719,7 @@ * \return * 1 if the LV is active in the kernel, 0 if not */ -uint64_t lvm_lv_is_active(const lv_t *lv); +uint64_t lvm_lv_is_active(const lv_t lv); /** * Get the current suspended state of a logical volume. @@ -730,7 +730,7 @@ * \return * 1 if the LV is suspended in the kernel, 0 if not */ -uint64_t lvm_lv_is_suspended(const lv_t *lv); +uint64_t lvm_lv_is_suspended(const lv_t lv); /** * Resize logical volume to new_size bytes. @@ -747,7 +747,7 @@ * 0 (success) or -1 (failure). * */ -int lvm_lv_resize(const lv_t *lv, uint64_t new_size); +int lvm_lv_resize(const lv_t lv, uint64_t new_size); /************************** physical volume handling ************************/ --- LVM2/liblvm/lvm_lv.c 2009/08/13 12:16:45 1.15 +++ LVM2/liblvm/lvm_lv.c 2009/08/13 12:17:32 1.16 @@ -24,12 +24,12 @@ #include /* FIXME: have lib/report/report.c _disp function call lv_size()? */ -uint64_t lvm_lv_get_size(const lv_t *lv) +uint64_t lvm_lv_get_size(const lv_t lv) { return lv_size(lv); } -char *lvm_lv_get_uuid(const lv_t *lv) +char *lvm_lv_get_uuid(const lv_t lv) { char uuid[64] __attribute((aligned(8))); @@ -40,7 +40,7 @@ return strndup((const char *)uuid, 64); } -char *lvm_lv_get_name(const lv_t *lv) +char *lvm_lv_get_name(const lv_t lv) { char *name; @@ -50,7 +50,7 @@ return name; } -uint64_t lvm_lv_is_active(const lv_t *lv) +uint64_t lvm_lv_is_active(const lv_t lv) { struct lvinfo info; if (lv_info(lv->vg->cmd, lv, &info, 1, 0) && @@ -59,7 +59,7 @@ return 0; } -uint64_t lvm_lv_is_suspended(const lv_t *lv) +uint64_t lvm_lv_is_suspended(const lv_t lv) { struct lvinfo info; if (lv_info(lv->vg->cmd, lv, &info, 1, 0) && @@ -101,7 +101,7 @@ * lvm_vg_write. However, this appears to be non-trivial change until * lv_create_single is refactored by segtype. */ -lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size) +lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size) { struct lvcreate_params lp; uint64_t extents; @@ -120,14 +120,14 @@ lvl = find_lv_in_vg(vg, name); if (!lvl) return NULL; - return (lv_t *) lvl->lv; + return (lv_t) lvl->lv; } /* * FIXME: This function should probably not commit to disk but require calling * lvm_vg_write. */ -int lvm_vg_remove_lv(lv_t *lv) +int lvm_vg_remove_lv(lv_t lv) { if (!lv || !lv->vg || vg_read_error(lv->vg)) return -1; @@ -138,7 +138,7 @@ return 0; } -int lvm_lv_activate(lv_t *lv) +int lvm_lv_activate(lv_t lv) { if (!lv || !lv->vg || vg_read_error(lv->vg) || !lv->vg->cmd) return -1; @@ -173,7 +173,7 @@ return 0; } -int lvm_lv_deactivate(lv_t *lv) +int lvm_lv_deactivate(lv_t lv) { if (!lv || !lv->vg || vg_read_error(lv->vg) || !lv->vg->cmd) return -1; @@ -186,7 +186,7 @@ return 0; } -int lvm_lv_resize(const lv_t *lv, uint64_t new_size) +int lvm_lv_resize(const lv_t lv, uint64_t new_size) { /* FIXME: add lv resize code here */ log_error("NOT IMPLEMENTED YET"); --- LVM2/test/api/test.c 2009/08/13 12:16:45 1.26 +++ LVM2/test/api/test.c 2009/08/13 12:17:32 1.27 @@ -136,9 +136,9 @@ } /* FIXME: this should be per vg */ -static lv_t *_lookup_lv_by_name(const char *name) +static lv_t _lookup_lv_by_name(const char *name) { - lv_t *lv; + lv_t lv; if (!name) { printf ("Invalid LV name\n"); @@ -516,7 +516,7 @@ static void _lv_deactivate(char **argv, int argc) { - lv_t *lv; + lv_t lv; int rc=0; if (argc < 3) { @@ -532,7 +532,7 @@ } static void _lv_activate(char **argv, int argc) { - lv_t *lv; + lv_t lv; int rc=0; if (argc < 3) { @@ -548,7 +548,7 @@ } static void _vg_remove_lv(char **argv, int argc) { - lv_t *lv; + lv_t lv; if (argc < 3) { printf("Please enter vgname, lvname\n"); @@ -569,7 +569,7 @@ static void _vg_create_lv_linear(char **argv, int argc) { vg_t vg; - lv_t *lv; + lv_t lv; if (argc < 4) { printf("Please enter vgname, lvname, and size\n"); From wysochanski@sourceware.org Thu Aug 13 12:18:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 13 Aug 2009 12:18:00 -0000 Subject: LVM2/liblvm lvm2app.h lvm_pv.c Message-ID: <20090813121815.8191.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-13 12:18:15 Modified files: liblvm : lvm2app.h lvm_pv.c Log message: Make lvm2app pv_t handle definition consistent with lvm_t. This patch update pv_t handle to be consistent with lvm_t - define as a pointer to internal struct physical_volume. Author: Dave Wysochanski Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm2app.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_pv.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7 --- LVM2/liblvm/lvm2app.h 2009/08/13 12:17:32 1.5 +++ LVM2/liblvm/lvm2app.h 2009/08/13 12:18:15 1.6 @@ -130,7 +130,7 @@ * group. Changes will be written to disk when the volume group gets * committed to disk. */ -typedef struct physical_volume pv_t; +typedef struct physical_volume *pv_t; /** * Logical Volume object list. @@ -149,7 +149,7 @@ */ typedef struct lvm_pv_list { struct dm_list list; - pv_t *pv; + pv_t pv; } pv_list_t; /** @@ -781,7 +781,7 @@ * \return * Copy of the uuid string. */ -char *lvm_pv_get_uuid(const pv_t *pv); +char *lvm_pv_get_uuid(const pv_t pv); /** * Get the current name of a logical volume. @@ -795,7 +795,7 @@ * \return * Copy of the name. */ -char *lvm_pv_get_name(const pv_t *pv); +char *lvm_pv_get_name(const pv_t pv); /** * Get the current number of metadata areas in the physical volume. @@ -806,7 +806,7 @@ * \return * Number of metadata areas in the PV. */ -uint64_t lvm_pv_get_mda_count(const pv_t *pv); +uint64_t lvm_pv_get_mda_count(const pv_t pv); /** * Resize physical volume to new_size bytes. @@ -822,6 +822,6 @@ * \return * 0 (success) or -1 (failure). */ -int lvm_pv_resize(const pv_t *pv, uint64_t new_size); +int lvm_pv_resize(const pv_t pv, uint64_t new_size); #endif /* _LIB_LVM2APP_H */ --- LVM2/liblvm/lvm_pv.c 2009/07/29 13:26:01 1.6 +++ LVM2/liblvm/lvm_pv.c 2009/08/13 12:18:15 1.7 @@ -17,7 +17,7 @@ #include "metadata-exported.h" #include "lvm-string.h" -char *lvm_pv_get_uuid(const pv_t *pv) +char *lvm_pv_get_uuid(const pv_t pv) { char uuid[64] __attribute((aligned(8))); @@ -28,7 +28,7 @@ return strndup((const char *)uuid, 64); } -char *lvm_pv_get_name(const pv_t *pv) +char *lvm_pv_get_name(const pv_t pv) { char *name; @@ -38,12 +38,12 @@ return name; } -uint64_t lvm_pv_get_mda_count(const pv_t *pv) +uint64_t lvm_pv_get_mda_count(const pv_t pv) { return (uint64_t) pv_mda_count(pv); } -int lvm_pv_resize(const pv_t *pv, uint64_t new_size) +int lvm_pv_resize(const pv_t pv, uint64_t new_size) { /* FIXME: add pv resize code here */ log_error("NOT IMPLEMENTED YET"); From wysochanski@sourceware.org Thu Aug 13 12:19:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 13 Aug 2009 12:19:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20090813121930.10054.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-13 12:19:30 Modified files: . : WHATS_NEW Log message: Update WHATS_NEW Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1236&r2=1.1237 --- LVM2/WHATS_NEW 2009/08/13 12:04:01 1.1236 +++ LVM2/WHATS_NEW 2009/08/13 12:19:30 1.1237 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Make lvm2app pv_t, lv_t, vg_t handle definitions consistent with lvm_t. Fix vgextend error path - if ORPHAN lock fails, unlock / release vg (2.02.49). Fix compile warning in clvmd. Update lv{convert|create|extend|resize} man pages - clarify use of PE ranges. From mornfall@sourceware.org Thu Aug 13 13:23:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 13 Aug 2009 13:23:00 -0000 Subject: LVM2 ./WHATS_NEW lib/locking/file_locking.c Message-ID: <20090813132352.4800.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-08-13 13:23:52 Modified files: . : WHATS_NEW lib/locking : file_locking.c Log message: Refactor file locking, lifting the flock wrapper code into separate functions. Also fixes a bug, where a nonblocking lock could, in certain race situations, succeed without actually obtaining the lock. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1237&r2=1.1238 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42 --- LVM2/WHATS_NEW 2009/08/13 12:19:30 1.1237 +++ LVM2/WHATS_NEW 2009/08/13 13:23:51 1.1238 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Fix bug where non-blocking file locks could be granted in error. Make lvm2app pv_t, lv_t, vg_t handle definitions consistent with lvm_t. Fix vgextend error path - if ORPHAN lock fails, unlock / release vg (2.02.49). Fix compile warning in clvmd. --- LVM2/lib/locking/file_locking.c 2008/11/12 09:30:52 1.41 +++ LVM2/lib/locking/file_locking.c 2009/08/13 13:23:52 1.42 @@ -43,13 +43,26 @@ static sigset_t _fullsigset, _intsigset; static volatile sig_atomic_t _handler_installed; +static void _undo_flock(const char *file, int fd) +{ + struct stat buf1, buf2; + + if (!flock(fd, LOCK_NB | LOCK_EX) && + !stat(file, &buf1) && + !fstat(fd, &buf2) && + is_same_inode(buf1, buf2)) + if (unlink(file)) + log_sys_error("unlink", file); + + if (close(fd) < 0) + log_sys_error("close", file); +} + static int _release_lock(const char *file, int unlock) { struct lock_list *ll; struct dm_list *llh, *llt; - struct stat buf1, buf2; - dm_list_iterate_safe(llh, llt, &_lock_list) { ll = dm_list_item(llh, struct lock_list); @@ -61,15 +74,7 @@ log_sys_error("flock", ll->res); } - if (!flock(ll->lf, LOCK_NB | LOCK_EX) && - !stat(ll->res, &buf1) && - !fstat(ll->lf, &buf2) && - is_same_inode(buf1, buf2)) - if (unlink(ll->res)) - log_sys_error("unlink", ll->res); - - if (close(ll->lf) < 0) - log_sys_error("close", ll->res); + _undo_flock(ll->res, ll->lf); dm_free(ll->res); dm_free(llh); @@ -124,14 +129,53 @@ siginterrupt(SIGINT, 1); } -static int _lock_file(const char *file, uint32_t flags) +static int _do_flock(const char *file, int *fd, int operation, uint32_t nonblock) { - int operation; int r = 1; int old_errno; + struct stat buf1, buf2; + + do { + if ((*fd > -1) && close(*fd)) + log_sys_error("close", file); + + if ((*fd = open(file, O_CREAT | O_APPEND | O_RDWR, 0777)) < 0) { + log_sys_error("open", file); + return 0; + } + + if (nonblock) + operation |= LOCK_NB; + else + _install_ctrl_c_handler(); + + r = flock(*fd, operation); + old_errno = errno; + if (!nonblock) + _remove_ctrl_c_handler(); + + if (r) { + errno = old_errno; + log_sys_error("flock", file); + close(*fd); + return 0; + } + + if (!stat(file, &buf1) && !fstat(*fd, &buf2) && + is_same_inode(buf1, buf2)) + return 1; + } while (!nonblock); + + return_0; +} + +static int _lock_file(const char *file, uint32_t flags) +{ + int operation; + uint32_t nonblock = flags & LCK_NONBLOCK; + int r; struct lock_list *ll; - struct stat buf1, buf2; char state; switch (flags & LCK_TYPE_MASK) { @@ -151,56 +195,28 @@ } if (!(ll = dm_malloc(sizeof(struct lock_list)))) - return 0; + return_0; if (!(ll->res = dm_strdup(file))) { dm_free(ll); - return 0; + return_0; } ll->lf = -1; log_very_verbose("Locking %s %c%c", ll->res, state, - flags & LCK_NONBLOCK ? ' ' : 'B'); - do { - if ((ll->lf > -1) && close(ll->lf)) - log_sys_error("close", file); - - if ((ll->lf = open(file, O_CREAT | O_APPEND | O_RDWR, 0777)) - < 0) { - log_sys_error("open", file); - goto err; - } + nonblock ? ' ' : 'B'); - if ((flags & LCK_NONBLOCK)) - operation |= LOCK_NB; - else - _install_ctrl_c_handler(); - - r = flock(ll->lf, operation); - old_errno = errno; - if (!(flags & LCK_NONBLOCK)) - _remove_ctrl_c_handler(); - - if (r) { - errno = old_errno; - log_sys_error("flock", ll->res); - close(ll->lf); - goto err; - } - - if (!stat(ll->res, &buf1) && !fstat(ll->lf, &buf2) && - is_same_inode(buf1, buf2)) - break; - } while (!(flags & LCK_NONBLOCK)); - - dm_list_add(&_lock_list, &ll->list); - return 1; + r = _do_flock(file, &ll->lf, operation, nonblock); + if (r) + dm_list_add(&_lock_list, &ll->list); + else { + dm_free(ll->res); + dm_free(ll); + stack; + } - err: - dm_free(ll->res); - dm_free(ll); - return 0; + return r; } static int _file_lock_resource(struct cmd_context *cmd, const char *resource, From mornfall@sourceware.org Thu Aug 13 14:27:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Thu, 13 Aug 2009 14:27:00 -0000 Subject: LVM2 ./WHATS_NEW tools/lvchange.c Message-ID: <20090813142733.24308.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-08-13 14:27:33 Modified files: . : WHATS_NEW tools : lvchange.c Log message: Make lvchange --refresh only take a read lock on volume group. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1238&r2=1.1239 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.108&r2=1.109 --- LVM2/WHATS_NEW 2009/08/13 13:23:51 1.1238 +++ LVM2/WHATS_NEW 2009/08/13 14:27:32 1.1239 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Make lvchange --refresh only take a read lock on volume group. Fix bug where non-blocking file locks could be granted in error. Make lvm2app pv_t, lv_t, vg_t handle definitions consistent with lvm_t. Fix vgextend error path - if ORPHAN lock fails, unlock / release vg (2.02.49). --- LVM2/tools/lvchange.c 2009/07/15 05:49:48 1.108 +++ LVM2/tools/lvchange.c 2009/08/13 14:27:33 1.109 @@ -690,12 +690,11 @@ return EINVALID_CMD_LINE; } - int avail_only = + int avail_only = /* i.e. only one of -a or --refresh is given */ !(arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) || arg_count(cmd, readahead_ARG) || arg_count(cmd, persistent_ARG) || arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG) || - arg_count(cmd, refresh_ARG) || arg_count(cmd, alloc_ARG) || - arg_count(cmd, resync_ARG)); + arg_count(cmd, resync_ARG) || arg_count(cmd, alloc_ARG)); if (arg_count(cmd, ignorelockingfailure_ARG) && !avail_only) { log_error("Only -a permitted with --ignorelockingfailure"); From jbrassow@sourceware.org Thu Aug 13 16:31:00 2009 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 13 Aug 2009 16:31:00 -0000 Subject: LVM2 daemons/clogd/functions.c include/.symlin ... Message-ID: <20090813163103.30196.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2009-08-13 16:31:02 Modified files: daemons/clogd : functions.c include : .symlinks libdm : libdm-deptree.c Log message: Cluster log daemon (clogd): use LVM bitops in place of ext2 bitops Eliminate dependency on outside library, since the same functionality exists in our tree. [It is important that the bitops work in the same way, as the bitmaps must remain backwards compatible. I haven't tested every architecture, but the x86* archs work. My test involved using the old ext2fsprogs bitops, memcpy'ing the bits over to the LVM bitset array and ensuring that only the bits set via the old methods were set.] Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/functions.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/include/.symlinks.diff?cvsroot=lvm2&r1=1.59&r2=1.60 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56 --- LVM2/daemons/clogd/functions.c 2009/07/28 21:14:12 1.6 +++ LVM2/daemons/clogd/functions.c 2009/08/13 16:31:01 1.7 @@ -6,13 +6,12 @@ #include #include #include -#include -#include #include #define __USE_GNU /* for O_DIRECT */ #include #include -#include "linux/dm-log-userspace.h" +#include "libdevmapper.h" +#include "dm-log-userspace.h" #include "functions.h" #include "common.h" #include "cluster.h" @@ -57,8 +56,8 @@ uint64_t sync_count; uint32_t bitset_uint32_count; - uint32_t *clean_bits; - uint32_t *sync_bits; + dm_bitset_t clean_bits; + dm_bitset_t sync_bits; uint32_t recoverer; uint64_t recovering_region; /* -1 means not recovering */ uint64_t skip_bit_warning; /* used to warn if region skipped */ @@ -103,43 +102,41 @@ static DM_LIST_INIT(log_list); static DM_LIST_INIT(log_pending_list); -static int log_test_bit(uint32_t *bs, unsigned bit) +static int log_test_bit(dm_bitset_t bs, int bit) { - return ext2fs_test_bit(bit, (unsigned int *) bs) ? 1 : 0; + return dm_bit(bs, i); } -static void log_set_bit(struct log_c *lc, uint32_t *bs, unsigned bit) +static void log_set_bit(struct log_c *lc, dm_bitset_t bs, int bit) { - ext2fs_set_bit(bit, (unsigned int *) bs); + dm_bit_set(bs, i); lc->touched = 1; } -static void log_clear_bit(struct log_c *lc, uint32_t *bs, unsigned bit) +static void log_clear_bit(struct log_c *lc, dm_bitset_t bs, int bit) { - ext2fs_clear_bit(bit, (unsigned int *) bs); + dm_bit_clear(bs, i); lc->touched = 1; } -/* FIXME: Why aren't count and start the same type? */ -static uint64_t find_next_zero_bit(uint32_t *bits, uint32_t count, int start) +static int find_next_zero_bit(dm_bitset_t bs, int start) { - for(; (start < count) && log_test_bit(bits, start); start++); - return start; + while (dm_bit(bs, start++)) + if (start >= (int)bs[0]) + return -1; + + return start - 1; } -static uint64_t count_bits32(uint32_t *addr, uint32_t count) +static uint64_t count_bits32(dm_bitset_t bs) { - int j; - uint32_t i; - uint64_t rtn = 0; + int i, size = ((int)bs[0]/DM_BITS_PER_INT + 1); + unsigned count = 0; - for (i = 0; i < count; i++) { - if (!addr[i]) - continue; - for (j = 0; j < 32; j++) - rtn += (addr[i] & (1< #include +#include #define MAX_TARGET_PARAMSIZE 500000 @@ -1278,65 +1279,144 @@ return 1; } -static int _emit_segment_line(struct dm_task *dmt, uint32_t major, - uint32_t minor, struct load_segment *seg, - uint64_t *seg_start, char *params, - size_t paramsize) +static int mirror_emit_segment_line(struct dm_task *dmt, uint32_t major, + uint32_t minor, struct load_segment *seg, + uint64_t *seg_start, char *params, + size_t paramsize) { + int r; + int block_on_error = 0; + int handle_errors = 0; + int dm_log_userspace = 0; + struct utsname uts; unsigned log_parm_count; int pos = 0; - int r; - char originbuf[DM_FORMAT_DEV_BUFSIZE], cowbuf[DM_FORMAT_DEV_BUFSIZE]; char logbuf[DM_FORMAT_DEV_BUFSIZE]; const char *logtype; - switch(seg->type) { - case SEG_ERROR: - case SEG_ZERO: - case SEG_LINEAR: - break; - case SEG_MIRRORED: - log_parm_count = 1; /* Region size */ - log_parm_count += hweight32(seg->flags); /* [no]sync, block_on_error etc. */ + r = uname(&uts); + if (r) + return_0; + + if ((seg->flags & DM_BLOCK_ON_ERROR)) { + /* + * Originally, block_on_error was an argument to the log + * portion of the mirror CTR table. It was renamed to + * "handle_errors" and now resides in the 'features' + * section of the mirror CTR table (i.e. at the end). + * + * We can identify whether to use "block_on_error" or + * "handle_errors" by the dm-mirror module's version + * number (>= 1.12) or by the kernel version (>= 2.6.22). + */ + if (strncmp(uts.release, "2.6.22", 6) >= 0) + handle_errors = 1; + else + block_on_error = 1; + } + + if (seg->clustered) { + /* Cluster mirrors require a UUID */ + if (!seg->uuid) + return_0; + + /* + * Cluster mirrors used to have their own log + * types. Now they are accessed through the + * userspace log type. + * + * The dm-log-userspace module was added to the + * 2.6.31 kernel. + */ + if (strncmp(uts.release, "2.6.31", 6) >= 0) + dm_log_userspace = 1; + } + + /* Region size */ + log_parm_count = 1; + + /* [no]sync, block_on_error etc. */ + log_parm_count += hweight32(seg->flags); + + /* "handle_errors" is a feature arg now */ + if (handle_errors) + log_parm_count--; + + /* DM_CORELOG does not count in the param list */ + if (seg->flags & DM_CORELOG) + log_parm_count--; - if (seg->flags & DM_CORELOG) - log_parm_count--; /* DM_CORELOG does not count in the param list */ + if (seg->clustered) { + log_parm_count++; /* For UUID */ - if (seg->clustered) { - if (seg->uuid) - log_parm_count++; + if (!dm_log_userspace) EMIT_PARAMS(pos, "clustered-"); - } + } - if (!seg->log) - logtype = "core"; - else { - logtype = "disk"; - log_parm_count++; - if (!_build_dev_string(logbuf, sizeof(logbuf), seg->log)) - return_0; - } + if (!seg->log) + logtype = "core"; + else { + logtype = "disk"; + log_parm_count++; + if (!_build_dev_string(logbuf, sizeof(logbuf), seg->log)) + return_0; + } + if (dm_log_userspace) + EMIT_PARAMS(pos, "userspace %u %s clustered-%s", + log_parm_count, seg->uuid, logtype); + else EMIT_PARAMS(pos, "%s %u", logtype, log_parm_count); - if (seg->log) - EMIT_PARAMS(pos, " %s", logbuf); + if (seg->log) + EMIT_PARAMS(pos, " %s", logbuf); - EMIT_PARAMS(pos, " %u", seg->region_size); + EMIT_PARAMS(pos, " %u", seg->region_size); - if (seg->clustered && seg->uuid) - EMIT_PARAMS(pos, " %s", seg->uuid); + if (seg->clustered && !dm_log_userspace) + EMIT_PARAMS(pos, " %s", seg->uuid); - if ((seg->flags & DM_NOSYNC)) - EMIT_PARAMS(pos, " nosync"); - else if ((seg->flags & DM_FORCESYNC)) - EMIT_PARAMS(pos, " sync"); + if ((seg->flags & DM_NOSYNC)) + EMIT_PARAMS(pos, " nosync"); + else if ((seg->flags & DM_FORCESYNC)) + EMIT_PARAMS(pos, " sync"); - if ((seg->flags & DM_BLOCK_ON_ERROR)) - EMIT_PARAMS(pos, " block_on_error"); + if (block_on_error) + EMIT_PARAMS(pos, " block_on_error"); - EMIT_PARAMS(pos, " %u ", seg->mirror_area_count); + EMIT_PARAMS(pos, " %u ", seg->mirror_area_count); + if ((r = _emit_areas_line(dmt, seg, params, paramsize, &pos)) <= 0) { + stack; + return r; + } + + if (handle_errors) + EMIT_PARAMS(pos, " 1 handle_errors"); + + return 0; +} + +static int _emit_segment_line(struct dm_task *dmt, uint32_t major, + uint32_t minor, struct load_segment *seg, + uint64_t *seg_start, char *params, + size_t paramsize) +{ + int pos = 0; + int r; + char originbuf[DM_FORMAT_DEV_BUFSIZE], cowbuf[DM_FORMAT_DEV_BUFSIZE]; + + switch(seg->type) { + case SEG_ERROR: + case SEG_ZERO: + case SEG_LINEAR: + break; + case SEG_MIRRORED: + /* Mirrors are pretty complicated - now in separate function */ + r = mirror_emit_segment_line(dmt, major, minor, seg, seg_start, + params, paramsize); + if (r) + return r; break; case SEG_SNAPSHOT: if (!_build_dev_string(originbuf, sizeof(originbuf), seg->origin)) @@ -1371,7 +1451,6 @@ break; case SEG_CRYPT: case SEG_LINEAR: - case SEG_MIRRORED: case SEG_STRIPED: if ((r = _emit_areas_line(dmt, seg, params, paramsize, &pos)) <= 0) { stack; From jbrassow@sourceware.org Thu Aug 13 16:34:00 2009 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 13 Aug 2009 16:34:00 -0000 Subject: LVM2 ./Makefile.in ./configure.in daemons/Make ... Message-ID: <20090813163409.21880.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2009-08-13 16:34:07 Modified files: . : Makefile.in configure.in daemons : Makefile.in daemons/clogd : clogd.c cluster.c cluster.h common.h functions.c functions.h link_mon.c link_mon.h local.c local.h logging.c logging.h Log message: cluster log daemon (clogd): Add to LVM build system This check-in includes the touch-ups, make file changes, copyrights, and other necessities to include the cluster log daemon into the build system. [autoconf still needs to be run to generate the 'configure' and 'Makefile' files.] Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/Makefile.in.diff?cvsroot=lvm2&r1=1.34&r2=1.35 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.105&r2=1.106 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/Makefile.in.diff?cvsroot=lvm2&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/clogd.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/cluster.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/cluster.h.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/common.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/functions.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/functions.h.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/link_mon.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/link_mon.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/local.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/local.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/logging.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/logging.h.diff?cvsroot=lvm2&r1=1.3&r2=1.4 --- LVM2/Makefile.in 2009/07/31 11:49:53 1.34 +++ LVM2/Makefile.in 2009/08/13 16:34:07 1.35 @@ -34,6 +34,7 @@ ifeq ($(MAKECMDGOALS),distclean) SUBDIRS += daemons/clvmd \ + daemons/clogd \ daemons/dmeventd/plugins \ daemons/dmeventd \ lib/format1 \ --- LVM2/configure.in 2009/07/31 13:31:53 1.105 +++ LVM2/configure.in 2009/08/13 16:34:07 1.106 @@ -63,7 +63,7 @@ ################################################################################ dnl -- Checks for programs. -AC_PROG_SED +m4_pattern_allow(AC_PROG_SED) AC_PROG_AWK AC_PROG_CC @@ -72,7 +72,7 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET -AC_PROG_MKDIR_P +m4_pattern_allow(AC_PROG_MKDIR_P) AC_PROG_RANLIB AC_PATH_PROG(CFLOW_CMD, cflow) AC_PATH_PROG(CSCOPE_CMD, cscope) @@ -353,6 +353,23 @@ fi ################################################################################ +dnl -- Build cluster log daemon +AC_MSG_CHECKING(whether to build cluster log daemon) +AC_ARG_ENABLE(clogd, [ --enable-clogd Enable the cluster log daemon], +CLOGD=$enableval) +AC_MSG_RESULT($CLOGD) + +dnl -- Look for corosync libraries if required. +if [[ "x$CLOGD" = xall -o `expr x"$CLOGD" : '.*corosync.*'` != 0 ]]; then +# +# FIXME: ALSO NEED TO CHECK FOR CHECKPOINT MODULE +# + PKG_CHECK_MODULES(CPG, libcpg, [], + [AC_MSG_RESULT([no pkg for libcpg library, using -lcpg]); + CPG_LIBS="-lcpg"]) +fi + +################################################################################ dnl -- Enable debugging AC_MSG_CHECKING(whether to enable debugging) AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging], @@ -801,6 +818,7 @@ AC_SUBST(CLDWHOLEARCHIVE) AC_SUBST(CLUSTER) AC_SUBST(CLVMD) +AC_SUBST(CLOGD) AC_SUBST(CMDLIB) AC_SUBST(CONFDB_CFLAGS) AC_SUBST(CONFDB_LIBS) @@ -870,6 +888,7 @@ make.tmpl daemons/Makefile daemons/clvmd/Makefile +daemons/clogd/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile --- LVM2/daemons/Makefile.in 2008/11/04 16:41:47 1.7 +++ LVM2/daemons/Makefile.in 2009/08/13 16:34:07 1.8 @@ -21,6 +21,10 @@ SUBDIRS = clvmd endif +ifeq ("@CLOGD@", "yes") + SUBDIRS += clogd +endif + ifeq ("@DMEVENTD@", "yes") SUBDIRS += dmeventd endif --- LVM2/daemons/clogd/clogd.c 2009/07/21 15:34:53 1.3 +++ LVM2/daemons/clogd/clogd.c 2009/08/13 16:34:07 1.4 @@ -1,3 +1,14 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU General Public License v.2. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include #include #include @@ -13,9 +24,9 @@ #include #include #include -#include #include +#include "dm-log-userspace.h" #include "functions.h" #include "local.h" #include "cluster.h" --- LVM2/daemons/clogd/cluster.c 2009/07/28 21:14:12 1.7 +++ LVM2/daemons/clogd/cluster.c 2009/08/13 16:34:07 1.8 @@ -1,3 +1,14 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include #include #include @@ -14,8 +25,8 @@ #include #include -#include "linux/dm-log-userspace.h" -#include +#include "dm-log-userspace.h" +#include "libdevmapper.h" #include "functions.h" #include "local.h" #include "common.h" @@ -133,7 +144,7 @@ int count=0; int found; struct iovec iov; - struct clog_cpg *entry, *tmp; + struct clog_cpg *entry; dm_list_iterate_items(entry, &clog_cpg_list) if (!strncmp(entry->name.value, rq->u_rq.uuid, @@ -263,7 +274,7 @@ struct clog_request *rq) { int r = 0; - struct clog_request *orig_rq, *n; + struct clog_request *orig_rq; /* * If I didn't send it, then I don't care about the response @@ -317,7 +328,7 @@ static struct clog_cpg *find_clog_cpg(cpg_handle_t handle) { - struct clog_cpg *match, *tmp; + struct clog_cpg *match; dm_list_iterate_items(match, &clog_cpg_list) if (match->handle == handle) @@ -852,7 +863,7 @@ static int do_cluster_work(void *data) { int r = SA_AIS_OK; - struct clog_cpg *entry, *tmp; + struct clog_cpg *entry; dm_list_iterate_items(entry, &clog_cpg_list) { r = cpg_dispatch(entry->handle, CPG_DISPATCH_ALL); @@ -930,7 +941,7 @@ int i_am_server; int response = 0; struct clog_request *rq = msg; - struct clog_request *tmp_rq, *n; + struct clog_request *tmp_rq; struct clog_cpg *match; match = find_clog_cpg(handle); @@ -1363,7 +1374,7 @@ struct cpg_address *joined_list, int joined_list_entries) { - struct clog_cpg *match, *tmp; + struct clog_cpg *match; int found = 0; dm_list_iterate_items(match, &clog_cpg_list) @@ -1448,7 +1459,7 @@ int r; int size; struct clog_cpg *new = NULL; - struct clog_cpg *tmp, *tmp2; + struct clog_cpg *tmp; dm_list_iterate_items(tmp, &clog_cpg_list) if (!strncmp(tmp->name.value, uuid, CPG_MAX_NAME_LENGTH)) { @@ -1603,8 +1614,8 @@ void cluster_debug(void) { struct checkpoint_data *cp; - struct clog_cpg *entry, *tmp; - struct clog_request *rq, *n; + struct clog_cpg *entry; + struct clog_request *rq; int i; LOG_ERROR(""); --- LVM2/daemons/clogd/cluster.h 2009/07/28 21:14:12 1.4 +++ LVM2/daemons/clogd/cluster.h 2009/08/13 16:34:07 1.5 @@ -1,8 +1,19 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef __CLUSTER_LOG_CLUSTER_DOT_H__ #define __CLUSTER_LOG_CLUSTER_DOT_H__ -#include -#include +#include "libdevmapper.h" +#include "dm-log-userspace.h" /* * There is other information in addition to what can --- LVM2/daemons/clogd/common.h 2009/07/21 15:34:53 1.2 +++ LVM2/daemons/clogd/common.h 2009/08/13 16:34:07 1.3 @@ -1,3 +1,14 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef __CLUSTER_LOG_COMMON_DOT_H__ #define __CLUSTER_LOG_COMMON_DOT_H__ --- LVM2/daemons/clogd/functions.c 2009/08/13 16:31:01 1.7 +++ LVM2/daemons/clogd/functions.c 2009/08/13 16:34:07 1.8 @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser 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 + */ +#define _GNU_SOURCE +#define _FILE_OFFSET_BITS 64 + #include #include #include @@ -7,7 +21,7 @@ #include #include #include -#define __USE_GNU /* for O_DIRECT */ +//#define __USE_GNU /* for O_DIRECT */ #include #include #include "libdevmapper.h" @@ -54,7 +68,6 @@ uint32_t region_size; uint32_t region_count; uint64_t sync_count; - uint32_t bitset_uint32_count; dm_bitset_t clean_bits; dm_bitset_t sync_bits; @@ -104,18 +117,18 @@ static int log_test_bit(dm_bitset_t bs, int bit) { - return dm_bit(bs, i); + return dm_bit(bs, bit); } static void log_set_bit(struct log_c *lc, dm_bitset_t bs, int bit) { - dm_bit_set(bs, i); + dm_bit_set(bs, bit); lc->touched = 1; } static void log_clear_bit(struct log_c *lc, dm_bitset_t bs, int bit) { - dm_bit_clear(bs, i); + dm_bit_clear(bs, bit); lc->touched = 1; } @@ -353,9 +366,8 @@ char *p; uint64_t region_size; uint64_t region_count; - uint32_t bitset_size; struct log_c *lc = NULL; - struct log_c *dup; + struct log_c *duplicate; enum sync sync = DEFAULTSYNC; uint32_t block_on_error = 0; @@ -438,8 +450,8 @@ strncpy(lc->uuid, uuid, DM_UUID_LEN); lc->luid = luid; - if ((dup = get_log(lc->uuid, lc->luid)) || - (dup = get_pending_log(lc->uuid, lc->luid))) { + if ((duplicate = get_log(lc->uuid, lc->luid)) || + (duplicate = get_pending_log(lc->uuid, lc->luid))) { LOG_ERROR("[%s/%llu] Log already exists, unable to create.", SHORT_UUID(lc->uuid), lc->luid); free(lc); @@ -448,33 +460,27 @@ dm_list_init(&lc->mark_list); - lc->bitset_uint32_count = region_count / - (sizeof(*lc->clean_bits) << BYTE_SHIFT); - if (region_count % (sizeof(*lc->clean_bits) << BYTE_SHIFT)) - lc->bitset_uint32_count++; - - bitset_size = lc->bitset_uint32_count * sizeof(*lc->clean_bits); - - lc->clean_bits = malloc(bitset_size); + lc->clean_bits = dm_bitset_create(NULL, region_count); if (!lc->clean_bits) { LOG_ERROR("Unable to allocate clean bitset"); r = -ENOMEM; goto fail; } - memset(lc->clean_bits, -1, bitset_size); - lc->sync_bits = malloc(bitset_size); + lc->sync_bits = dm_bitset_create(NULL, region_count); if (!lc->sync_bits) { LOG_ERROR("Unable to allocate sync bitset"); r = -ENOMEM; goto fail; } - memset(lc->sync_bits, (sync == NOSYNC) ? -1 : 0, bitset_size); + if (sync == NOSYNC) + dm_bit_set_all(lc->sync_bits); + lc->sync_count = (sync == NOSYNC) ? region_count : 0; if (disk_log) { page_size = sysconf(_SC_PAGESIZE); - pages = bitset_size/page_size; - pages += bitset_size%page_size ? 1 : 0; + pages = ((int)lc->clean_bits[0])/page_size; + pages += ((int)lc->clean_bits[0])%page_size ? 1 : 0; pages += 1; /* for header */ r = open(disk_path, O_RDWR | O_DIRECT); @@ -709,7 +715,6 @@ uint32_t i; int commit_log = 0; struct log_c *lc = get_log(rq->uuid, rq->luid); - size_t size = lc->bitset_uint32_count * sizeof(uint32_t); if (!lc) return -EINVAL; @@ -792,7 +797,7 @@ log_clear_bit(lc, lc->clean_bits, i); /* copy clean across to sync */ - memcpy(lc->sync_bits, lc->clean_bits, size); + dm_bit_copy(lc->sync_bits, lc->clean_bits); if (commit_log && (lc->disk_fd >= 0)) { rq->error = write_log(lc); @@ -812,7 +817,7 @@ log_clear_bit(lc, lc->sync_bits, i); } - lc->sync_count = count_bits32(lc->sync_bits, lc->bitset_uint32_count); + lc->sync_count = count_bits32(lc->sync_bits); LOG_SPRINT(lc, "[%s] Initial sync_count = %llu", SHORT_UUID(lc->uuid), (unsigned long long)lc->sync_count); @@ -1218,7 +1223,6 @@ } pkg->r = find_next_zero_bit(lc->sync_bits, - lc->region_count, lc->sync_search); if (pkg->r >= lc->region_count) { @@ -1301,8 +1305,8 @@ (unsigned long long)pkg->region); } - if (lc->sync_count != count_bits32(lc->sync_bits, lc->bitset_uint32_count)) { - unsigned long long reset = count_bits32(lc->sync_bits, lc->bitset_uint32_count); + if (lc->sync_count != count_bits32(lc->sync_bits)) { + unsigned long long reset = count_bits32(lc->sync_bits); LOG_SPRINT(lc, "SET - SEQ#=%u, UUID=%s, nodeid = %u:: " "sync_count(%llu) != bitmap count(%llu)", @@ -1348,8 +1352,8 @@ rq->data_size = sizeof(*sync_count); - if (lc->sync_count != count_bits32(lc->sync_bits, lc->bitset_uint32_count)) { - unsigned long long reset = count_bits32(lc->sync_bits, lc->bitset_uint32_count); + if (lc->sync_count != count_bits32(lc->sync_bits)) { + unsigned long long reset = count_bits32(lc->sync_bits); LOG_SPRINT(lc, "get_sync_count - SEQ#=%u, UUID=%s, nodeid = %u:: " "sync_count(%llu) != bitmap count(%llu)", @@ -1689,11 +1693,16 @@ SHORT_UUID(lc->uuid), debug_who, (unsigned long long)lc->recovering_region, lc->recoverer, - (unsigned long long)count_bits32(lc->sync_bits, lc->bitset_uint32_count)); + (unsigned long long)count_bits32(lc->sync_bits)); return 64; } - bitset_size = lc->bitset_uint32_count * sizeof(*lc->clean_bits); + /* Size in 'int's */ + bitset_size = ((int)lc->clean_bits[0]/DM_BITS_PER_INT) + 1; + + /* Size in bytes */ + bitset_size *= 4; + *buf = malloc(bitset_size); if (!*buf) { @@ -1702,13 +1711,13 @@ } if (!strncmp(which, "sync_bits", 9)) { - memcpy(*buf, lc->sync_bits, bitset_size); + memcpy(*buf, lc->sync_bits + 1, bitset_size); LOG_DBG("[%s] storing sync_bits (sync_count = %llu):", SHORT_UUID(uuid), (unsigned long long) - count_bits32(lc->sync_bits, lc->bitset_uint32_count)); + count_bits32(lc->sync_bits)); print_bits(*buf, bitset_size, 0); } else if (!strncmp(which, "clean_bits", 9)) { - memcpy(*buf, lc->clean_bits, bitset_size); + memcpy(*buf, lc->clean_bits + 1, bitset_size); LOG_DBG("[%s] storing clean_bits:", SHORT_UUID(lc->uuid)); print_bits(*buf, bitset_size, 0); } @@ -1742,7 +1751,12 @@ return 0; } - bitset_size = lc->bitset_uint32_count * sizeof(*lc->clean_bits); + /* Size in 'int's */ + bitset_size = ((int)lc->clean_bits[0]/DM_BITS_PER_INT) + 1; + + /* Size in bytes */ + bitset_size *= 4; + if (bitset_size != size) { LOG_ERROR("pull_state(%s): bad bitset_size (%d vs %d)", which, size, bitset_size); @@ -1751,14 +1765,14 @@ if (!strncmp(which, "sync_bits", 9)) { lc->resume_override += 1; - memcpy(lc->sync_bits, buf, bitset_size); + memcpy(lc->sync_bits + 1, buf, bitset_size); LOG_DBG("[%s] loading sync_bits (sync_count = %llu):", SHORT_UUID(lc->uuid),(unsigned long long) - count_bits32(lc->sync_bits, lc->bitset_uint32_count)); + count_bits32(lc->sync_bits)); print_bits((char *)lc->sync_bits, bitset_size, 0); } else if (!strncmp(which, "clean_bits", 9)) { lc->resume_override += 2; - memcpy(lc->clean_bits, buf, bitset_size); + memcpy(lc->clean_bits + 1, buf, bitset_size); LOG_DBG("[%s] loading clean_bits:", SHORT_UUID(lc->uuid)); print_bits((char *)lc->clean_bits, bitset_size, 0); } @@ -1803,11 +1817,9 @@ dm_list_iterate_items(lc, &log_pending_list) { LOG_ERROR("%s", lc->uuid); LOG_ERROR("sync_bits:"); - print_bits((char *)lc->sync_bits, - lc->bitset_uint32_count * sizeof(*lc->sync_bits), 1); + print_bits((char *)lc->sync_bits, (int)lc->sync_bits[0], 1); LOG_ERROR("clean_bits:"); - print_bits((char *)lc->clean_bits, - lc->bitset_uint32_count * sizeof(*lc->clean_bits), 1); + print_bits((char *)lc->clean_bits, (int)lc->sync_bits[0], 1); } dm_list_iterate_items(lc, &log_list) { @@ -1818,14 +1830,12 @@ LOG_ERROR(" recovery_halted : %s", (lc->recovery_halted) ? "YES" : "NO"); LOG_ERROR("sync_bits:"); - print_bits((char *)lc->sync_bits, - lc->bitset_uint32_count * sizeof(*lc->sync_bits), 1); + print_bits((char *)lc->sync_bits, (int)lc->sync_bits[0], 1); LOG_ERROR("clean_bits:"); - print_bits((char *)lc->clean_bits, - lc->bitset_uint32_count * sizeof(*lc->clean_bits), 1); + print_bits((char *)lc->clean_bits, (int)lc->sync_bits[0], 1); LOG_ERROR("Validating %s::", SHORT_UUID(lc->uuid)); - r = find_next_zero_bit(lc->sync_bits, lc->region_count, 0); + r = find_next_zero_bit(lc->sync_bits, 0); LOG_ERROR(" lc->region_count = %llu", (unsigned long long)lc->region_count); LOG_ERROR(" lc->sync_count = %llu", --- LVM2/daemons/clogd/functions.h 2009/07/28 15:55:50 1.4 +++ LVM2/daemons/clogd/functions.h 2009/08/13 16:34:07 1.5 @@ -1,7 +1,18 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef __CLOG_FUNCTIONS_DOT_H__ #define __CLOG_FUNCTIONS_DOT_H__ -#include +#include "dm-log-userspace.h" #include "cluster.h" #define LOG_RESUMED 1 --- LVM2/daemons/clogd/link_mon.c 2009/01/08 17:12:33 1.1 +++ LVM2/daemons/clogd/link_mon.c 2009/08/13 16:34:07 1.2 @@ -1,3 +1,14 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include #include #include --- LVM2/daemons/clogd/link_mon.h 2009/01/08 17:12:33 1.1 +++ LVM2/daemons/clogd/link_mon.h 2009/08/13 16:34:07 1.2 @@ -1,3 +1,14 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef __LINK_MON_DOT_H__ #define __LINK_MON_DOT_H__ --- LVM2/daemons/clogd/local.c 2009/07/21 15:34:53 1.3 +++ LVM2/daemons/clogd/local.c 2009/08/13 16:34:07 1.4 @@ -1,3 +1,14 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include #include #include @@ -8,7 +19,7 @@ #include #include -#include "linux/dm-log-userspace.h" +#include "dm-log-userspace.h" #include "functions.h" #include "cluster.h" #include "common.h" @@ -16,6 +27,12 @@ #include "link_mon.h" #include "local.h" +#ifndef CN_IDX_DM +#warning Kernel should be at least 2.6.31 +#define CN_IDX_DM 0x7 /* Device Mapper */ +#define CN_VAL_DM_USERSPACE_LOG 0x1 +#endif + static int cn_fd; /* Connector (netlink) socket fd */ static char recv_buf[2048]; static char send_buf[2048]; --- LVM2/daemons/clogd/local.h 2009/07/21 15:34:53 1.2 +++ LVM2/daemons/clogd/local.h 2009/08/13 16:34:07 1.3 @@ -1,3 +1,14 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef __CLUSTER_LOG_LOCAL_DOT_H__ #define __CLUSTER_LOG_LOCAL_DOT_H__ --- LVM2/daemons/clogd/logging.c 2009/07/21 15:34:53 1.2 +++ LVM2/daemons/clogd/logging.c 2009/08/13 16:34:07 1.3 @@ -1,3 +1,14 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include #include --- LVM2/daemons/clogd/logging.h 2009/07/28 21:14:12 1.3 +++ LVM2/daemons/clogd/logging.h 2009/08/13 16:34:07 1.4 @@ -1,3 +1,15 @@ +/* + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef __CLUSTER_LOG_LOGGING_DOT_H__ #define __CLUSTER_LOG_LOGGING_DOT_H__ From jbrassow@sourceware.org Thu Aug 13 16:36:00 2009 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 13 Aug 2009 16:36:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20090813163651.8520.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2009-08-13 16:36:49 Modified files: . : WHATS_NEW Log message: update WHATS_NEW Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1239&r2=1.1240 --- LVM2/WHATS_NEW 2009/08/13 14:27:32 1.1239 +++ LVM2/WHATS_NEW 2009/08/13 16:36:49 1.1240 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Added configure --enable-clogd to conditionally build the cluster log daemon. Make lvchange --refresh only take a read lock on volume group. Fix bug where non-blocking file locks could be granted in error. Make lvm2app pv_t, lv_t, vg_t handle definitions consistent with lvm_t. From wysochanski@sourceware.org Thu Aug 13 17:16:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Thu, 13 Aug 2009 17:16:00 -0000 Subject: LVM2 ./WHATS_NEW tools/vgcfgrestore.c Message-ID: <20090813171641.14711.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-08-13 17:16:39 Modified files: . : WHATS_NEW tools : vgcfgrestore.c Log message: Fix error paths for vgcfgrestore when locking fails. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1240&r2=1.1241 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcfgrestore.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22 --- LVM2/WHATS_NEW 2009/08/13 16:36:49 1.1240 +++ LVM2/WHATS_NEW 2009/08/13 17:16:38 1.1241 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Fix vgcfgrestore error paths when locking fails (2.02.49). Added configure --enable-clogd to conditionally build the cluster log daemon. Make lvchange --refresh only take a read lock on volume group. Fix bug where non-blocking file locks could be granted in error. --- LVM2/tools/vgcfgrestore.c 2009/07/15 20:02:48 1.21 +++ LVM2/tools/vgcfgrestore.c 2009/08/13 17:16:39 1.22 @@ -45,12 +45,12 @@ if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) { log_error("Unable to lock volume group %s", vg_name); - unlock_vg(cmd, VG_ORPHANS); return ECMD_FAILED; } if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) { log_error("Unable to lock orphans"); + unlock_vg(cmd, vg_name); return ECMD_FAILED; } @@ -58,8 +58,8 @@ backup_restore_from_file(cmd, vg_name, arg_str_value(cmd, file_ARG, "")) : backup_restore(cmd, vg_name))) { - unlock_vg(cmd, vg_name); unlock_vg(cmd, VG_ORPHANS); + unlock_vg(cmd, vg_name); log_error("Restore failed."); return ECMD_FAILED; } From jbrassow@sourceware.org Thu Aug 13 19:36:00 2009 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 13 Aug 2009 19:36:00 -0000 Subject: LVM2 ./WHATS_NEW_DM lib/mirror/mirrored.c Message-ID: <20090813193605.11299.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2009-08-13 19:36:04 Modified files: . : WHATS_NEW_DM lib/mirror : mirrored.c Log message: mirror table generating code: Properly handle 'block_on_errors' and 'cluster' features The device-mapper mirror CTR table has been changing over time. This has now been corrected to handle the old and new methods for invoking the 'block_on_errors' and 'cluster' features. (The code that does this was accidentally committed in the previous check-in. This check-in finishes the job.) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.293&r2=1.294 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mirror/mirrored.c.diff?cvsroot=lvm2&r1=1.62&r2=1.63 --- LVM2/WHATS_NEW_DM 2009/08/06 19:32:26 1.293 +++ LVM2/WHATS_NEW_DM 2009/08/13 19:36:04 1.294 @@ -1,5 +1,6 @@ Version 1.02.37 - ================================= + Fix mirror table CTR code to handle 'block_on_error' and 'cluster' features Version 1.02.36 - 6th August 2009 ================================= --- LVM2/lib/mirror/mirrored.c 2009/07/09 11:29:00 1.62 +++ LVM2/lib/mirror/mirrored.c 2009/08/13 19:36:04 1.63 @@ -362,14 +362,22 @@ _mirrored_present = target_present(cmd, "mirror", 1); /* - * block_on_error available with mirror target >= 1.1 and <= 1.11 + * block_on_error available as "block_on_error" log + * argument with mirror target >= 1.1 and <= 1.11 * or with 1.0 in RHEL4U3 driver >= 4.5 + * + * block_on_error available as "handle_errors" mirror + * argument with mirror target >= 1.12. + * + * libdm-deptree.c is smart enough to handle the differences + * between block_on_error and handle_errors for all + * mirror target versions >= 1.1 */ /* FIXME Move this into libdevmapper */ if (target_version("mirror", &maj, &min, &patchlevel) && maj == 1 && - ((min >= 1 && min <= 11) || + ((min >= 1) || (min == 0 && driver_version(vsn, sizeof(vsn)) && sscanf(vsn, "%u.%u.%u", &maj2, &min2, &patchlevel2) == 3 && maj2 == 4 && min2 == 5 && patchlevel2 == 0))) /* RHEL4U3 */ From jbrassow@sourceware.org Thu Aug 13 20:23:00 2009 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 13 Aug 2009 20:23:00 -0000 Subject: LVM2 configure.in Message-ID: <20090813202302.30304.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2009-08-13 20:23:02 Modified files: . : configure.in Log message: configure script: A couple unwanted changes snuck in. Previously while messing around with 'configure.in' and autoconf, I changed a couple lines that I didn't want in the final check-in. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.106&r2=1.107 --- LVM2/configure.in 2009/08/13 16:34:07 1.106 +++ LVM2/configure.in 2009/08/13 20:23:01 1.107 @@ -63,7 +63,7 @@ ################################################################################ dnl -- Checks for programs. -m4_pattern_allow(AC_PROG_SED) +AC_PROG_SED AC_PROG_AWK AC_PROG_CC @@ -72,7 +72,7 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET -m4_pattern_allow(AC_PROG_MKDIR_P) +AC_PROG_MKDIR_P AC_PROG_RANLIB AC_PATH_PROG(CFLOW_CMD, cflow) AC_PATH_PROG(CSCOPE_CMD, cscope) From jbrassow@sourceware.org Thu Aug 13 20:51:00 2009 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 13 Aug 2009 20:51:00 -0000 Subject: LVM2 daemons/clogd/Makefile.in libdm/misc/dm-l ... Message-ID: <20090813205142.7973.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2009-08-13 20:51:41 Added files: daemons/clogd : Makefile.in libdm/misc : dm-log-userspace.h Log message: Cluster log server (clogd): Add new build files. Might be a good idea to add the new files to the repository. :( Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/Makefile.in.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/misc/dm-log-userspace.h.diff?cvsroot=lvm2&r1=NONE&r2=1.1 /cvs/lvm2/LVM2/daemons/clogd/Makefile.in,v --> standard output revision 1.1 --- LVM2/daemons/clogd/Makefile.in +++ - 2009-08-13 20:51:41.908288000 +0000 @@ -0,0 +1,38 @@ +# +# Copyright (C) 2009 Red Hat, Inc. All rights reserved. +# +# This file is part of LVM2. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions +# of the GNU General Public License v.2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +SOURCES = clogd.c cluster.c functions.c link_mon.c local.c logging.c + +ifeq ("@DEBUG@", "yes") + DEFS += -DDEBUG +endif + +TARGETS = clogd + +include $(top_srcdir)/make.tmpl + +LDFLAGS += -L$(usrlibdir)/openais +LIBS += -lcpg -lSaCkpt -ldevmapper + +clogd: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a + echo $(LIBS) + $(CC) -o clogd $(OBJECTS) $(CFLAGS) $(LDFLAGS) \ + $(LVMLIBS) $(LMLIBS) $(LIBS) + +install: $(TARGETS) + $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) clogd \ + $(usrsbindir)/clogd /cvs/lvm2/LVM2/libdm/misc/dm-log-userspace.h,v --> standard output revision 1.1 --- LVM2/libdm/misc/dm-log-userspace.h +++ - 2009-08-13 20:51:42.011773000 +0000 @@ -0,0 +1,397 @@ +/* + * Copyright (C) 2006-2009 Red Hat, Inc. + * + * This file is released under the LGPL. + */ + +#ifndef __DM_LOG_USERSPACE_H__ +#define __DM_LOG_USERSPACE_H__ + +#include /* For DM_UUID_LEN */ + +/* + * The device-mapper userspace log module consists of a kernel component and + * a user-space component. The kernel component implements the API defined + * in dm-dirty-log.h. Its purpose is simply to pass the parameters and + * return values of those API functions between kernel and user-space. + * + * Below are defined the 'request_types' - DM_ULOG_CTR, DM_ULOG_DTR, etc. + * These request types represent the different functions in the device-mapper + * dirty log API. Each of these is described in more detail below. + * + * The user-space program must listen for requests from the kernel (representing + * the various API functions) and process them. + * + * User-space begins by setting up the communication link (error checking + * removed for clarity): + * fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); + * addr.nl_family = AF_NETLINK; + * addr.nl_groups = CN_IDX_DM; + * addr.nl_pid = 0; + * r = bind(fd, (struct sockaddr *) &addr, sizeof(addr)); + * opt = addr.nl_groups; + * setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &opt, sizeof(opt)); + * + * User-space will then wait to receive requests form the kernel, which it + * will process as described below. The requests are received in the form, + * ((struct dm_ulog_request) + (additional data)). Depending on the request + * type, there may or may not be 'additional data'. In the descriptions below, + * you will see 'Payload-to-userspace' and 'Payload-to-kernel'. The + * 'Payload-to-userspace' is what the kernel sends in 'additional data' as + * necessary parameters to complete the request. The 'Payload-to-kernel' is + * the 'additional data' returned to the kernel that contains the necessary + * results of the request. The 'data_size' field in the dm_ulog_request + * structure denotes the availability and amount of payload data. + */ + +/* + * DM_ULOG_CTR corresponds to (found in dm-dirty-log.h): + * int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, + * unsigned argc, char **argv); + * + * Payload-to-userspace: + * A single string containing all the argv arguments separated by ' 's + * Payload-to-kernel: + * None. ('data_size' in the dm_ulog_request struct should be 0.) + * + * The UUID contained in the dm_ulog_request structure is the reference that + * will be used by all request types to a specific log. The constructor must + * record this assotiation with instance created. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and + * 'data_size' appropriately. + */ +#define DM_ULOG_CTR 1 + +/* + * DM_ULOG_DTR corresponds to (found in dm-dirty-log.h): + * void (*dtr)(struct dm_dirty_log *log); + * + * Payload-to-userspace: + * A single string containing all the argv arguments separated by ' 's + * Payload-to-kernel: + * None. ('data_size' in the dm_ulog_request struct should be 0.) + * + * The UUID contained in the dm_ulog_request structure is all that is + * necessary to identify the log instance being destroyed. There is no + * payload data. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and clearing + * 'data_size' appropriately. + */ +#define DM_ULOG_DTR 2 + +/* + * DM_ULOG_PRESUSPEND corresponds to (found in dm-dirty-log.h): + * int (*presuspend)(struct dm_dirty_log *log); + * + * Payload-to-userspace: + * None. + * Payload-to-kernel: + * None. + * + * The UUID contained in the dm_ulog_request structure is all that is + * necessary to identify the log instance being presuspended. There is no + * payload data. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and + * 'data_size' appropriately. + */ +#define DM_ULOG_PRESUSPEND 3 + +/* + * DM_ULOG_POSTSUSPEND corresponds to (found in dm-dirty-log.h): + * int (*postsuspend)(struct dm_dirty_log *log); + * + * Payload-to-userspace: + * None. + * Payload-to-kernel: + * None. + * + * The UUID contained in the dm_ulog_request structure is all that is + * necessary to identify the log instance being postsuspended. There is no + * payload data. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and + * 'data_size' appropriately. + */ +#define DM_ULOG_POSTSUSPEND 4 + +/* + * DM_ULOG_RESUME corresponds to (found in dm-dirty-log.h): + * int (*resume)(struct dm_dirty_log *log); + * + * Payload-to-userspace: + * None. + * Payload-to-kernel: + * None. + * + * The UUID contained in the dm_ulog_request structure is all that is + * necessary to identify the log instance being resumed. There is no + * payload data. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and + * 'data_size' appropriately. + */ +#define DM_ULOG_RESUME 5 + +/* + * DM_ULOG_GET_REGION_SIZE corresponds to (found in dm-dirty-log.h): + * uint32_t (*get_region_size)(struct dm_dirty_log *log); + * + * Payload-to-userspace: + * None. + * Payload-to-kernel: + * uint64_t - contains the region size + * + * The region size is something that was determined at constructor time. + * It is returned in the payload area and 'data_size' is set to + * reflect this. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field appropriately. + */ +#define DM_ULOG_GET_REGION_SIZE 6 + +/* + * DM_ULOG_IS_CLEAN corresponds to (found in dm-dirty-log.h): + * int (*is_clean)(struct dm_dirty_log *log, region_t region); + * + * Payload-to-userspace: + * uint64_t - the region to get clean status on + * Payload-to-kernel: + * int64_t - 1 if clean, 0 otherwise + * + * Payload is sizeof(uint64_t) and contains the region for which the clean + * status is being made. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - filling the payload with 0 (not clean) or + * 1 (clean), setting 'data_size' and 'error' appropriately. + */ +#define DM_ULOG_IS_CLEAN 7 + +/* + * DM_ULOG_IN_SYNC corresponds to (found in dm-dirty-log.h): + * int (*in_sync)(struct dm_dirty_log *log, region_t region, + * int can_block); + * + * Payload-to-userspace: + * uint64_t - the region to get sync status on + * Payload-to-kernel: + * int64_t - 1 if in-sync, 0 otherwise + * + * Exactly the same as 'is_clean' above, except this time asking "has the + * region been recovered?" vs. "is the region not being modified?" + */ +#define DM_ULOG_IN_SYNC 8 + +/* + * DM_ULOG_FLUSH corresponds to (found in dm-dirty-log.h): + * int (*flush)(struct dm_dirty_log *log); + * + * Payload-to-userspace: + * None. + * Payload-to-kernel: + * None. + * + * No incoming or outgoing payload. Simply flush log state to disk. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and clearing + * 'data_size' appropriately. + */ +#define DM_ULOG_FLUSH 9 + +/* + * DM_ULOG_MARK_REGION corresponds to (found in dm-dirty-log.h): + * void (*mark_region)(struct dm_dirty_log *log, region_t region); + * + * Payload-to-userspace: + * uint64_t [] - region(s) to mark + * Payload-to-kernel: + * None. + * + * Incoming payload contains the one or more regions to mark dirty. + * The number of regions contained in the payload can be determined from + * 'data_size/sizeof(uint64_t)'. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and clearing + * 'data_size' appropriately. + */ +#define DM_ULOG_MARK_REGION 10 + +/* + * DM_ULOG_CLEAR_REGION corresponds to (found in dm-dirty-log.h): + * void (*clear_region)(struct dm_dirty_log *log, region_t region); + * + * Payload-to-userspace: + * uint64_t [] - region(s) to clear + * Payload-to-kernel: + * None. + * + * Incoming payload contains the one or more regions to mark clean. + * The number of regions contained in the payload can be determined from + * 'data_size/sizeof(uint64_t)'. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and clearing + * 'data_size' appropriately. + */ +#define DM_ULOG_CLEAR_REGION 11 + +/* + * DM_ULOG_GET_RESYNC_WORK corresponds to (found in dm-dirty-log.h): + * int (*get_resync_work)(struct dm_dirty_log *log, region_t *region); + * + * Payload-to-userspace: + * None. + * Payload-to-kernel: + * { + * int64_t i; -- 1 if recovery necessary, 0 otherwise + * uint64_t r; -- The region to recover if i=1 + * } + * 'data_size' should be set appropriately. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field appropriately. + */ +#define DM_ULOG_GET_RESYNC_WORK 12 + +/* + * DM_ULOG_SET_REGION_SYNC corresponds to (found in dm-dirty-log.h): + * void (*set_region_sync)(struct dm_dirty_log *log, + * region_t region, int in_sync); + * + * Payload-to-userspace: + * { + * uint64_t - region to set sync state on + * int64_t - 0 if not-in-sync, 1 if in-sync + * } + * Payload-to-kernel: + * None. + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and clearing + * 'data_size' appropriately. + */ +#define DM_ULOG_SET_REGION_SYNC 13 + +/* + * DM_ULOG_GET_SYNC_COUNT corresponds to (found in dm-dirty-log.h): + * region_t (*get_sync_count)(struct dm_dirty_log *log); + * + * Payload-to-userspace: + * None. + * Payload-to-kernel: + * uint64_t - the number of in-sync regions + * + * No incoming payload. Kernel-bound payload contains the number of + * regions that are in-sync (in a size_t). + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and + * 'data_size' appropriately. + */ +#define DM_ULOG_GET_SYNC_COUNT 14 + +/* + * DM_ULOG_STATUS_INFO corresponds to (found in dm-dirty-log.h): + * int (*status)(struct dm_dirty_log *log, STATUSTYPE_INFO, + * char *result, unsigned maxlen); + * + * Payload-to-userspace: + * None. + * Payload-to-kernel: + * Character string containing STATUSTYPE_INFO + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and + * 'data_size' appropriately. + */ +#define DM_ULOG_STATUS_INFO 15 + +/* + * DM_ULOG_STATUS_TABLE corresponds to (found in dm-dirty-log.h): + * int (*status)(struct dm_dirty_log *log, STATUSTYPE_TABLE, + * char *result, unsigned maxlen); + * + * Payload-to-userspace: + * None. + * Payload-to-kernel: + * Character string containing STATUSTYPE_TABLE + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and + * 'data_size' appropriately. + */ +#define DM_ULOG_STATUS_TABLE 16 + +/* + * DM_ULOG_IS_REMOTE_RECOVERING corresponds to (found in dm-dirty-log.h): + * int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region); + * + * Payload-to-userspace: + * uint64_t - region to determine recovery status on + * Payload-to-kernel: + * { + * int64_t is_recovering; -- 0 if no, 1 if yes + * uint64_t in_sync_hint; -- lowest region still needing resync + * } + * + * When the request has been processed, user-space must return the + * dm_ulog_request to the kernel - setting the 'error' field and + * 'data_size' appropriately. + */ +#define DM_ULOG_IS_REMOTE_RECOVERING 17 + +/* + * (DM_ULOG_REQUEST_MASK & request_type) to get the request type + * + * Payload-to-userspace: + * A single string containing all the argv arguments separated by ' 's + * Payload-to-kernel: + * None. ('data_size' in the dm_ulog_request struct should be 0.) + * + * We are reserving 8 bits of the 32-bit 'request_type' field for the + * various request types above. The remaining 24-bits are currently + * set to zero and are reserved for future use and compatibility concerns. + * + * User-space should always use DM_ULOG_REQUEST_TYPE to aquire the + * request type from the 'request_type' field to maintain forward compatibility. + */ +#define DM_ULOG_REQUEST_MASK 0xFF +#define DM_ULOG_REQUEST_TYPE(request_type) \ + (DM_ULOG_REQUEST_MASK & (request_type)) + +struct dm_ulog_request { + /* + * The local unique identifier (luid) and the universally unique + * identifier (uuid) are used to tie a request to a specific + * mirror log. A single machine log could probably make due with + * just the 'luid', but a cluster-aware log must use the 'uuid' and + * the 'luid'. The uuid is what is required for node to node + * communication concerning a particular log, but the 'luid' helps + * differentiate between logs that are being swapped and have the + * same 'uuid'. (Think "live" and "inactive" device-mapper tables.) + */ + uint64_t luid; + char uuid[DM_UUID_LEN]; + char padding[7]; /* Padding because DM_UUID_LEN = 129 */ + + int32_t error; /* Used to report back processing errors */ + + uint32_t seq; /* Sequence number for request */ + uint32_t request_type; /* DM_ULOG_* defined above */ + uint32_t data_size; /* How much data (not including this struct) */ + + char data[0]; +}; + +#endif /* __DM_LOG_USERSPACE_H__ */ From prajnoha@sourceware.org Fri Aug 14 14:37:00 2009 From: prajnoha@sourceware.org (prajnoha@sourceware.org) Date: Fri, 14 Aug 2009 14:37:00 -0000 Subject: LVM2/udev 12-dm-disk.rules Message-ID: <20090814143747.16906.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-08-14 14:37:47 Modified files: udev : 12-dm-disk.rules Log message: Use new blkid instead of vol_id in udev rules. Thanks to Daniel Mierswa for reminding us. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/12-dm-disk.rules.diff?cvsroot=lvm2&r1=1.1&r2=1.2 --- LVM2/udev/12-dm-disk.rules 2009/08/03 18:44:54 1.1 +++ LVM2/udev/12-dm-disk.rules 2009/08/14 14:37:46 1.2 @@ -21,7 +21,7 @@ ENV{DM_SUSPENDED}=="1", GOTO="dm_end" -IMPORT{program}="vol_id --export $tempnode" +IMPORT{program}="/sbin/blkid -o udev -p $tempnode" OPTIONS="link_priority=-100" ENV{DM_LV_LAYER}=="?*", OPTIONS="link_priority=-90" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" From snitzer@sourceware.org Wed Aug 19 15:34:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Wed, 19 Aug 2009 15:34:00 -0000 Subject: LVM2 ./WHATS_NEW lib/device/dev-md.c lib/filte ... Message-ID: <20090819153448.2034.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-08-19 15:34:46 Modified files: . : WHATS_NEW lib/device : dev-md.c lib/filters : filter.c filter.h Log message: Fix pvcreate on a partition (regressed in 2.02.51). Eliminate busy loop during pvcreate of a "normal" partition. _md_sysfs_attribute_snprintf() would busy loop if the device it was given was not a blkext-based MD partition. Rather than being cute with a busy-loop prone 'goto check_md_major' in _md_sysfs_attribute_snprintf(): explicitly check if the provided device is a blkext-based partition (blkext_major()); and then check that the get_primary_dev() determined parent is an MD device (md_major()). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1241&r2=1.1242 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-md.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter.h.diff?cvsroot=lvm2&r1=1.15&r2=1.16 --- LVM2/WHATS_NEW 2009/08/13 17:16:38 1.1241 +++ LVM2/WHATS_NEW 2009/08/19 15:34:33 1.1242 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Fix pvcreate on a partition (2.02.51). Fix vgcfgrestore error paths when locking fails (2.02.49). Added configure --enable-clogd to conditionally build the cluster log daemon. Make lvchange --refresh only take a read lock on volume group. --- LVM2/lib/device/dev-md.c 2009/08/01 17:14:52 1.18 +++ LVM2/lib/device/dev-md.c 2009/08/19 15:34:43 1.19 @@ -137,13 +137,15 @@ if (!sysfs_dir || !*sysfs_dir) return ret; -check_md_major: - if (MAJOR(dev) != md_major()) { - if (get_primary_dev(sysfs_dir, blkdev, &dev)) - goto check_md_major; - return ret; + if (MAJOR(dev) == blkext_major()) { + /* lookup parent MD device from blkext partition */ + if (!get_primary_dev(sysfs_dir, blkdev, &dev)) + return ret; } + if (MAJOR(dev) != md_major()) + return ret; + ret = dm_snprintf(path, size, "%s/dev/block/%d:%d/md/%s", sysfs_dir, (int)MAJOR(dev), (int)MINOR(dev), attribute); if (ret < 0) { --- LVM2/lib/filters/filter.c 2009/07/09 22:34:02 1.48 +++ LVM2/lib/filters/filter.c 2009/08/19 15:34:46 1.49 @@ -38,6 +38,7 @@ } device_info_t; static int _md_major = -1; +static int _blkext_major = -1; static int _device_mapper_major = -1; int md_major(void) @@ -45,6 +46,11 @@ return _md_major; } +int blkext_major(void) +{ + return _blkext_major; +} + /* * Devices are only checked for partition tables if their minor number * is a multiple of the number corresponding to their type below @@ -197,6 +203,10 @@ if (!strncmp("md", line + i, 2) && isspace(*(line + i + 2))) _md_major = line_maj; + /* Look for blkext device */ + if (!strncmp("blkext", line + i, 6) && isspace(*(line + i + 6))) + _blkext_major = line_maj; + /* Look for device-mapper device */ /* FIXME Cope with multiple majors */ if (!strncmp("device-mapper", line + i, 13) && isspace(*(line + i + 13))) --- LVM2/lib/filters/filter.h 2007/08/20 20:55:25 1.15 +++ LVM2/lib/filters/filter.h 2009/08/19 15:34:46 1.16 @@ -36,6 +36,7 @@ void lvm_type_filter_destroy(struct dev_filter *f); int md_major(void); +int blkext_major(void); int max_partitions(int major); #endif From mbroz@sourceware.org Thu Aug 20 07:03:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Thu, 20 Aug 2009 07:03:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/metadata.c Message-ID: <20090820070303.8181.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-08-20 07:03:02 Modified files: . : WHATS_NEW lib/metadata : metadata.c Log message: Fix uuid warning in pvcreate to use terminated (and dash formatted) UUID string. # pvcreate -u udwxr7-BoKY-EeKM-r033-xK6o-4og7-F13sGi /dev/sdc uuid udwxr7BoKYEeKMr033xK6o4og7F13sGi|?????????????????? already in use on "/dev/sdb1" is now # pvcreate -u udwxr7-BoKY-EeKM-r033-xK6o-4og7-F13sGi /dev/sdc uuid udwxr7-BoKY-EeKM-r033-xK6o-4og7-F13sGi already in use on "/dev/sdb1" Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1242&r2=1.1243 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.278&r2=1.279 --- LVM2/WHATS_NEW 2009/08/19 15:34:33 1.1242 +++ LVM2/WHATS_NEW 2009/08/20 07:03:02 1.1243 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Fix pvcreate string termination in duplicate uuid warning message. Fix pvcreate on a partition (2.02.51). Fix vgcfgrestore error paths when locking fails (2.02.49). Added configure --enable-clogd to conditionally build the cluster log daemon. --- LVM2/lib/metadata/metadata.c 2009/08/10 17:15:01 1.278 +++ LVM2/lib/metadata/metadata.c 2009/08/20 07:03:02 1.279 @@ -1264,6 +1264,7 @@ struct device *dev; struct dm_list mdas; struct pvcreate_params default_pp; + char buffer[64] __attribute((aligned(8))); fill_default_pvcreate_params(&default_pp); if (!pp) @@ -1272,8 +1273,11 @@ if (pp->idp) { if ((dev = device_from_pvid(cmd, pp->idp)) && (dev != dev_cache_get(pv_name, cmd->filter))) { - log_error("uuid %s already in use on \"%s\"", - pp->idp->uuid, dev_name(dev)); + if (!id_write_format((const struct id*)&pp->idp->uuid, + buffer, sizeof(buffer))) + return_NULL; + log_error("uuid %s already in use on \"%s\"", buffer, + dev_name(dev)); return NULL; } } From mbroz@sourceware.org Mon Aug 24 11:37:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 24 Aug 2009 11:37:00 -0000 Subject: LVM2 ./WHATS_NEW tools/toollib.c Message-ID: <20090824113721.12644.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-08-24 11:37:21 Modified files: . : WHATS_NEW tools : toollib.c Log message: Fix global locking in PV reporting commands (2.02.49). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1243&r2=1.1244 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.166&r2=1.167 --- LVM2/WHATS_NEW 2009/08/20 07:03:02 1.1243 +++ LVM2/WHATS_NEW 2009/08/24 11:37:20 1.1244 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Fix global locking in PV reporting commands (2.02.49). Fix pvcreate string termination in duplicate uuid warning message. Fix pvcreate on a partition (2.02.51). Fix vgcfgrestore error paths when locking fails (2.02.49). --- LVM2/tools/toollib.c 2009/07/21 11:10:49 1.166 +++ LVM2/tools/toollib.c 2009/08/24 11:37:21 1.167 @@ -643,7 +643,7 @@ dm_list_init(&tags); - if (lock_global && !lock_vol(cmd, VG_GLOBAL, LCK_READ)) { + if (lock_global && !lock_vol(cmd, VG_GLOBAL, LCK_VG_READ)) { log_error("Unable to obtain global lock."); return ECMD_FAILED; } From jbrassow@sourceware.org Fri Aug 28 05:27:00 2009 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Fri, 28 Aug 2009 05:27:00 -0000 Subject: LVM2/daemons/clogd functions.c Message-ID: <20090828052709.12553.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2009-08-28 05:27:09 Modified files: daemons/clogd : functions.c Log message: cluster log daemon (clogd): Adjust for kernel CTR arg reordering We have moved the internally generated mirror-device-size parameter from the end of the CTR string to the begining. This change adjusts for that. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/functions.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9 --- LVM2/daemons/clogd/functions.c 2009/08/13 16:34:07 1.8 +++ LVM2/daemons/clogd/functions.c 2009/08/28 05:27:09 1.9 @@ -540,6 +540,7 @@ { int argc, i, r = 0; char *p, **argv = NULL; + char *dev_size_str; uint64_t device_size; /* Sanity checks */ @@ -559,14 +560,16 @@ } /* Split up args */ - for (argc = 1, p = rq->data; (p = strstr(p, " ")); p++, argc++) + for (argc = 0, p = rq->data; (p = strstr(p, " ")); p++, argc++) *p = '\0'; argv = malloc(argc * sizeof(char *)); if (!argv) return -ENOMEM; - for (i = 0, p = rq->data; i < argc; i++, p = p + strlen(p) + 1) + p = dev_size_str = rq->data; + p += strlen(p) + 1; + for (i = 0; i < argc; i++, p = p + strlen(p) + 1) argv[i] = p; if (strcmp(argv[0], "clustered_disk") && @@ -576,13 +579,12 @@ return -EINVAL; } - if (!(device_size = strtoll(argv[argc - 1], &p, 0)) || *p) { - LOG_ERROR("Invalid device size argument: %s", argv[argc - 1]); + if (!(device_size = strtoll(dev_size_str, &p, 0)) || *p) { + LOG_ERROR("Invalid device size argument: %s", dev_size_str); free(argv); return -EINVAL; } - argc--; /* We pass in the device_size separate */ r = _clog_ctr(rq->uuid, rq->luid, argc - 1, argv + 1, device_size); /* We join the CPG when we resume */ From agk@sourceware.org Fri Aug 28 19:22:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 28 Aug 2009 19:22:00 -0000 Subject: LVM2 ./WHATS_NEW ./configure ./configure.in da ... Message-ID: <20090828192206.14439.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-28 19:22:05 Modified files: . : WHATS_NEW configure configure.in daemons/clvmd : Makefile.in clvmd-comms.h clvmd-corosync.c clvmd-openais.c lib/misc : configure.h.in Log message: Rewrite clvmd configuration code. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1244&r2=1.1245 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.diff?cvsroot=lvm2&r1=1.100&r2=1.101 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.107&r2=1.108 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/Makefile.in.diff?cvsroot=lvm2&r1=1.29&r2=1.30 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-comms.h.diff?cvsroot=lvm2&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-corosync.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-openais.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/configure.h.in.diff?cvsroot=lvm2&r1=1.10&r2=1.11 --- LVM2/WHATS_NEW 2009/08/24 11:37:20 1.1244 +++ LVM2/WHATS_NEW 2009/08/28 19:22:05 1.1245 @@ -1,5 +1,6 @@ Version 2.02.52 - ================================= + Rewrite clvmd configuration code to cope with all combinations of libs. Fix global locking in PV reporting commands (2.02.49). Fix pvcreate string termination in duplicate uuid warning message. Fix pvcreate on a partition (2.02.51). --- LVM2/configure 2009/07/31 13:31:53 1.100 +++ LVM2/configure 2009/08/28 19:22:05 1.101 @@ -688,6 +688,7 @@ COPTIMISE_FLAG CONFDIR CMDLIB +CLOGD CLVMD CLUSTER CLDWHOLEARCHIVE @@ -701,12 +702,26 @@ LVM2APP_LIB GENHTML LCOV +DLM_LIBS +DLM_CFLAGS CPG_LIBS CPG_CFLAGS CONFDB_LIBS CONFDB_CFLAGS +SALCK_LIBS +SALCK_CFLAGS QUORUM_LIBS QUORUM_CFLAGS +COROSYNC_LIBS +COROSYNC_CFLAGS +CMAN_LIBS +CMAN_CFLAGS +GULM_LIBS +GULM_CFLAGS +CCS_LIBS +CCS_CFLAGS +PKGCONFIGINIT_LIBS +PKGCONFIGINIT_CFLAGS PKG_CONFIG POW_LIB LIBOBJS @@ -799,6 +814,7 @@ enable_readline enable_realtime with_clvmd +enable_clogd enable_debug with_optimisation enable_profiling @@ -836,12 +852,26 @@ CPPFLAGS CPP PKG_CONFIG +PKGCONFIGINIT_CFLAGS +PKGCONFIGINIT_LIBS +CCS_CFLAGS +CCS_LIBS +GULM_CFLAGS +GULM_LIBS +CMAN_CFLAGS +CMAN_LIBS +COROSYNC_CFLAGS +COROSYNC_LIBS QUORUM_CFLAGS QUORUM_LIBS +SALCK_CFLAGS +SALCK_LIBS CONFDB_CFLAGS CONFDB_LIBS CPG_CFLAGS -CPG_LIBS' +CPG_LIBS +DLM_CFLAGS +DLM_LIBS' # Initialize some variables set by options. @@ -1472,6 +1502,7 @@ device-mapper is missing from the kernel --disable-readline Disable readline support --disable-realtime Disable realtime clock support + --enable-clogd Enable the cluster log daemon --enable-debug Enable debugging --enable-profiling Gather gcov profiling data --disable-devmapper Disable LVM2 device-mapper interaction @@ -1506,7 +1537,13 @@ TYPE=internal --with-mirrors=TYPE Mirror support: internal/shared/none TYPE=internal - --with-clvmd=TYPE Build cluster LVM Daemon: cman/gulm/corosync/none/all + --with-clvmd=TYPE Build cluster LVM Daemon. + The following locking combinations are valid: + * cman,gulm (RHEL4 or equivalent) + * cman (RHEL5 or equivalent) + * cman,corosync,openais (or selection of them) + * all (autodetect) + * none (disable build) TYPE=none --with-optimisation=OPT C optimisation flag [OPT=-O2] --with-localedir=DIR Translation files in DIR [PREFIX/share/locale] @@ -1530,14 +1567,33 @@ you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility + PKGCONFIGINIT_CFLAGS + C compiler flags for PKGCONFIGINIT, overriding pkg-config + PKGCONFIGINIT_LIBS + linker flags for PKGCONFIGINIT, overriding pkg-config + CCS_CFLAGS C compiler flags for CCS, overriding pkg-config + CCS_LIBS linker flags for CCS, overriding pkg-config + GULM_CFLAGS C compiler flags for GULM, overriding pkg-config + GULM_LIBS linker flags for GULM, overriding pkg-config + CMAN_CFLAGS C compiler flags for CMAN, overriding pkg-config + CMAN_LIBS linker flags for CMAN, overriding pkg-config + COROSYNC_CFLAGS + C compiler flags for COROSYNC, overriding pkg-config + COROSYNC_LIBS + linker flags for COROSYNC, overriding pkg-config QUORUM_CFLAGS C compiler flags for QUORUM, overriding pkg-config QUORUM_LIBS linker flags for QUORUM, overriding pkg-config + SALCK_CFLAGS + C compiler flags for SALCK, overriding pkg-config + SALCK_LIBS linker flags for SALCK, overriding pkg-config CONFDB_CFLAGS C compiler flags for CONFDB, overriding pkg-config CONFDB_LIBS linker flags for CONFDB, overriding pkg-config CPG_CFLAGS C compiler flags for CPG, overriding pkg-config CPG_LIBS linker flags for CPG, overriding pkg-config + DLM_CFLAGS C compiler flags for DLM, overriding pkg-config + DLM_LIBS linker flags for DLM, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -9201,7 +9257,29 @@ CLUSTER=internal fi -if [ "x$CLVMD" = xall -o `expr x"$CLVMD" : '.*corosync.*'` != 0 ]; then +if [ `expr x"$CLVMD" : '.*gulm.*'` != 0 ]; then + BUILDGULM=yes +fi +if [ `expr x"$CLVMD" : '.*corosync.*'` != 0 ]; then + BUILDCOROSYNC=yes +fi +if [ `expr x"$CLVMD" : '.*openais.*'` != 0 ]; then + BUILDOPENAIS=yes +fi +if [ `expr x"$CLVMD" : '.*cman.*'` != 0 ]; then + BUILDCMAN=yes +fi + +if test x$BUILDGULM = xyes; then + if test x$BUILDCOROSYNC = xyes || \ + test x$BUILDOPENAIS = xyes; then + { { $as_echo "$as_me:$LINENO: error: requested clvmd configuration is not valid" >&5 +$as_echo "$as_me: error: requested clvmd configuration is not valid" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +if test x$CLVMD != xnone; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then @@ -9320,35 +9398,35 @@ fi pkg_failed=no -{ $as_echo "$as_me:$LINENO: checking for QUORUM" >&5 -$as_echo_n "checking for QUORUM... " >&6; } +{ $as_echo "$as_me:$LINENO: checking for PKGCONFIGINIT" >&5 +$as_echo_n "checking for PKGCONFIGINIT... " >&6; } -if test -n "$QUORUM_CFLAGS"; then - pkg_cv_QUORUM_CFLAGS="$QUORUM_CFLAGS" +if test -n "$PKGCONFIGINIT_CFLAGS"; then + pkg_cv_PKGCONFIGINIT_CFLAGS="$PKGCONFIGINIT_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libquorum\"") >&5 - ($PKG_CONFIG --exists --print-errors "libquorum") 2>&5 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"pkgconfiginit\"") >&5 + ($PKG_CONFIG --exists --print-errors "pkgconfiginit") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_QUORUM_CFLAGS=`$PKG_CONFIG --cflags "libquorum" 2>/dev/null` + pkg_cv_PKGCONFIGINIT_CFLAGS=`$PKG_CONFIG --cflags "pkgconfiginit" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi -if test -n "$QUORUM_LIBS"; then - pkg_cv_QUORUM_LIBS="$QUORUM_LIBS" +if test -n "$PKGCONFIGINIT_LIBS"; then + pkg_cv_PKGCONFIGINIT_LIBS="$PKGCONFIGINIT_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libquorum\"") >&5 - ($PKG_CONFIG --exists --print-errors "libquorum") 2>&5 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"pkgconfiginit\"") >&5 + ($PKG_CONFIG --exists --print-errors "pkgconfiginit") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_QUORUM_LIBS=`$PKG_CONFIG --libs "libquorum" 2>/dev/null` + pkg_cv_PKGCONFIGINIT_LIBS=`$PKG_CONFIG --libs "pkgconfiginit" 2>/dev/null` else pkg_failed=yes fi @@ -9366,131 +9444,172 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - QUORUM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libquorum" 2>&1` + PKGCONFIGINIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "pkgconfiginit" 2>&1` else - QUORUM_PKG_ERRORS=`$PKG_CONFIG --print-errors "libquorum" 2>&1` + PKGCONFIGINIT_PKG_ERRORS=`$PKG_CONFIG --print-errors "pkgconfiginit" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$QUORUM_PKG_ERRORS" >&5 + echo "$PKGCONFIGINIT_PKG_ERRORS" >&5 { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:$LINENO: result: no pkg for quorum library, using -lquorum" >&5 -$as_echo "no pkg for quorum library, using -lquorum" >&6; }; - QUORUM_LIBS="-lquorum" + { $as_echo "$as_me:$LINENO: result: pkg-config initialized" >&5 +$as_echo "pkg-config initialized" >&6; } elif test $pkg_failed = untried; then - { $as_echo "$as_me:$LINENO: result: no pkg for quorum library, using -lquorum" >&5 -$as_echo "no pkg for quorum library, using -lquorum" >&6; }; - QUORUM_LIBS="-lquorum" + { $as_echo "$as_me:$LINENO: result: pkg-config initialized" >&5 +$as_echo "pkg-config initialized" >&6; } else - QUORUM_CFLAGS=$pkg_cv_QUORUM_CFLAGS - QUORUM_LIBS=$pkg_cv_QUORUM_LIBS + PKGCONFIGINIT_CFLAGS=$pkg_cv_PKGCONFIGINIT_CFLAGS + PKGCONFIGINIT_LIBS=$pkg_cv_PKGCONFIGINIT_LIBS { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } : fi +fi -pkg_failed=no -{ $as_echo "$as_me:$LINENO: checking for CONFDB" >&5 -$as_echo_n "checking for CONFDB... " >&6; } +soft_bailout() { + NOTFOUND=1 +} -if test -n "$CONFDB_CFLAGS"; then - pkg_cv_CONFDB_CFLAGS="$CONFDB_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libconfdb\"") >&5 - ($PKG_CONFIG --exists --print-errors "libconfdb") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_CONFDB_CFLAGS=`$PKG_CONFIG --cflags "libconfdb" 2>/dev/null` +hard_bailout() { + { { $as_echo "$as_me:$LINENO: error: bailing out" >&5 +$as_echo "$as_me: error: bailing out" >&2;} + { (exit 1); exit 1; }; } +} + +if test x$CLVMD = xall; then + bailout=soft_bailout + BUILDGULM=yes + BUILDCMAN=yes + BUILDCOROSYNC=yes + BUILDOPENAIS=yes +else + bailout=hard_bailout +fi + +check_lib_no_libs() { + lib_no_libs_arg1=$1 + shift + lib_no_libs_arg2=$1 + shift + lib_no_libs_args=$@ + +as_ac_Lib=`$as_echo "ac_cv_lib_$lib_no_libs_arg1''_$lib_no_libs_arg2" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $lib_no_libs_arg2 in -l$lib_no_libs_arg1" >&5 +$as_echo_n "checking for $lib_no_libs_arg2 in -l$lib_no_libs_arg1... " >&6; } +if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$CONFDB_LIBS"; then - pkg_cv_CONFDB_LIBS="$CONFDB_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libconfdb\"") >&5 - ($PKG_CONFIG --exists --print-errors "libconfdb") 2>&5 + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$lib_no_libs_arg1 $lib_no_libs_args $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $lib_no_libs_arg2 (); +int +main () +{ +return $lib_no_libs_arg2 (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_CONFDB_LIBS=`$PKG_CONFIG --libs "libconfdb" 2>/dev/null` + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_Lib=yes" else - pkg_failed=yes -fi - else - pkg_failed=untried -fi + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_Lib=no" +fi +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +ac_res=`eval 'as_val=${'$as_ac_Lib'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Lib'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_LIB$lib_no_libs_arg1" | $as_tr_cpp` 1 +_ACEOF -if test $pkg_failed = yes; then + LIBS="-l$lib_no_libs_arg1 $LIBS" -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes else - _pkg_short_errors_supported=no + $bailout fi - if test $_pkg_short_errors_supported = yes; then - CONFDB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libconfdb" 2>&1` - else - CONFDB_PKG_ERRORS=`$PKG_CONFIG --print-errors "libconfdb" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$CONFDB_PKG_ERRORS" >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:$LINENO: result: no pkg for confdb library, using -lconfdb" >&5 -$as_echo "no pkg for confdb library, using -lconfdb" >&6; }; - CONFDB_LIBS="-lconfdb" -elif test $pkg_failed = untried; then - { $as_echo "$as_me:$LINENO: result: no pkg for confdb library, using -lconfdb" >&5 -$as_echo "no pkg for confdb library, using -lconfdb" >&6; }; - CONFDB_LIBS="-lconfdb" -else - CONFDB_CFLAGS=$pkg_cv_CONFDB_CFLAGS - CONFDB_LIBS=$pkg_cv_CONFDB_LIBS - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - : -fi + LIBS=$ac_check_lib_save_LIBS +} + +if test x$BUILDGULM = xyes; then pkg_failed=no -{ $as_echo "$as_me:$LINENO: checking for CPG" >&5 -$as_echo_n "checking for CPG... " >&6; } +{ $as_echo "$as_me:$LINENO: checking for CCS" >&5 +$as_echo_n "checking for CCS... " >&6; } -if test -n "$CPG_CFLAGS"; then - pkg_cv_CPG_CFLAGS="$CPG_CFLAGS" +if test -n "$CCS_CFLAGS"; then + pkg_cv_CCS_CFLAGS="$CCS_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libcpg\"") >&5 - ($PKG_CONFIG --exists --print-errors "libcpg") 2>&5 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libccs\"") >&5 + ($PKG_CONFIG --exists --print-errors "libccs") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_CPG_CFLAGS=`$PKG_CONFIG --cflags "libcpg" 2>/dev/null` + pkg_cv_CCS_CFLAGS=`$PKG_CONFIG --cflags "libccs" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi -if test -n "$CPG_LIBS"; then - pkg_cv_CPG_LIBS="$CPG_LIBS" +if test -n "$CCS_LIBS"; then + pkg_cv_CCS_LIBS="$CCS_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libcpg\"") >&5 - ($PKG_CONFIG --exists --print-errors "libcpg") 2>&5 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libccs\"") >&5 + ($PKG_CONFIG --exists --print-errors "libccs") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_CPG_LIBS=`$PKG_CONFIG --libs "libcpg" 2>/dev/null` + pkg_cv_CCS_LIBS=`$PKG_CONFIG --libs "libccs" 2>/dev/null` else pkg_failed=yes fi @@ -9508,69 +9627,2157 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CPG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcpg" 2>&1` + CCS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libccs" 2>&1` else - CPG_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcpg" 2>&1` + CCS_PKG_ERRORS=`$PKG_CONFIG --print-errors "libccs" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$CPG_PKG_ERRORS" >&5 + echo "$CCS_PKG_ERRORS" >&5 { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:$LINENO: result: no pkg for libcpg library, using -lcpg" >&5 -$as_echo "no pkg for libcpg library, using -lcpg" >&6; }; - CPG_LIBS="-lcpg" -elif test $pkg_failed = untried; then - { $as_echo "$as_me:$LINENO: result: no pkg for libcpg library, using -lcpg" >&5 -$as_echo "no pkg for libcpg library, using -lcpg" >&6; }; - CPG_LIBS="-lcpg" -else - CPG_CFLAGS=$pkg_cv_CPG_CFLAGS - CPG_LIBS=$pkg_cv_CPG_LIBS - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - : -fi -fi + NOTFOUND=0 -################################################################################ -{ $as_echo "$as_me:$LINENO: checking whether to enable debugging" >&5 -$as_echo_n "checking whether to enable debugging... " >&6; } -# Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then - enableval=$enable_debug; DEBUG=$enableval -else - DEBUG=no +for ac_header in ccs.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 fi - -{ $as_echo "$as_me:$LINENO: result: $DEBUG" >&5 -$as_echo "$DEBUG" >&6; } - -if test x$DEBUG = xyes; then - COPTIMISE_FLAG= +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } else - CSCOPE_CMD= -fi - -################################################################################ -{ $as_echo "$as_me:$LINENO: checking for C optimisation flag" >&5 -$as_echo_n "checking for C optimisation flag... " >&6; } + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -# Check whether --with-optimisation was given. -if test "${with_optimisation+set}" = set; then - withval=$with_optimisation; COPTIMISE_FLAG="$withval" + ac_header_compiler=no fi -{ $as_echo "$as_me:$LINENO: result: $COPTIMISE_FLAG" >&5 -$as_echo "$COPTIMISE_FLAG" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } -################################################################################ -{ $as_echo "$as_me:$LINENO: checking whether to gather gcov profiling data" >&5 -$as_echo_n "checking whether to gather gcov profiling data... " >&6; } -# Check whether --enable-profiling was given. -if test "${enable_profiling+set}" = set; then - enableval=$enable_profiling; PROFILING=$enableval -else +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + $bailout +fi + +done + + check_lib_no_libs ccs ccs_connect + if test $NOTFOUND = 0; then + { $as_echo "$as_me:$LINENO: result: no pkg for libccs, using -lccs" >&5 +$as_echo "no pkg for libccs, using -lccs" >&6; } + CCS_LIBS="-lccs" + HAVE_CCS=yes + fi +elif test $pkg_failed = untried; then + NOTFOUND=0 + +for ac_header in ccs.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + $bailout +fi + +done + + check_lib_no_libs ccs ccs_connect + if test $NOTFOUND = 0; then + { $as_echo "$as_me:$LINENO: result: no pkg for libccs, using -lccs" >&5 +$as_echo "no pkg for libccs, using -lccs" >&6; } + CCS_LIBS="-lccs" + HAVE_CCS=yes + fi +else + CCS_CFLAGS=$pkg_cv_CCS_CFLAGS + CCS_LIBS=$pkg_cv_CCS_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_CCS=yes +fi + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for GULM" >&5 +$as_echo_n "checking for GULM... " >&6; } + +if test -n "$GULM_CFLAGS"; then + pkg_cv_GULM_CFLAGS="$GULM_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgulm\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgulm") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GULM_CFLAGS=`$PKG_CONFIG --cflags "libgulm" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GULM_LIBS"; then + pkg_cv_GULM_LIBS="$GULM_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgulm\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgulm") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GULM_LIBS=`$PKG_CONFIG --libs "libgulm" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GULM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libgulm" 2>&1` + else + GULM_PKG_ERRORS=`$PKG_CONFIG --print-errors "libgulm" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GULM_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + NOTFOUND=0 + +for ac_header in libgulm.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + $bailout +fi + +done + + check_lib_no_libs gulm lg_core_login + if test $NOTFOUND = 0; then + { $as_echo "$as_me:$LINENO: result: no pkg for libgulm, using -lgulm" >&5 +$as_echo "no pkg for libgulm, using -lgulm" >&6; } + GULM_LIBS="-lgulm" + HAVE_GULM=yes + fi +elif test $pkg_failed = untried; then + NOTFOUND=0 + +for ac_header in libgulm.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + $bailout +fi + +done + + check_lib_no_libs gulm lg_core_login + if test $NOTFOUND = 0; then + { $as_echo "$as_me:$LINENO: result: no pkg for libgulm, using -lgulm" >&5 +$as_echo "no pkg for libgulm, using -lgulm" >&6; } + GULM_LIBS="-lgulm" + HAVE_GULM=yes + fi +else + GULM_CFLAGS=$pkg_cv_GULM_CFLAGS + GULM_LIBS=$pkg_cv_GULM_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_GULM=yes +fi +fi + +if test x$BUILDCMAN = xyes; then + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for CMAN" >&5 +$as_echo_n "checking for CMAN... " >&6; } + +if test -n "$CMAN_CFLAGS"; then + pkg_cv_CMAN_CFLAGS="$CMAN_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libcman\"") >&5 + ($PKG_CONFIG --exists --print-errors "libcman") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_CMAN_CFLAGS=`$PKG_CONFIG --cflags "libcman" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CMAN_LIBS"; then + pkg_cv_CMAN_LIBS="$CMAN_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libcman\"") >&5 + ($PKG_CONFIG --exists --print-errors "libcman") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_CMAN_LIBS=`$PKG_CONFIG --libs "libcman" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CMAN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcman" 2>&1` + else + CMAN_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcman" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CMAN_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + NOTFOUND=0 + +for ac_header in libcman.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + $bailout +fi + +done + + check_lib_no_libs cman cman_init + if test $NOTFOUND = 0; then + { $as_echo "$as_me:$LINENO: result: no pkg for libcman, using -lcman" >&5 +$as_echo "no pkg for libcman, using -lcman" >&6; } + CMAN_LIBS="-lcman" + HAVE_CMAN=yes + fi +elif test $pkg_failed = untried; then + NOTFOUND=0 + +for ac_header in libcman.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + $bailout +fi + +done + + check_lib_no_libs cman cman_init + if test $NOTFOUND = 0; then + { $as_echo "$as_me:$LINENO: result: no pkg for libcman, using -lcman" >&5 +$as_echo "no pkg for libcman, using -lcman" >&6; } + CMAN_LIBS="-lcman" + HAVE_CMAN=yes + fi +else + CMAN_CFLAGS=$pkg_cv_CMAN_CFLAGS + CMAN_LIBS=$pkg_cv_CMAN_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_CMAN=yes +fi + CHECKCONFDB=yes + CHECKDLM=yes +fi + +if test x$BUILDCOROSYNC = xyes || \ + test x$BUILDOPENAIS = xyes; then + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for COROSYNC" >&5 +$as_echo_n "checking for COROSYNC... " >&6; } + +if test -n "$COROSYNC_CFLAGS"; then + pkg_cv_COROSYNC_CFLAGS="$COROSYNC_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"corosync\"") >&5 + ($PKG_CONFIG --exists --print-errors "corosync") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_COROSYNC_CFLAGS=`$PKG_CONFIG --cflags "corosync" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$COROSYNC_LIBS"; then + pkg_cv_COROSYNC_LIBS="$COROSYNC_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"corosync\"") >&5 + ($PKG_CONFIG --exists --print-errors "corosync") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_COROSYNC_LIBS=`$PKG_CONFIG --libs "corosync" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + COROSYNC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "corosync" 2>&1` + else + COROSYNC_PKG_ERRORS=`$PKG_CONFIG --print-errors "corosync" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$COROSYNC_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + $bailout +elif test $pkg_failed = untried; then + $bailout +else + COROSYNC_CFLAGS=$pkg_cv_COROSYNC_CFLAGS + COROSYNC_LIBS=$pkg_cv_COROSYNC_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_COROSYNC=yes +fi + CHECKCONFDB=yes +fi + +if test x$BUILDCOROSYNC = xyes; then + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for QUORUM" >&5 +$as_echo_n "checking for QUORUM... " >&6; } + +if test -n "$QUORUM_CFLAGS"; then + pkg_cv_QUORUM_CFLAGS="$QUORUM_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libquorum\"") >&5 + ($PKG_CONFIG --exists --print-errors "libquorum") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_QUORUM_CFLAGS=`$PKG_CONFIG --cflags "libquorum" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$QUORUM_LIBS"; then + pkg_cv_QUORUM_LIBS="$QUORUM_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libquorum\"") >&5 + ($PKG_CONFIG --exists --print-errors "libquorum") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_QUORUM_LIBS=`$PKG_CONFIG --libs "libquorum" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + QUORUM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libquorum" 2>&1` + else + QUORUM_PKG_ERRORS=`$PKG_CONFIG --print-errors "libquorum" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$QUORUM_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + $bailout +elif test $pkg_failed = untried; then + $bailout +else + QUORUM_CFLAGS=$pkg_cv_QUORUM_CFLAGS + QUORUM_LIBS=$pkg_cv_QUORUM_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_QUORUM=yes +fi + CHECKCPG=yes + CHECKDLM=yes +fi + +if test x$BUILDOPENAIS = xyes; then + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for SALCK" >&5 +$as_echo_n "checking for SALCK... " >&6; } + +if test -n "$SALCK_CFLAGS"; then + pkg_cv_SALCK_CFLAGS="$SALCK_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libSaLck\"") >&5 + ($PKG_CONFIG --exists --print-errors "libSaLck") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_SALCK_CFLAGS=`$PKG_CONFIG --cflags "libSaLck" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SALCK_LIBS"; then + pkg_cv_SALCK_LIBS="$SALCK_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libSaLck\"") >&5 + ($PKG_CONFIG --exists --print-errors "libSaLck") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_SALCK_LIBS=`$PKG_CONFIG --libs "libSaLck" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SALCK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libSaLck" 2>&1` + else + SALCK_PKG_ERRORS=`$PKG_CONFIG --print-errors "libSaLck" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SALCK_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + $bailout +elif test $pkg_failed = untried; then + $bailout +else + SALCK_CFLAGS=$pkg_cv_SALCK_CFLAGS + SALCK_LIBS=$pkg_cv_SALCK_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_SALCK=yes +fi + CHECKCPG=yes +fi + + + +if test x$CHECKCONFDB = xyes; then + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for CONFDB" >&5 +$as_echo_n "checking for CONFDB... " >&6; } + +if test -n "$CONFDB_CFLAGS"; then + pkg_cv_CONFDB_CFLAGS="$CONFDB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libconfdb\"") >&5 + ($PKG_CONFIG --exists --print-errors "libconfdb") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_CONFDB_CFLAGS=`$PKG_CONFIG --cflags "libconfdb" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CONFDB_LIBS"; then + pkg_cv_CONFDB_LIBS="$CONFDB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libconfdb\"") >&5 + ($PKG_CONFIG --exists --print-errors "libconfdb") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_CONFDB_LIBS=`$PKG_CONFIG --libs "libconfdb" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CONFDB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libconfdb" 2>&1` + else + CONFDB_PKG_ERRORS=`$PKG_CONFIG --print-errors "libconfdb" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CONFDB_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + HAVE_CONFDB=no +elif test $pkg_failed = untried; then + HAVE_CONFDB=no +else + CONFDB_CFLAGS=$pkg_cv_CONFDB_CFLAGS + CONFDB_LIBS=$pkg_cv_CONFDB_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_CONFDB=yes +fi + + +for ac_header in corosync/confdb.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + HAVE_CONFDB_H=yes +else + HAVE_CONFDB_H=no +fi + +done + + + if test x$HAVE_CONFDB != xyes && \ + test x$HAVE_CONFDB_H = xyes; then + check_lib_no_libs confdb confdb_initialize + { $as_echo "$as_me:$LINENO: result: no pkg for confdb, using -lconfdb" >&5 +$as_echo "no pkg for confdb, using -lconfdb" >&6; } + CONFDB_LIBS="-lconfdb" + HAVE_CONFDB=yes + fi + + if test x$BUILDCOROSYNC = xyes && \ + test x$HAVE_CONFDB != xyes && + test x$CLVMD != xall; then + { { $as_echo "$as_me:$LINENO: error: bailing out... confdb library is required" >&5 +$as_echo "$as_me: error: bailing out... confdb library is required" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +if test x$CHECKCPG = xyes; then + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for CPG" >&5 +$as_echo_n "checking for CPG... " >&6; } + +if test -n "$CPG_CFLAGS"; then + pkg_cv_CPG_CFLAGS="$CPG_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libcpg\"") >&5 + ($PKG_CONFIG --exists --print-errors "libcpg") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_CPG_CFLAGS=`$PKG_CONFIG --cflags "libcpg" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CPG_LIBS"; then + pkg_cv_CPG_LIBS="$CPG_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libcpg\"") >&5 + ($PKG_CONFIG --exists --print-errors "libcpg") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_CPG_LIBS=`$PKG_CONFIG --libs "libcpg" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CPG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcpg" 2>&1` + else + CPG_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcpg" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CPG_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + $bailout +elif test $pkg_failed = untried; then + $bailout +else + CPG_CFLAGS=$pkg_cv_CPG_CFLAGS + CPG_LIBS=$pkg_cv_CPG_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_CPG=yes +fi +fi + +if test x$CHECKDLM = xyes; then + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for DLM" >&5 +$as_echo_n "checking for DLM... " >&6; } + +if test -n "$DLM_CFLAGS"; then + pkg_cv_DLM_CFLAGS="$DLM_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libdlm\"") >&5 + ($PKG_CONFIG --exists --print-errors "libdlm") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_DLM_CFLAGS=`$PKG_CONFIG --cflags "libdlm" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$DLM_LIBS"; then + pkg_cv_DLM_LIBS="$DLM_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libdlm\"") >&5 + ($PKG_CONFIG --exists --print-errors "libdlm") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_DLM_LIBS=`$PKG_CONFIG --libs "libdlm" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + DLM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libdlm" 2>&1` + else + DLM_PKG_ERRORS=`$PKG_CONFIG --print-errors "libdlm" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$DLM_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + NOTFOUND=0 + +for ac_header in libdlm.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + $bailout +fi + +done + + check_lib_no_libs dlm dlm_lock -lpthread + if test $NOTFOUND = 0; then + { $as_echo "$as_me:$LINENO: result: no pkg for libdlm, using -ldlm" >&5 +$as_echo "no pkg for libdlm, using -ldlm" >&6; } + DLM_LIBS="-ldlm -lpthread" + HAVE_DLM=yes + fi +elif test $pkg_failed = untried; then + NOTFOUND=0 + +for ac_header in libdlm.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + $bailout +fi + +done + + check_lib_no_libs dlm dlm_lock -lpthread + if test $NOTFOUND = 0; then + { $as_echo "$as_me:$LINENO: result: no pkg for libdlm, using -ldlm" >&5 +$as_echo "no pkg for libdlm, using -ldlm" >&6; } + DLM_LIBS="-ldlm -lpthread" + HAVE_DLM=yes + fi +else + DLM_CFLAGS=$pkg_cv_DLM_CFLAGS + DLM_LIBS=$pkg_cv_DLM_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_DLM=yes +fi +fi + +if test x$CLVMD = xall; then + if test x$HAVE_CCS = xyes && \ + test x$HAVE_GULM = xyes; then + { $as_echo "$as_me:$LINENO: result: Enabling clvmd gulm backend" >&5 +$as_echo "Enabling clvmd gulm backend" >&6; } + NEWCLVMD="$NEWCLVMD,gulm" + fi + if test x$HAVE_CMAN = xyes && \ + test x$HAVE_DLM = xyes; then + { $as_echo "$as_me:$LINENO: result: Enabling clvmd cman backend" >&5 +$as_echo "Enabling clvmd cman backend" >&6; } + NEWCLVMD="$NEWCLVMD,cman" + fi + if test x$HAVE_COROSYNC = xyes && \ + test x$HAVE_QUORUM = xyes && \ + test x$HAVE_CPG = xyes && \ + test x$HAVE_DLM = xyes && \ + test x$HAVE_CONFDB = xyes; then + { $as_echo "$as_me:$LINENO: result: Enabling clvmd corosync backend" >&5 +$as_echo "Enabling clvmd corosync backend" >&6; } + NEWCLVMD="$NEWCLVMD,corosync" + fi + if test x$HAVE_COROSYNC = xyes && \ + test x$HAVE_CPG = xyes && \ + test x$HAVE_SALCK = xyes; then + { $as_echo "$as_me:$LINENO: result: Enabling clvmd openais backend" >&5 +$as_echo "Enabling clvmd openais backend" >&6; } + NEWCLVMD="$NEWCLVMD,openais" + fi + CLVMD="$NEWCLVMD" +fi + +################################################################################ +{ $as_echo "$as_me:$LINENO: checking whether to build cluster log daemon" >&5 +$as_echo_n "checking whether to build cluster log daemon... " >&6; } +# Check whether --enable-clogd was given. +if test "${enable_clogd+set}" = set; then + enableval=$enable_clogd; CLOGD=$enableval +fi + +{ $as_echo "$as_me:$LINENO: result: $CLOGD" >&5 +$as_echo "$CLOGD" >&6; } + +if [ "x$CLOGD" = xall -o `expr x"$CLOGD" : '.*corosync.*'` != 0 ]; then +# +# FIXME: ALSO NEED TO CHECK FOR CHECKPOINT MODULE +# + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for CPG" >&5 +$as_echo_n "checking for CPG... " >&6; } + +if test -n "$CPG_CFLAGS"; then + pkg_cv_CPG_CFLAGS="$CPG_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libcpg\"") >&5 + ($PKG_CONFIG --exists --print-errors "libcpg") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_CPG_CFLAGS=`$PKG_CONFIG --cflags "libcpg" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CPG_LIBS"; then + pkg_cv_CPG_LIBS="$CPG_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libcpg\"") >&5 + ($PKG_CONFIG --exists --print-errors "libcpg") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_CPG_LIBS=`$PKG_CONFIG --libs "libcpg" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CPG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcpg" 2>&1` + else + CPG_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcpg" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CPG_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:$LINENO: result: no pkg for libcpg library, using -lcpg" >&5 +$as_echo "no pkg for libcpg library, using -lcpg" >&6; }; + CPG_LIBS="-lcpg" +elif test $pkg_failed = untried; then + { $as_echo "$as_me:$LINENO: result: no pkg for libcpg library, using -lcpg" >&5 +$as_echo "no pkg for libcpg library, using -lcpg" >&6; }; + CPG_LIBS="-lcpg" +else + CPG_CFLAGS=$pkg_cv_CPG_CFLAGS + CPG_LIBS=$pkg_cv_CPG_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi +fi + +################################################################################ +{ $as_echo "$as_me:$LINENO: checking whether to enable debugging" >&5 +$as_echo_n "checking whether to enable debugging... " >&6; } +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then + enableval=$enable_debug; DEBUG=$enableval +else + DEBUG=no +fi + +{ $as_echo "$as_me:$LINENO: result: $DEBUG" >&5 +$as_echo "$DEBUG" >&6; } + +if test x$DEBUG = xyes; then + COPTIMISE_FLAG= +else + CSCOPE_CMD= +fi + +################################################################################ +{ $as_echo "$as_me:$LINENO: checking for C optimisation flag" >&5 +$as_echo_n "checking for C optimisation flag... " >&6; } + +# Check whether --with-optimisation was given. +if test "${with_optimisation+set}" = set; then + withval=$with_optimisation; COPTIMISE_FLAG="$withval" +fi + +{ $as_echo "$as_me:$LINENO: result: $COPTIMISE_FLAG" >&5 +$as_echo "$COPTIMISE_FLAG" >&6; } + +################################################################################ +{ $as_echo "$as_me:$LINENO: checking whether to gather gcov profiling data" >&5 +$as_echo_n "checking whether to gather gcov profiling data... " >&6; } +# Check whether --enable-profiling was given. +if test "${enable_profiling+set}" = set; then + enableval=$enable_profiling; PROFILING=$enableval +else PROFILING=no fi @@ -12904,8 +15111,19 @@ + + + + + + + + + + + ################################################################################ -ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/misc/lvm-version.h lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/Makefile test/Makefile test/api/Makefile tools/Makefile udev/Makefile" +ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/clogd/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/misc/lvm-version.h lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/Makefile test/Makefile test/api/Makefile tools/Makefile udev/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -13508,6 +15726,7 @@ "make.tmpl") CONFIG_FILES="$CONFIG_FILES make.tmpl" ;; "daemons/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/Makefile" ;; "daemons/clvmd/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/clvmd/Makefile" ;; + "daemons/clogd/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/clogd/Makefile" ;; "daemons/dmeventd/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/dmeventd/Makefile" ;; "daemons/dmeventd/libdevmapper-event.pc") CONFIG_FILES="$CONFIG_FILES daemons/dmeventd/libdevmapper-event.pc" ;; "daemons/dmeventd/plugins/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/dmeventd/plugins/Makefile" ;; --- LVM2/configure.in 2009/08/13 20:23:01 1.107 +++ LVM2/configure.in 2009/08/28 19:22:05 1.108 @@ -325,7 +325,13 @@ dnl -- Build cluster LVM daemon AC_MSG_CHECKING(whether to build cluster LVM daemon) AC_ARG_WITH(clvmd, - [ --with-clvmd=TYPE Build cluster LVM Daemon: cman/gulm/corosync/none/all + [ --with-clvmd=TYPE Build cluster LVM Daemon. + The following locking combinations are valid: + * cman,gulm (RHEL4 or equivalent) + * cman (RHEL5 or equivalent) + * cman,corosync,openais (or selection of them) + * all (autodetect) + * none (disable build) [TYPE=none] ], [ CLVMD="$withval" ], [ CLVMD="none" ]) @@ -339,17 +345,208 @@ CLUSTER=internal fi +dnl -- define build types +if [[ `expr x"$CLVMD" : '.*gulm.*'` != 0 ]]; then + BUILDGULM=yes +fi +if [[ `expr x"$CLVMD" : '.*corosync.*'` != 0 ]]; then + BUILDCOROSYNC=yes +fi +if [[ `expr x"$CLVMD" : '.*openais.*'` != 0 ]]; then + BUILDOPENAIS=yes +fi +if [[ `expr x"$CLVMD" : '.*cman.*'` != 0 ]]; then + BUILDCMAN=yes +fi + +dnl -- sanity check around user selection +if test x$BUILDGULM = xyes; then + if test x$BUILDCOROSYNC = xyes || \ + test x$BUILDOPENAIS = xyes; then + AC_MSG_ERROR([requested clvmd configuration is not valid]) + fi +fi + +dnl -- Init pkg-config with dummy invokation: +dnl -- this is required because PKG_CHECK_MODULES macro is expanded +dnl -- to initialize the pkg-config environment only at the first invokation, +dnl -- that would be conditional in this configure.in. +if test x$CLVMD != xnone; then + PKG_CHECK_MODULES(PKGCONFIGINIT, pkgconfiginit, [], + [AC_MSG_RESULT([pkg-config initialized])]) +fi + +dnl -- define a soft bailout if we are autodetecting +soft_bailout() { + NOTFOUND=1 +} + +hard_bailout() { + AC_MSG_ERROR([bailing out]) +} + +dnl -- if clvmd=all then set soft_bailout (we don't want to error) +dnl -- and set all builds to yes. We need to do this here +dnl -- to skip the gulm + openais|corosync sanity check above. +if test x$CLVMD = xall; then + bailout=soft_bailout + BUILDGULM=yes + BUILDCMAN=yes + BUILDCOROSYNC=yes + BUILDOPENAIS=yes +else + bailout=hard_bailout +fi + +dnl -- helper macro to check libs without adding them to LIBS +check_lib_no_libs() { + lib_no_libs_arg1=$1 + shift + lib_no_libs_arg2=$1 + shift + lib_no_libs_args=$@ + AC_CHECK_LIB([$lib_no_libs_arg1], + [$lib_no_libs_arg2],, + [$bailout], + [$lib_no_libs_args]) + LIBS=$ac_check_lib_save_LIBS +} + +dnl -- Look for gulm libraries if required. +if test x$BUILDGULM = xyes; then + PKG_CHECK_MODULES(CCS, libccs, [HAVE_CCS=yes], + [NOTFOUND=0 + AC_CHECK_HEADERS(ccs.h,,$bailout) + check_lib_no_libs ccs ccs_connect + if test $NOTFOUND = 0; then + AC_MSG_RESULT([no pkg for libccs, using -lccs]) + CCS_LIBS="-lccs" + HAVE_CCS=yes + fi]) + PKG_CHECK_MODULES(GULM, libgulm, [HAVE_GULM=yes], + [NOTFOUND=0 + AC_CHECK_HEADERS(libgulm.h,,$bailout) + check_lib_no_libs gulm lg_core_login + if test $NOTFOUND = 0; then + AC_MSG_RESULT([no pkg for libgulm, using -lgulm]) + GULM_LIBS="-lgulm" + HAVE_GULM=yes + fi]) +fi + +dnl -- Look for cman libraries if required. +if test x$BUILDCMAN = xyes; then + PKG_CHECK_MODULES(CMAN, libcman, [HAVE_CMAN=yes], + [NOTFOUND=0 + AC_CHECK_HEADERS(libcman.h,,$bailout) + check_lib_no_libs cman cman_init + if test $NOTFOUND = 0; then + AC_MSG_RESULT([no pkg for libcman, using -lcman]) + CMAN_LIBS="-lcman" + HAVE_CMAN=yes + fi]) + CHECKCONFDB=yes + CHECKDLM=yes +fi + +dnl -- Look for corosync that's required also for openais build +dnl -- only enough recent version of corosync ship pkg-config files. +dnl -- We can safely rely on that to detect the correct bits. +if test x$BUILDCOROSYNC = xyes || \ + test x$BUILDOPENAIS = xyes; then + PKG_CHECK_MODULES(COROSYNC, corosync, [HAVE_COROSYNC=yes], $bailout) + CHECKCONFDB=yes +fi + dnl -- Look for corosync libraries if required. -if [[ "x$CLVMD" = xall -o `expr x"$CLVMD" : '.*corosync.*'` != 0 ]]; then - PKG_CHECK_MODULES(QUORUM, libquorum, [], - [AC_MSG_RESULT([no pkg for quorum library, using -lquorum]); - QUORUM_LIBS="-lquorum"]) - PKG_CHECK_MODULES(CONFDB, libconfdb, [], - [AC_MSG_RESULT([no pkg for confdb library, using -lconfdb]); - CONFDB_LIBS="-lconfdb"]) - PKG_CHECK_MODULES(CPG, libcpg, [], - [AC_MSG_RESULT([no pkg for libcpg library, using -lcpg]); - CPG_LIBS="-lcpg"]) +if test x$BUILDCOROSYNC = xyes; then + PKG_CHECK_MODULES(QUORUM, libquorum, [HAVE_QUORUM=yes], $bailout) + CHECKCPG=yes + CHECKDLM=yes +fi + +dnl -- Look for openais libraries if required. +if test x$BUILDOPENAIS = xyes; then + PKG_CHECK_MODULES(SALCK, libSaLck, [HAVE_SALCK=yes], $bailout) + CHECKCPG=yes +fi + +dnl -- Below are checks for libraries common to more than one build. + +dnl -- Check confdb library. +dnl -- mandatory for corosync build. +dnl -- optional for openais/cman build. + +if test x$CHECKCONFDB = xyes; then + PKG_CHECK_MODULES(CONFDB, libconfdb, + [HAVE_CONFDB=yes], + [HAVE_CONFDB=no]) + + AC_CHECK_HEADERS(corosync/confdb.h, + [HAVE_CONFDB_H=yes], + [HAVE_CONFDB_H=no]) + + if test x$HAVE_CONFDB != xyes && \ + test x$HAVE_CONFDB_H = xyes; then + check_lib_no_libs confdb confdb_initialize + AC_MSG_RESULT([no pkg for confdb, using -lconfdb]) + CONFDB_LIBS="-lconfdb" + HAVE_CONFDB=yes + fi + + if test x$BUILDCOROSYNC = xyes && \ + test x$HAVE_CONFDB != xyes && + test x$CLVMD != xall; then + AC_MSG_ERROR([bailing out... confdb library is required]) + fi +fi + +dnl -- Check cpg library. +if test x$CHECKCPG = xyes; then + PKG_CHECK_MODULES(CPG, libcpg, [HAVE_CPG=yes], $bailout) +fi + +dnl -- Check dlm library. +if test x$CHECKDLM = xyes; then + PKG_CHECK_MODULES(DLM, libdlm, [HAVE_DLM=yes], + [NOTFOUND=0 + AC_CHECK_HEADERS(libdlm.h,,$bailout) + check_lib_no_libs dlm dlm_lock -lpthread + if test $NOTFOUND = 0; then + AC_MSG_RESULT([no pkg for libdlm, using -ldlm]) + DLM_LIBS="-ldlm -lpthread" + HAVE_DLM=yes + fi]) +fi + +dnl -- If we are autodetecting, we need to re-create +dnl -- the depedencies checks and set a proper CLVMD. +if test x$CLVMD = xall; then + if test x$HAVE_CCS = xyes && \ + test x$HAVE_GULM = xyes; then + AC_MSG_RESULT([Enabling clvmd gulm backend]) + NEWCLVMD="$NEWCLVMD,gulm" + fi + if test x$HAVE_CMAN = xyes && \ + test x$HAVE_DLM = xyes; then + AC_MSG_RESULT([Enabling clvmd cman backend]) + NEWCLVMD="$NEWCLVMD,cman" + fi + if test x$HAVE_COROSYNC = xyes && \ + test x$HAVE_QUORUM = xyes && \ + test x$HAVE_CPG = xyes && \ + test x$HAVE_DLM = xyes && \ + test x$HAVE_CONFDB = xyes; then + AC_MSG_RESULT([Enabling clvmd corosync backend]) + NEWCLVMD="$NEWCLVMD,corosync" + fi + if test x$HAVE_COROSYNC = xyes && \ + test x$HAVE_CPG = xyes && \ + test x$HAVE_SALCK = xyes; then + AC_MSG_RESULT([Enabling clvmd openais backend]) + NEWCLVMD="$NEWCLVMD,openais" + fi + CLVMD="$NEWCLVMD" fi ################################################################################ @@ -811,6 +1008,8 @@ ################################################################################ AC_SUBST(APPLIB) AC_SUBST(BUILD_DMEVENTD) +AC_SUBST(CCS_CFLAGS) +AC_SUBST(CCS_LIBS) AC_SUBST(CFLAGS) AC_SUBST(CFLOW_CMD) AC_SUBST(CLDFLAGS) @@ -819,6 +1018,8 @@ AC_SUBST(CLUSTER) AC_SUBST(CLVMD) AC_SUBST(CLOGD) +AC_SUBST(CMAN_CFLAGS) +AC_SUBST(CMAN_LIBS) AC_SUBST(CMDLIB) AC_SUBST(CONFDB_CFLAGS) AC_SUBST(CONFDB_LIBS) @@ -829,6 +1030,8 @@ AC_SUBST(CSCOPE_CMD) AC_SUBST(DEBUG) AC_SUBST(DEVMAPPER) +AC_SUBST(DLM_CFLAGS) +AC_SUBST(DLM_LIBS) AC_SUBST(DMEVENTD) AC_SUBST(DM_COMPAT) AC_SUBST(DM_DEVICE_GID) @@ -839,6 +1042,8 @@ AC_SUBST(DM_LIB_PATCHLEVEL) AC_SUBST(FSADM) AC_SUBST(GROUP) +AC_SUBST(GULM_CFLAGS) +AC_SUBST(GULM_LIBS) AC_SUBST(HAVE_LIBDL) AC_SUBST(HAVE_REALTIME) AC_SUBST(HAVE_SELINUX) @@ -865,6 +1070,8 @@ AC_SUBST(POOL) AC_SUBST(QUORUM_CFLAGS) AC_SUBST(QUORUM_LIBS) +AC_SUBST(SALCK_CFLAGS) +AC_SUBST(SALCK_LIBS) AC_SUBST(SNAPSHOTS) AC_SUBST(STATICDIR) AC_SUBST(STATIC_LINK) --- LVM2/daemons/clvmd/Makefile.in 2009/03/10 12:10:12 1.29 +++ LVM2/daemons/clvmd/Makefile.in 2009/08/28 19:22:05 1.30 @@ -15,12 +15,22 @@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -QUORUM_LIBS = @QUORUM_LIBS@ -QUORUM_CFLAGS = @QUORUM_CFLAGS@ +CCS_LIBS = @CCS_LIBS@ +CCS_CFLAGS = @CCS_CFLAGS@ +CMAN_LIBS = @CMAN_LIBS@ +CMAN_CFLAGS = @CMAN_CFLAGS@ CONFDB_LIBS = @CONFDB_LIBS@ CONFDB_CFLAGS = @CONFDB_CFLAGS@ CPG_LIBS = @CPG_LIBS@ CPG_CFLAGS = @CPG_CFLAGS@ +DLM_LIBS = @DLM_LIBS@ +DLM_CFLAGS = @DLM_CFLAGS@ +GULM_LIBS = @GULM_LIBS@ +GULM_CFLAGS = @GULM_CFLAGS@ +QUORUM_LIBS = @QUORUM_LIBS@ +QUORUM_CFLAGS = @QUORUM_CFLAGS@ +SALCK_LIBS = @SALCK_LIBS@ +SALCK_CFLAGS = @SALCK_CFLAGS@ SOURCES = \ clvmd-command.c \ @@ -28,55 +38,35 @@ lvm-functions.c \ refresh_clvmd.c -ifneq (,$(findstring gulm,, "@CLVMD@,")) - GULM = yes -endif - -ifneq (,$(findstring cman,, "@CLVMD@,")) - CMAN = yes -endif - -ifneq (,$(findstring openais,, "@CLVMD@,")) - OPENAIS = yes -endif - -ifneq (,$(findstring corosync,, "@CLVMD@,")) - COROSYNC = yes -endif - -ifneq (,$(findstring all,, "@CLVMD@,")) - GULM = yes - CMAN = yes - OPENAIS = yes - COROSYNC = yes -endif - ifeq ("@DEBUG@", "yes") DEFS += -DDEBUG endif -ifeq ("$(GULM)", "yes") +ifneq (,$(findstring gulm,, "@CLVMD@,")) SOURCES += clvmd-gulm.c tcp-comms.c - LMLIBS += -lccs -lgulm + LMLIBS += $(CCS_LIBS) $(GULM_LIBS) + CFLAGS += $(CCS_CFLAGS) $(GULM_CFLAGS) DEFS += -DUSE_GULM endif -ifeq ("$(CMAN)", "yes") +ifneq (,$(findstring cman,, "@CLVMD@,")) SOURCES += clvmd-cman.c - LMLIBS += -ldlm -lcman + LMLIBS += $(CMAN_LIBS) $(CONFDB_LIBS) $(DLM_LIBS) + CFLAGS += $(CMAN_CFLAGS) $(CONFDB_CFLAGS) $(DLM_CFLAGS) DEFS += -DUSE_CMAN endif -ifeq ("$(OPENAIS)", "yes") +ifneq (,$(findstring openais,, "@CLVMD@,")) SOURCES += clvmd-openais.c - LMLIBS += -lSaLck -lcpg + LMLIBS += $(CONFDB_LIBS) $(CPG_LIBS) $(SALCK_LIBS) + CFLAGS += $(CONFDB_CFLAGS) $(CPG_CFLAGS) $(SALCK_CFLAGS) DEFS += -DUSE_OPENAIS endif -ifeq ("$(COROSYNC)", "yes") +ifneq (,$(findstring corosync,, "@CLVMD@,")) SOURCES += clvmd-corosync.c - LMLIBS += $(QUORUM_LIBS) $(CONFDB_LIBS) $(CPG_LIBS) -ldlm - CFLAGS += $(QUORUM_CFLAGS) $(CONFDB_CFLAGS) $(CPG_CFLAGS) + LMLIBS += $(CONFDB_LIBS) $(CPG_LIBS) $(DLM_LIBS) $(QUORUM_LIBS) + CFLAGS += $(CONFDB_CFLAGS) $(CPG_CFLAGS) $(DLM_CFLAGS) $(QUORUM_CFLAGS) DEFS += -DUSE_COROSYNC endif --- LVM2/daemons/clvmd/clvmd-comms.h 2009/01/22 10:21:12 1.9 +++ LVM2/daemons/clvmd/clvmd-comms.h 2009/08/28 19:22:05 1.10 @@ -1,6 +1,6 @@ /* * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -77,7 +77,7 @@ #ifdef USE_OPENAIS # include -# include +# include # define OPENAIS_CSID_LEN (sizeof(int)) # define OPENAIS_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX # define OPENAIS_MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH --- LVM2/daemons/clvmd/clvmd-corosync.c 2009/06/03 13:42:02 1.10 +++ LVM2/daemons/clvmd/clvmd-corosync.c 2009/08/28 19:22:05 1.11 @@ -55,13 +55,13 @@ /* Timeout value for several corosync calls */ #define LOCKSPACE_NAME "clvmd" -static void cpg_deliver_callback (cpg_handle_t handle, +static void corosync_cpg_deliver_callback (cpg_handle_t handle, const struct cpg_name *groupName, uint32_t nodeid, uint32_t pid, void *msg, size_t msg_len); -static void cpg_confchg_callback(cpg_handle_t handle, +static void corosync_cpg_confchg_callback(cpg_handle_t handle, const struct cpg_name *groupName, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, @@ -87,9 +87,9 @@ static struct cpg_name cpg_group_name; /* Corosync callback structs */ -cpg_callbacks_t cpg_callbacks = { - .cpg_deliver_fn = cpg_deliver_callback, - .cpg_confchg_fn = cpg_confchg_callback, +cpg_callbacks_t corosync_cpg_callbacks = { + .cpg_deliver_fn = corosync_cpg_deliver_callback, + .cpg_confchg_fn = corosync_cpg_confchg_callback, }; quorum_callbacks_t quorum_callbacks = { @@ -205,7 +205,7 @@ return buf; } -static void cpg_deliver_callback (cpg_handle_t handle, +static void corosync_cpg_deliver_callback (cpg_handle_t handle, const struct cpg_name *groupName, uint32_t nodeid, uint32_t pid, @@ -225,7 +225,7 @@ msg_len-COROSYNC_CSID_LEN, (char*)&nodeid); } -static void cpg_confchg_callback(cpg_handle_t handle, +static void corosync_cpg_confchg_callback(cpg_handle_t handle, const struct cpg_name *groupName, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, @@ -294,7 +294,7 @@ node_hash = dm_hash_create(100); err = cpg_initialize(&cpg_handle, - &cpg_callbacks); + &corosync_cpg_callbacks); if (err != CS_OK) { syslog(LOG_ERR, "Cannot initialise Corosync CPG service: %d", err); --- LVM2/daemons/clvmd/clvmd-openais.c 2009/04/21 13:11:28 1.11 +++ LVM2/daemons/clvmd/clvmd-openais.c 2009/08/28 19:22:05 1.12 @@ -1,7 +1,7 @@ /****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2007 Red Hat, Inc. All rights reserved. +** Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved. ** ******************************************************************************* ******************************************************************************/ @@ -41,7 +41,9 @@ #include #include -#include + +#include +#include #include "locking.h" #include "lvm-logging.h" @@ -53,17 +55,18 @@ /* Timeout value for several openais calls */ #define TIMEOUT 10 -static void cpg_deliver_callback (cpg_handle_t handle, - struct cpg_name *groupName, +static void openais_cpg_deliver_callback (cpg_handle_t handle, + const struct cpg_name *groupName, uint32_t nodeid, uint32_t pid, void *msg, - int msg_len); -static void cpg_confchg_callback(cpg_handle_t handle, - struct cpg_name *groupName, - struct cpg_address *member_list, int member_list_entries, - struct cpg_address *left_list, int left_list_entries, - struct cpg_address *joined_list, int joined_list_entries); + size_t msg_len); +static void openais_cpg_confchg_callback(cpg_handle_t handle, + const struct cpg_name *groupName, + const struct cpg_address *member_list, size_t member_list_entries, + const struct cpg_address *left_list, size_t left_list_entries, + const struct cpg_address *joined_list, size_t joined_list_entries); + static void _cluster_closedown(void); /* Hash list of nodes in the cluster */ @@ -85,9 +88,9 @@ static struct cpg_name cpg_group_name; /* Openais callback structs */ -cpg_callbacks_t cpg_callbacks = { - .cpg_deliver_fn = cpg_deliver_callback, - .cpg_confchg_fn = cpg_confchg_callback, +cpg_callbacks_t openais_cpg_callbacks = { + .cpg_deliver_fn = openais_cpg_deliver_callback, + .cpg_confchg_fn = openais_cpg_confchg_callback, }; struct node_info @@ -230,12 +233,12 @@ return 0; } -static void cpg_deliver_callback (cpg_handle_t handle, - struct cpg_name *groupName, +static void openais_cpg_deliver_callback (cpg_handle_t handle, + const struct cpg_name *groupName, uint32_t nodeid, uint32_t pid, void *msg, - int msg_len) + size_t msg_len) { int target_nodeid; @@ -250,11 +253,11 @@ msg_len-OPENAIS_CSID_LEN, (char*)&nodeid); } -static void cpg_confchg_callback(cpg_handle_t handle, - struct cpg_name *groupName, - struct cpg_address *member_list, int member_list_entries, - struct cpg_address *left_list, int left_list_entries, - struct cpg_address *joined_list, int joined_list_entries) +static void openais_cpg_confchg_callback(cpg_handle_t handle, + const struct cpg_name *groupName, + const struct cpg_address *member_list, size_t member_list_entries, + const struct cpg_address *left_list, size_t left_list_entries, + const struct cpg_address *joined_list, size_t joined_list_entries) { int i; struct node_info *ninfo; @@ -330,7 +333,7 @@ lock_hash = dm_hash_create(10); err = cpg_initialize(&cpg_handle, - &cpg_callbacks); + &openais_cpg_callbacks); if (err != SA_AIS_OK) { syslog(LOG_ERR, "Cannot initialise OpenAIS CPG service: %d", err); @@ -342,7 +345,7 @@ NULL, &ver); if (err != SA_AIS_OK) { - cpg_initialize(&cpg_handle, &cpg_callbacks); + cpg_initialize(&cpg_handle, &openais_cpg_callbacks); syslog(LOG_ERR, "Cannot initialise OpenAIS lock service: %d", err); DEBUGLOG("Cannot initialise OpenAIS lock service: %d\n\n", err); --- LVM2/lib/misc/configure.h.in 2009/07/31 11:49:53 1.10 +++ LVM2/lib/misc/configure.h.in 2009/08/28 19:22:05 1.11 @@ -45,6 +45,12 @@ /* Define to 1 if canonicalize_file_name is available. */ #undef HAVE_CANONICALIZE_FILE_NAME +/* Define to 1 if you have the header file. */ +#undef HAVE_CCS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_COROSYNC_CONFDB_H + /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H @@ -90,12 +96,21 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBCMAN_H + /* Define to 1 if dynamic libraries are available. */ #undef HAVE_LIBDL +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBDLM_H + /* Define to 1 if you have the header file. */ #undef HAVE_LIBGEN_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBGULM_H + /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H From agk@sourceware.org Fri Aug 28 20:05:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 28 Aug 2009 20:05:00 -0000 Subject: LVM2/daemons/cmirrord Message-ID: <20090828200457.18054.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-28 20:04:57 LVM2/daemons/cmirrord Update of /cvs/lvm2/LVM2/daemons/cmirrord In directory sourceware.org:/tmp/cvs-serv17966/cmirrord Log Message: Directory /cvs/lvm2/LVM2/daemons/cmirrord added to the repository From agk@sourceware.org Fri Aug 28 20:51:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 28 Aug 2009 20:51:00 -0000 Subject: LVM2 ./WHATS_NEW ./configure ./configure.in da ... Message-ID: <20090828205142.11856.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-08-28 20:51:41 Modified files: . : WHATS_NEW configure configure.in daemons : Makefile.in daemons/clogd : Makefile.in clogd.c lib/misc : configure.h.in Log message: change clogd to cmirrord make pidfile locn configurable Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1245&r2=1.1246 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.diff?cvsroot=lvm2&r1=1.101&r2=1.102 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.108&r2=1.109 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/Makefile.in.diff?cvsroot=lvm2&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/Makefile.in.diff?cvsroot=lvm2&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/clogd.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/configure.h.in.diff?cvsroot=lvm2&r1=1.11&r2=1.12 --- LVM2/WHATS_NEW 2009/08/28 19:22:05 1.1245 +++ LVM2/WHATS_NEW 2009/08/28 20:51:40 1.1246 @@ -5,7 +5,7 @@ Fix pvcreate string termination in duplicate uuid warning message. Fix pvcreate on a partition (2.02.51). Fix vgcfgrestore error paths when locking fails (2.02.49). - Added configure --enable-clogd to conditionally build the cluster log daemon. + Added configure --enable-cmirrord to build the cluster mirror log daemon. Make lvchange --refresh only take a read lock on volume group. Fix bug where non-blocking file locks could be granted in error. Make lvm2app pv_t, lv_t, vg_t handle definitions consistent with lvm_t. --- LVM2/configure 2009/08/28 19:22:05 1.101 +++ LVM2/configure 2009/08/28 20:51:40 1.102 @@ -688,13 +688,13 @@ COPTIMISE_FLAG CONFDIR CMDLIB -CLOGD CLVMD CLUSTER CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE CLDFLAGS BUILD_DMEVENTD +BUILD_CMIRRORD APPLIB MODPROBE_CMD MSGFMT @@ -814,7 +814,8 @@ enable_readline enable_realtime with_clvmd -enable_clogd +enable_cmirrord +with_cmirrord_pidfile enable_debug with_optimisation enable_profiling @@ -1502,7 +1503,7 @@ device-mapper is missing from the kernel --disable-readline Disable readline support --disable-realtime Disable realtime clock support - --enable-clogd Enable the cluster log daemon + --enable-cmirrord Enable the cluster mirror log daemon --enable-debug Enable debugging --enable-profiling Gather gcov profiling data --disable-devmapper Disable LVM2 device-mapper interaction @@ -1545,6 +1546,7 @@ * all (autodetect) * none (disable build) TYPE=none + --with-cmirrord-pidfile=PATH cmirrord pidfile [/var/run/cmirrord.pid] --with-optimisation=OPT C optimisation flag [OPT=-O2] --with-localedir=DIR Translation files in DIR [PREFIX/share/locale] --with-confdir=DIR Configuration files in DIR [/etc] @@ -11653,19 +11655,45 @@ fi ################################################################################ -{ $as_echo "$as_me:$LINENO: checking whether to build cluster log daemon" >&5 -$as_echo_n "checking whether to build cluster log daemon... " >&6; } -# Check whether --enable-clogd was given. -if test "${enable_clogd+set}" = set; then - enableval=$enable_clogd; CLOGD=$enableval +{ $as_echo "$as_me:$LINENO: checking whether to build cluster mirror log daemon" >&5 +$as_echo_n "checking whether to build cluster mirror log daemon... " >&6; } +# Check whether --enable-cmirrord was given. +if test "${enable_cmirrord+set}" = set; then + enableval=$enable_cmirrord; CMIRRORD=$enableval +else + CMIRRORD=no fi -{ $as_echo "$as_me:$LINENO: result: $CLOGD" >&5 -$as_echo "$CLOGD" >&6; } +{ $as_echo "$as_me:$LINENO: result: $CMIRRORD" >&5 +$as_echo "$CMIRRORD" >&6; } + +BUILD_CMIRRORD=$CMIRRORD + +################################################################################ + -if [ "x$CLOGD" = xall -o `expr x"$CLOGD" : '.*corosync.*'` != 0 ]; then +if test "x$BUILD_CMIRRORD" = xyes; then + +# Check whether --with-cmirrord-pidfile was given. +if test "${with_cmirrord_pidfile+set}" = set; then + withval=$with_cmirrord_pidfile; cat >>confdefs.h <<_ACEOF +#define CMIRRORD_PIDFILE "$withval" +_ACEOF + +else + cat >>confdefs.h <<_ACEOF +#define CMIRRORD_PIDFILE "/var/run/cmirrord.pid" +_ACEOF + +fi + +fi + +################################################################################ +if [ "x$BUILD_CMIRRORD" = xyes ]; then # # FIXME: ALSO NEED TO CHECK FOR CHECKPOINT MODULE +# FIXME: Merge this with the new clvmd logic # pkg_failed=no --- LVM2/configure.in 2009/08/28 19:22:05 1.108 +++ LVM2/configure.in 2009/08/28 20:51:40 1.109 @@ -550,16 +550,30 @@ fi ################################################################################ -dnl -- Build cluster log daemon -AC_MSG_CHECKING(whether to build cluster log daemon) -AC_ARG_ENABLE(clogd, [ --enable-clogd Enable the cluster log daemon], -CLOGD=$enableval) -AC_MSG_RESULT($CLOGD) +dnl -- Build cluster mirror log daemon +AC_MSG_CHECKING(whether to build cluster mirror log daemon) +AC_ARG_ENABLE(cmirrord, [ --enable-cmirrord Enable the cluster mirror log daemon], +CMIRRORD=$enableval, CMIRRORD=no) +AC_MSG_RESULT($CMIRRORD) + +BUILD_CMIRRORD=$CMIRRORD + +################################################################################ +dnl -- cmirrord pidfile +AH_TEMPLATE(CMIRRORD_PIDFILE, [Path to cmirrord pidfile.]) +if test "x$BUILD_CMIRRORD" = xyes; then + AC_ARG_WITH(cmirrord-pidfile, + [ --with-cmirrord-pidfile=PATH cmirrord pidfile [[/var/run/cmirrord.pid]] ], + [ AC_DEFINE_UNQUOTED(CMIRRORD_PIDFILE,"$withval") ], + [ AC_DEFINE_UNQUOTED(CMIRRORD_PIDFILE,"/var/run/cmirrord.pid") ]) +fi +################################################################################ dnl -- Look for corosync libraries if required. -if [[ "x$CLOGD" = xall -o `expr x"$CLOGD" : '.*corosync.*'` != 0 ]]; then +if [[ "x$BUILD_CMIRRORD" = xyes ]]; then # # FIXME: ALSO NEED TO CHECK FOR CHECKPOINT MODULE +# FIXME: Merge this with the new clvmd logic # PKG_CHECK_MODULES(CPG, libcpg, [], [AC_MSG_RESULT([no pkg for libcpg library, using -lcpg]); @@ -1007,6 +1021,7 @@ ################################################################################ AC_SUBST(APPLIB) +AC_SUBST(BUILD_CMIRRORD) AC_SUBST(BUILD_DMEVENTD) AC_SUBST(CCS_CFLAGS) AC_SUBST(CCS_LIBS) @@ -1017,7 +1032,6 @@ AC_SUBST(CLDWHOLEARCHIVE) AC_SUBST(CLUSTER) AC_SUBST(CLVMD) -AC_SUBST(CLOGD) AC_SUBST(CMAN_CFLAGS) AC_SUBST(CMAN_LIBS) AC_SUBST(CMDLIB) --- LVM2/daemons/Makefile.in 2009/08/13 16:34:07 1.8 +++ LVM2/daemons/Makefile.in 2009/08/28 20:51:40 1.9 @@ -21,16 +21,16 @@ SUBDIRS = clvmd endif -ifeq ("@CLOGD@", "yes") - SUBDIRS += clogd +ifeq ("@BUILD_CMIRRORD@", "yes") + SUBDIRS += cmirrord endif -ifeq ("@DMEVENTD@", "yes") +ifeq ("@BUILD_DMEVENTD@", "yes") SUBDIRS += dmeventd endif include $(top_srcdir)/make.tmpl -ifeq ("@DMEVENTD@", "yes") +ifeq ("@BUILD_DMEVENTD@", "yes") device-mapper: dmeventd.device-mapper endif --- LVM2/daemons/clogd/Makefile.in 2009/08/13 20:51:41 1.1 +++ LVM2/daemons/clogd/Makefile.in 2009/08/28 20:51:41 1.2 @@ -17,22 +17,17 @@ SOURCES = clogd.c cluster.c functions.c link_mon.c local.c logging.c -ifeq ("@DEBUG@", "yes") - DEFS += -DDEBUG -endif - -TARGETS = clogd +TARGETS = cmirrord include $(top_srcdir)/make.tmpl LDFLAGS += -L$(usrlibdir)/openais LIBS += -lcpg -lSaCkpt -ldevmapper -clogd: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a - echo $(LIBS) - $(CC) -o clogd $(OBJECTS) $(CFLAGS) $(LDFLAGS) \ +cmirrord: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a + $(CC) -o cmirrord $(OBJECTS) $(CFLAGS) $(LDFLAGS) \ $(LVMLIBS) $(LMLIBS) $(LIBS) install: $(TARGETS) - $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) clogd \ - $(usrsbindir)/clogd + $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) cmirrord \ + $(usrsbindir)/cmirrord --- LVM2/daemons/clogd/clogd.c 2009/08/13 16:34:07 1.4 +++ LVM2/daemons/clogd/clogd.c 2009/08/28 20:51:41 1.5 @@ -52,7 +52,7 @@ /* Parent can now exit, we're ready to handle requests */ kill(getppid(), SIGTERM); - LOG_PRINT("Starting clogd:"); + LOG_PRINT("Starting cmirrord:"); LOG_PRINT(" Built: "__DATE__" "__TIME__"\n"); LOG_DBG(" Compiled with debugging."); @@ -233,9 +233,9 @@ open("/dev/null", O_WRONLY); /* reopen stdout */ open("/dev/null", O_WRONLY); /* reopen stderr */ - LOG_OPEN("clogd", LOG_PID, LOG_DAEMON); + LOG_OPEN("cmirrord", LOG_PID, LOG_DAEMON); - if (create_lockfile("/var/run/clogd.pid")) + if (create_lockfile(CMIRRORD_PIDFILE)) exit(EXIT_LOCKFILE); signal(SIGINT, &sig_handler); --- LVM2/lib/misc/configure.h.in 2009/08/28 19:22:05 1.11 +++ LVM2/lib/misc/configure.h.in 2009/08/28 20:51:41 1.12 @@ -6,6 +6,9 @@ /* Define to 1 to include built-in support for clustered LVM locking. */ #undef CLUSTER_LOCKING_INTERNAL +/* Path to cmirrord pidfile. */ +#undef CMIRRORD_PIDFILE + /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */