master - systemd: remove ExecStartPost from lvm2-lvmetad.service.
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7a64fff9482786...
Commit: 7a64fff948278604d287ac96d9783a6b896de99b
Parent: ee4c75c8b790001cb05d85a44b2a894a91f4ba05
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Oct 8 16:49:54 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Oct 8 16:49:54 2012 +0200
systemd: remove ExecStartPost from lvm2-lvmetad.service.
The ExecStartPost with pvscan --cache in lvm2-lvmetad.service
is not needed now as this is called transparently within the
first LVM command that queries lvmetad.
---
WHATS_NEW | 1 +
scripts/lvm2_lvmetad_systemd_red_hat.service.in | 1 -
2 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 004f8b1..cf1b563 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.98 -
=================================
+ Remove ExecStartPost with pvscan --cache from lvm2-lvmetad.service.
Report invalid percentage for property snap_percent of non-snaphot LVs.
Disallow convertion of thins to mirrors.
Fix lvm2api data_percent reporting for thin volumes.
diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.service.in b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
index e527369..0150726 100644
--- a/scripts/lvm2_lvmetad_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
@@ -10,7 +10,6 @@ Conflicts=shutdown.target
Type=forking
NonBlocking=true
ExecStart=@sbindir@/lvmetad
-ExecStartPost=@sbindir@/lvm pvscan --cache
ExecReload=@sbindir@/lvmetad -R
Environment=SD_ACTIVATION=1
Restart=on-abort
11 years, 6 months
master - dev-cache: Make dev_iter_create work with a NULL filter.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ee4c75c8b79000...
Commit: ee4c75c8b790001cb05d85a44b2a894a91f4ba05
Parent: 3877ccfe1bdbd0d2690d7488fcea42fac53fcb50
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Oct 8 16:16:58 2012 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Mon Oct 8 16:18:10 2012 +0200
dev-cache: Make dev_iter_create work with a NULL filter.
---
lib/device/dev-cache.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 79b3028..44a9e27 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -971,8 +971,12 @@ struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan)
if (dev_scan && !trust_cache()) {
/* Flag gets reset between each command */
- if (!full_scan_done() && f && f->wipe)
- f->wipe(f); /* Calls _full_scan(1) */
+ if (!full_scan_done()) {
+ if (f && f->wipe)
+ f->wipe(f); /* Calls _full_scan(1) */
+ else
+ _full_scan(1);
+ }
} else
_full_scan(0);
11 years, 6 months
master - test: move raid test to separate tests
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3877ccfe1bdbd0...
Commit: 3877ccfe1bdbd0d2690d7488fcea42fac53fcb50
Parent: 582a344cd68d663917928edba3cc76510941322d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 8 14:46:44 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 8 14:49:21 2012 +0200
test: move raid test to separate tests
Revert changes to origin lvcreate-large test and use separate
test scripts for raid - so they can be properly skipped when
kernel doesn't support raid targets.
---
test/shell/lvcreate-large-raid.sh | 71 +++++++++++++++++++++++++++++++++++
test/shell/lvcreate-large-raid10.sh | 40 +++++++++++++++++++
test/shell/lvcreate-large.sh | 65 ++++---------------------------
3 files changed, 120 insertions(+), 56 deletions(-)
diff --git a/test/shell/lvcreate-large-raid.sh b/test/shell/lvcreate-large-raid.sh
new file mode 100644
index 0000000..8768bb3
--- /dev/null
+++ b/test/shell/lvcreate-large-raid.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# 'Exercise some lvcreate diagnostics'
+
+. lib/test
+
+aux target_at_least dm-raid 1 1 0 || skip
+
+aux prepare_vg 5
+
+lvcreate -s -l 20%FREE -n $lv1 $vg --virtualsize 256T
+lvcreate -s -l 20%FREE -n $lv2 $vg --virtualsize 256T
+lvcreate -s -l 20%FREE -n $lv3 $vg --virtualsize 256T
+lvcreate -s -l 20%FREE -n $lv4 $vg --virtualsize 256T
+lvcreate -s -l 20%FREE -n $lv5 $vg --virtualsize 256T
+
+#FIXME this should be 1024T
+#check lv_field $vg/$lv size "128.00m"
+
+aux lvmconf 'devices/filter = [ "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
+
+pvcreate $DM_DEV_DIR/$vg/$lv[12345]
+vgcreate -c n $vg1 $DM_DEV_DIR/$vg/$lv[12345]
+
+# bz837927 START
+
+#
+# Create large RAID LVs
+#
+# We need '--nosync' or our virtual devices won't work
+lvcreate --type raid1 -m 1 -L 200T -n $lv1 $vg1 --nosync
+check lv_field $vg1/$lv1 size "200.00t"
+lvremove -ff $vg1
+
+for segtype in raid4 raid5 raid6; do
+ lvcreate --type $segtype -i 3 -L 750T -n $lv1 $vg1 --nosync
+ check lv_field $vg1/$lv1 size "750.00t"
+ lvremove -ff $vg1
+done
+
+#
+# Convert large linear to RAID1 (belong in different test script?)
+#
+lvcreate -L 200T -n $lv1 $vg1
+# Need to deactivate or the up-convert will start sync'ing
+lvchange -an $vg1/$lv1
+lvconvert --type raid1 -m 1 $vg1/$lv1
+check lv_field $vg1/$lv1 size "200.00t"
+lvremove -ff $vg1
+
+#
+# Extending large RAID LV (belong in different script?)
+#
+lvcreate --type raid1 -m 1 -L 200T -n $lv1 $vg1 --nosync
+check lv_field $vg1/$lv1 size "200.00t"
+lvextend -L +200T $vg1/$lv1
+check lv_field $vg1/$lv1 size "400.00t"
+lvremove -ff $vg1
+
+# bz837927 END
+
+lvremove -ff $vg
diff --git a/test/shell/lvcreate-large-raid10.sh b/test/shell/lvcreate-large-raid10.sh
new file mode 100644
index 0000000..c9d4a2a
--- /dev/null
+++ b/test/shell/lvcreate-large-raid10.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# 'Exercise some lvcreate diagnostics'
+
+. lib/test
+
+aux target_at_least dm-raid 1 3 0 || skip
+
+aux prepare_vg 5
+
+lvcreate -s -l 20%FREE -n $lv1 $vg --virtualsize 256T
+lvcreate -s -l 20%FREE -n $lv2 $vg --virtualsize 256T
+lvcreate -s -l 20%FREE -n $lv3 $vg --virtualsize 256T
+lvcreate -s -l 20%FREE -n $lv4 $vg --virtualsize 256T
+lvcreate -s -l 20%FREE -n $lv5 $vg --virtualsize 256T
+
+aux lvmconf 'devices/filter = [ "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
+
+pvcreate $DM_DEV_DIR/$vg/$lv[12345]
+vgcreate -c n $vg1 $DM_DEV_DIR/$vg/$lv[12345]
+
+#
+# Create large RAID LVs
+#
+# We need '--nosync' or our virtual devices won't work
+
+lvcreate --type raid10 -m 1 -i 2 -L 200T -n $lv1 $vg1 --nosync
+check lv_field $vg1/$lv1 size "200.00t"
+lvremove -ff $vg1
+
+lvremove -ff $vg
diff --git a/test/shell/lvcreate-large.sh b/test/shell/lvcreate-large.sh
index 127b434..b61ccca 100644
--- a/test/shell/lvcreate-large.sh
+++ b/test/shell/lvcreate-large.sh
@@ -13,75 +13,28 @@
. lib/test
-aux prepare_vg 5
+aux prepare_vg 4
-lvcreate -s -l 20%FREE -n $lv1 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv2 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv3 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv4 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv5 $vg --virtualsize 256T
+lvcreate -s -l 100%FREE -n $lv $vg --virtualsize 1024T
#FIXME this should be 1024T
#check lv_field $vg/$lv size "128.00m"
aux lvmconf 'devices/filter = [ "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
-pvcreate $DM_DEV_DIR/$vg/$lv[12345]
-vgcreate -c n $vg1 $DM_DEV_DIR/$vg/$lv[12345]
+pvcreate $DM_DEV_DIR/$vg/$lv
+vgcreate -c n $vg1 $DM_DEV_DIR/$vg/$lv
lvcreate -l 100%FREE -n $lv1 $vg1
-check lv_field $vg1/$lv1 size "1.25p"
+check lv_field $vg1/$lv1 size "1024.00t"
lvresize -f -l 72%VG $vg1/$lv1
-check lv_field $vg1/$lv1 size "921.60t"
+check lv_field $vg1/$lv1 size "737.28t"
lvremove -ff $vg1/$lv1
lvcreate -l 100%VG -n $lv1 $vg1
-check lv_field $vg1/$lv1 size "1.25p"
+check lv_field $vg1/$lv1 size "1024.00t"
lvresize -f -l 72%VG $vg1/$lv1
-check lv_field $vg1/$lv1 size "921.60t"
+check lv_field $vg1/$lv1 size "737.28t"
lvremove -ff $vg1/$lv1
-if aux target_at_least dm-raid 1 1 0; then
- # bz837927 START
-
- #
- # Create large RAID LVs
- #
- # We need '--nosync' or our virtual devices won't work
- lvcreate --type raid1 -m 1 -L 200T -n $lv1 $vg1 --nosync
- check lv_field $vg1/$lv1 size "200.00t"
- lvremove -ff $vg1
-
- lvcreate --type raid10 -m 1 -i 2 -L 200T -n $lv1 $vg1 --nosync
- check lv_field $vg1/$lv1 size "200.00t"
- lvremove -ff $vg1
-
- for segtype in raid4 raid5 raid6; do
- lvcreate --type $segtype -i 3 -L 750T -n $lv1 $vg1 --nosync
- check lv_field $vg1/$lv1 size "750.00t"
- lvremove -ff $vg1
- done
-
- #
- # Convert large linear to RAID1 (belong in different test script?)
- #
- lvcreate -L 200T -n $lv1 $vg1
- # Need to deactivate or the up-convert will start sync'ing
- lvchange -an $vg1/$lv1
- lvconvert --type raid1 -m 1 $vg1/$lv1
- check lv_field $vg1/$lv1 size "200.00t"
- lvremove -ff $vg1
-
- #
- # Extending large RAID LV (belong in different script?)
- #
- lvcreate --type raid1 -m 1 -L 200T -n $lv1 $vg1 --nosync
- check lv_field $vg1/$lv1 size "200.00t"
- lvextend -L +200T $vg1/$lv1
- check lv_field $vg1/$lv1 size "400.00t"
- lvremove -ff $vg1
-
- # bz837927 END
-fi
-
-lvremove -ff $vg
+lvremove -ff $vg/$lv
11 years, 6 months
master - lvmetad: In pvscan --cache, update the token directly.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=582a344cd68d66...
Commit: 582a344cd68d663917928edba3cc76510941322d
Parent: 40182cbd82430a127bfeac5d93f98e642c94e06b
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Oct 8 12:21:36 2012 +0200
Committer: Petr Ročkai <mornfall(a)b3.mornfall.net>
CommitterDate: Mon Oct 8 14:38:22 2012 +0200
lvmetad: In pvscan --cache, update the token directly.
---
lib/cache/lvmetad.c | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 24a6b16..b5fdc54 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -102,7 +102,6 @@ static daemon_reply _lvmetad_send(const char *id, ...)
daemon_reply repl, token_set;
daemon_request req;
int try = 0;
- char *future_token;
retry:
req = daemon_request_make(id);
@@ -118,19 +117,13 @@ retry:
daemon_request_destroy(req);
- if (!repl.error && !strcmp(daemon_reply_str(repl, "response", ""), "token_mismatch") && try < 2 && !test_mode()) {
- future_token = _lvmetad_token;
- _lvmetad_token = (char *) "update in progress";
- if (!_token_update()) goto out;
-
+ if (!repl.error && !strcmp(daemon_reply_str(repl, "response", ""), "token_mismatch") &&
+ try < 2 && !test_mode()) {
if (lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL)) {
- _lvmetad_token = future_token;
- if (!_token_update()) goto out;
+ ++ try;
+ daemon_reply_destroy(repl);
+ goto retry;
}
- _lvmetad_token = future_token;
- ++ try;
- daemon_reply_destroy(repl);
- goto retry;
}
out:
@@ -858,22 +851,28 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler)
struct device *dev;
daemon_reply reply;
int r = 1;
+ char *future_token;
if (!(iter = dev_iter_create(cmd->lvmetad_filter, 1))) {
log_error("dev_iter creation failed");
return 0;
}
+ future_token = _lvmetad_token;
+ _lvmetad_token = (char *) "update in progress";
+ if (!_token_update()) {
+ _lvmetad_token = future_token;
+ return 0;
+ }
+
reply = _lvmetad_send("pv_clear_all", NULL);
if (!_lvmetad_handle_reply(reply, "clear status on all PVs", "", NULL))
r = 0;
daemon_reply_destroy(reply);
while ((dev = dev_iter_get(iter))) {
- if (!lvmetad_pvscan_single(cmd, dev, handler)) {
+ if (!lvmetad_pvscan_single(cmd, dev, handler))
r = 0;
- break;
- }
if (sigint_caught())
break;
@@ -881,6 +880,10 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler)
dev_iter_destroy(iter);
+ _lvmetad_token = future_token;
+ if (!_token_update())
+ return 0;
+
return r;
}
11 years, 6 months
master - test: check snap_percent returns invalid
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=40182cbd82430a...
Commit: 40182cbd82430a127bfeac5d93f98e642c94e06b
Parent: ff13206c7e6f8a4246afb562338aaba879d579ad
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 8 12:07:35 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 8 12:16:54 2012 +0200
test: check snap_percent returns invalid
For thin_volumes snap_percent is meaningless.
---
test/api/thin_percent.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/test/api/thin_percent.c b/test/api/thin_percent.c
index 952346f..5338164 100644
--- a/test/api/thin_percent.c
+++ b/test/api/thin_percent.c
@@ -53,6 +53,10 @@ int main(int argc, char *argv[])
assert(v.is_valid);
assert(v.value.integer == 75 * PERCENT_1);
+ v = lvm_lv_get_property(lv, "snap_percent");
+ assert(v.is_valid);
+ assert(v.value.integer == PERCENT_INVALID);
+
lvm_vg_close(vg);
lvm_quit(handle);
11 years, 6 months
master - report: call snapshot percent with cow only
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ff13206c7e6f8a...
Commit: ff13206c7e6f8a4246afb562338aaba879d579ad
Parent: 5b07bd3f9116ade9bb5931485eaa260f5141db6b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 8 12:06:30 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 8 12:16:53 2012 +0200
report: call snapshot percent with cow only
Ensure lv_snapshot_percent is used only with snapshot LVs.
---
WHATS_NEW | 1 +
lib/report/properties.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e39a36e..004f8b1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.98 -
=================================
+ Report invalid percentage for property snap_percent of non-snaphot LVs.
Disallow convertion of thins to mirrors.
Fix lvm2api data_percent reporting for thin volumes.
Do not allow RAID LVs in a clustered volume group.
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 4129b01..c4f6ab9 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -95,8 +95,10 @@ static percent_t _copy_percent(const struct logical_volume *lv) {
static percent_t _snap_percent(const struct logical_volume *lv) {
percent_t perc;
- if (!lv_snapshot_percent(lv, &perc))
+
+ if (!lv_is_cow(lv) || !lv_snapshot_percent(lv, &perc))
perc = PERCENT_INVALID;
+
return perc;
}
11 years, 6 months
master - lvconvert: disable convertion of thin to mirrors
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5b07bd3f9116ad...
Commit: 5b07bd3f9116ade9bb5931485eaa260f5141db6b
Parent: 6e312c56adb04e709819868c6fa89f5984013a65
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 5 11:06:08 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 8 12:16:53 2012 +0200
lvconvert: disable convertion of thin to mirrors
For now this convertions is not supported, thus disabled.
The only supported conversion for now is to create mirrored thin pools
from mirrored devices.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 7 +++++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 44682a6..e39a36e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.98 -
=================================
+ Disallow convertion of thins to mirrors.
Fix lvm2api data_percent reporting for thin volumes.
Do not allow RAID LVs in a clustered volume group.
Update lvconvert to support stacking of devs for thin meta/data devs.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 41bc585..132a69d 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1494,6 +1494,13 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
return 0;
}
+ /* TODO: decide what should be done here */
+ if (lv_is_thin_type(lv)) {
+ log_error("Converting segment type for %s/%s to mirror is not yet supported.",
+ lv->vg->name, lv->name);
+ return 0;
+ }
+
/* Adjust mimage and/or log count */
if (!_lvconvert_mirrors_parse_params(cmd, lv, lp,
&old_mimage_count, &old_log_count,
11 years, 6 months
master - lvmetad: Avoid overlapping locks that could cause a deadlock (BZ 862253).
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6e312c56adb04e...
Commit: 6e312c56adb04e709819868c6fa89f5984013a65
Parent: 0dfafd77d4c5682ac9ee37f3a2a4dce92659187c
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Oct 8 09:12:51 2012 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Mon Oct 8 09:12:51 2012 +0200
lvmetad: Avoid overlapping locks that could cause a deadlock (BZ 862253).
---
daemons/lvmetad/lvmetad-core.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 0c39a77..dce7535 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -38,6 +38,7 @@ typedef struct {
struct dm_hash_table *pvid_to_vgid;
struct {
struct dm_hash_table *vg;
+ pthread_mutex_t vg_lock_map;
pthread_mutex_t pvid_to_pvmeta;
pthread_mutex_t vgid_to_metadata;
pthread_mutex_t pvid_to_vgid;
@@ -112,7 +113,7 @@ static struct dm_config_tree *lock_vg(lvmetad_state *s, const char *id) {
pthread_mutex_t *vg;
struct dm_config_tree *cft;
- lock_vgid_to_metadata(s);
+ pthread_mutex_lock(&s->lock.vg_lock_map);
vg = dm_hash_lookup(s->lock.vg, id);
if (!vg) {
pthread_mutexattr_t rec;
@@ -126,8 +127,14 @@ static struct dm_config_tree *lock_vg(lvmetad_state *s, const char *id) {
return NULL;
}
}
+ /* We never remove items from s->lock.vg => the pointer remains valid. */
+ pthread_mutex_unlock(&s->lock.vg_lock_map);
+
DEBUG(s, "locking VG %s", id);
pthread_mutex_lock(vg);
+
+ /* Protect against structure changes of the vgid_to_metadata hash. */
+ lock_vgid_to_metadata(s);
cft = dm_hash_lookup(s->vgid_to_metadata, id);
unlock_vgid_to_metadata(s);
return cft;
@@ -137,11 +144,11 @@ static void unlock_vg(lvmetad_state *s, const char *id) {
pthread_mutex_t *vg;
DEBUG(s, "unlocking VG %s", id);
- lock_vgid_to_metadata(s); /* someone might be changing the s->lock.vg structure right
- * now, so avoid stepping on each other's toes */
+ /* Protect the s->lock.vg structure from concurrent access. */
+ pthread_mutex_lock(&s->lock.vg_lock_map);
if ((vg = dm_hash_lookup(s->lock.vg, id)))
pthread_mutex_unlock(vg);
- unlock_vgid_to_metadata(s);
+ pthread_mutex_unlock(&s->lock.vg_lock_map);
}
static struct dm_config_node *pvs(struct dm_config_node *vg)
@@ -975,6 +982,7 @@ static int init(daemon_state *s)
pthread_mutex_init(&ls->lock.pvid_to_pvmeta, &rec);
pthread_mutex_init(&ls->lock.vgid_to_metadata, &rec);
pthread_mutex_init(&ls->lock.pvid_to_vgid, NULL);
+ pthread_mutex_init(&ls->lock.vg_lock_map, NULL);
pthread_mutex_init(&ls->token_lock, NULL);
create_metadata_hashes(ls);
11 years, 6 months
master - TEST: Only run the pvscan --cache test with lvmetad active.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0dfafd77d4c568...
Commit: 0dfafd77d4c5682ac9ee37f3a2a4dce92659187c
Parent: e7020732354eef05e3e1bda9c5bdf49788e49130
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Oct 8 07:23:13 2012 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Mon Oct 8 07:23:13 2012 +0200
TEST: Only run the pvscan --cache test with lvmetad active.
---
test/shell/lvmetad-pvscan-cache.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvmetad-pvscan-cache.sh b/test/shell/lvmetad-pvscan-cache.sh
index be95b38..a27b6ad 100644
--- a/test/shell/lvmetad-pvscan-cache.sh
+++ b/test/shell/lvmetad-pvscan-cache.sh
@@ -11,6 +11,8 @@
. lib/test
+test -e LOCAL_LVMETAD || skip
+
aux prepare_pvs 2
vgcreate $vg1 $dev1 $dev2
11 years, 6 months
master - TEST: Add lvmetad-pvscan-cache to check that pvscan --cache works.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e7020732354eef...
Commit: e7020732354eef05e3e1bda9c5bdf49788e49130
Parent: 7f4f7f70ce94e9692b84a3568aedfceb13466ece
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sun Oct 7 22:31:33 2012 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Sun Oct 7 22:32:32 2012 +0200
TEST: Add lvmetad-pvscan-cache to check that pvscan --cache works.
---
test/shell/lvmetad-pvscan-cache.sh | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvmetad-pvscan-cache.sh b/test/shell/lvmetad-pvscan-cache.sh
new file mode 100644
index 0000000..be95b38
--- /dev/null
+++ b/test/shell/lvmetad-pvscan-cache.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/test
+
+aux prepare_pvs 2
+
+vgcreate $vg1 $dev1 $dev2
+vgs | grep $vg1
+
+pvscan --cache
+
+vgs | grep $vg1
11 years, 6 months