diff --git a/WHATS_NEW b/WHATS_NEW index e5949cda3..61a331516 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -4,31 +4,32 @@ Version 2.02.52 - 15th September 2009 Add lots of missing stack debug messages to tools. Make readonly locking available as locking type 4. Fix readonly locking to permit writeable global locks (for vgscan). (2.02.49) - Add lvm_vg_is_clustered, lvm_vg_is_exported, and lvm_vg_is_partial. - Add DM_UDEV_RULES_VSN udev enviroment variable. - Add libudev configuration check. - Add lvm2app.sh to nightly tests conditional upon configure --enable-applib. - Update lvm_vg_remove to require lvm_vg_write to commit remove to disk. - Enforce an alphabetical lock ordering for vgname locks. - Refactor vgsplit, vgmerge, and vgrename to obey vgname ordering rules. - Implement write lock prioritisation for file locking and make it default. - Fix clvmd autodetection check and cleanup related configure messages. - Fix Makefile distclean target. - Make clvmd check corosync to see what cluster interface it should use. - Rewrite clvmd configuration code to cope with all combinations of libs. + Add DM_UDEV_RULES_VSN environment variable to udev rules. + Update vgsplit, vgmerge, and vgrename to obey new vgname ordering rules. + Make lvm2app pv_t, lv_t, vg_t handle definitions consistent with lvm_t. + Enforce an alphabetical lock ordering on vgname locking. + Prioritise write locks over read locks by default for file locking. + Add local lock files with suffix ':aux' to serialise locking requests. 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). + Don't loop reading sysfs with pvcreate on a non-blkext partition (2.02.51). Fix vgcfgrestore error paths when locking fails (2.02.49). + Update Makefile distclean target. + Add libudev configuration check. + Make clvmd check corosync to see what cluster interface it should use. + Add clvmd autodetection check and cleanup related configure messages. + Rewrite clvmd configuration code to cope with all combinations of libs. Added configure --enable-cmirrord to build the cluster mirror log daemon. Rename clogd to cmirrord. 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 race where non-blocking file locks could be granted in error. 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. + Clarify use of PE ranges in lv{convert|create|extend|resize} man pages. Remove useless _pv_write wrapper. + Add lvm2app.sh to tests conditional upon configure --enable-applib. + Add lvm_vg_is_clustered, lvm_vg_is_exported, and lvm_vg_is_partial. + Update lvm_vg_remove to require lvm_vg_write to commit remove to disk. Update test/api/test.c to call lvm_vg_create and lvm_vg_remove. Version 2.02.51 - 6th August 2009 diff --git a/doc/example.conf b/doc/example.conf index 43636edc2..bb400694b 100644 --- a/doc/example.conf +++ b/doc/example.conf @@ -266,6 +266,8 @@ global { # if LVM2 commands get run concurrently). # Type 2 uses the external shared library locking_library. # Type 3 uses built-in clustered locking. + # Type 4 uses read-only locking which forbids any operations that might + # change metadata. locking_type = 1 # Set to 0 to fail when a lock request cannot be satisfied immediately. @@ -288,11 +290,13 @@ global { # in progress. A directory like /tmp that may get wiped on reboot is OK. locking_dir = "/var/lock/lvm" - # Whenever a read-only and read-write access compete on a single volume - # group, ensure that the write lock gets priority over the read lock. - # Without this setting, write access may be stalled by high volume of - # read-only traffic on LVM metadata. NB. This option only affects - # locking_type = 1, i.e. local file-based locking. + # Whenever there are competing read-only and read-write access requests for + # a volume group's metadata, instead of always granting the read-only + # requests immediately, delay them to allow the read-write requests to be + # serviced. Without this setting, write access may be stalled by a high + # volume of read-only requests. + # NB. This option only affects locking_type = 1 viz. local file-based + # locking. prioritise_write_locks = 1 # Other entries can go here to allow you to load shared libraries diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 74b66e458..b64077c37 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -192,11 +192,12 @@ void lvmcache_drop_metadata(const char *vgname) */ static int _vgname_order_correct(const char *vgname1, const char *vgname2) { - if ((*vgname1 == '#')|(*vgname2 == '#')) + if ((*vgname1 == '#') || (*vgname2 == '#')) return 1; if (strcmp(vgname1, vgname2) < 0) return 1; + return 0; } @@ -214,7 +215,9 @@ int lvmcache_verify_lock_order(const char *vgname) dm_hash_iterate(n, _lock_hash) { if (!dm_hash_get_data(_lock_hash, n)) return_0; + vgname2 = dm_hash_get_key(_lock_hash, n); + if (!_vgname_order_correct(vgname2, vgname)) { log_errno(EDEADLK, "Internal error: VG lock %s must " "be requested before %s, not after.", @@ -222,6 +225,7 @@ int lvmcache_verify_lock_order(const char *vgname) return_0; } } + return 1; } diff --git a/man/lvm.conf.5.in b/man/lvm.conf.5.in index 6f03507b2..9cc05e8ac 100644 --- a/man/lvm.conf.5.in +++ b/man/lvm.conf.5.in @@ -286,6 +286,8 @@ If set to 2, the tools will load the external \fBlocking_library\fP (see below). If the tools were configured \fB--with-cluster=internal\fP (the default) then 3 means to use built-in cluster-wide locking. +Type 4 enforces read-only metadata and forbids any operations that +might want to modify Volume Group metadata. All changes to logical volumes and their states are communicated using locks. .IP diff --git a/tools/toollib.c b/tools/toollib.c index cb1ebf619..afecaea80 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -434,10 +434,10 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, vg = vg_read(cmd, vg_name, vgid, flags); /* Allow FAILED_INCONSISTENT through only for vgcfgrestore */ if (vg_read_error(vg) && - !((vg_read_error(vg) == FAILED_INCONSISTENT)&&(flags & READ_ALLOW_INCONSISTENT))) { + !((vg_read_error(vg) == FAILED_INCONSISTENT) && + (flags & READ_ALLOW_INCONSISTENT))) { ret_max = ECMD_FAILED; - stack; - goto out; + goto_out; } if (!dm_list_empty(tags)) {