master - test: pvcreate-bootloaderarea: pvcreate --restorefile --bootloaderarea not supported anymore
by Peter Rajnoha
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=aa75ca633285339a8be...
Commit: aa75ca633285339a8be50ed5e5a661ea1654f8f7
Parent: 3c978f7bcc8c7d7cb473ba718a8e44523a09d02e
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 15 14:15:41 2017 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 15 14:15:50 2017 +0200
test: pvcreate-bootloaderarea: pvcreate --restorefile --bootloaderarea not supported anymore
The fact that this combination is not supported anymore is tested
already in pvcreate-operation.sh test.
---
test/shell/pvcreate-bootloaderarea.sh | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/test/shell/pvcreate-bootloaderarea.sh b/test/shell/pvcreate-bootloaderarea.sh
index 1147a3b..f9e0929 100644
--- a/test/shell/pvcreate-bootloaderarea.sh
+++ b/test/shell/pvcreate-bootloaderarea.sh
@@ -55,7 +55,4 @@ check pv_field "$dev1" ba_start "262144"
check pv_field "$dev1" ba_size "786432"
check pv_field "$dev1" pe_start "1048576"
-# error out when restoring the PV and trying to use overlapping bootloader area
pvremove -ff "$dev1"
-not pvcreate --restorefile "$TESTDIR/vg_with_ba_backup" --uuid "$pv_uuid" --bootloaderareasize 1m "$dev1" 2>err
-grep "Bootloader area would overlap data area" err
6 years, 3 months
master - pvcreate: fix check for 2nd mda at end of disk fits if using pvcreate --restorefile
by Peter Rajnoha
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3c978f7bcc8c7d7cb47...
Commit: 3c978f7bcc8c7d7cb473ba718a8e44523a09d02e
Parent: 222e1e3acee399b0acf31565f784716d67c465a8
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 15 13:23:51 2017 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 15 13:40:25 2017 +0200
pvcreate: fix check for 2nd mda at end of disk fits if using pvcreate --restorefile
Fix code checking that the 2nd mda which is at the end of disk really
fits the available free space and avoid any DA and MDA interleaving when
we already have DA preallocated. This mainly applies when we're restoring
a PV from VG backup using pvcreate --restorefile where we may already have
some DA preallocated - this means the PV was in a VG before with already
allocated space from it (the LVs were created). Hence we need to avoid
stepping into DA - the MDA can never ever be inside in such case!
The code responsible for this calculation was already in
_text_pv_add_metadata_area fn, but it had a bug in the calculation where
we subtracted one more sector by mistake and then the code could still
incorrectly allocate the MDA inside existing DA. The patch also renames
the variable in the code so it doesn't confuse us in future.
Also, if the 2nd mda doesn't fit, don't silently continue with just 1
MDA (at the start of the disk). If 2nd mda was requested and we can't
create that due to unavailable space, error out correctly (the patch
also adds a test to shell/pvcreate-operation.sh for this case).
---
WHATS_NEW | 1 +
lib/format_text/format-text.c | 34 +++++++++++++++++-----------------
test/shell/pvcreate-operation.sh | 28 ++++++++++++++++++++++++----
3 files changed, 42 insertions(+), 21 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2e1294e..c8f072f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.174 -
=================================
+ Fix check for 2nd mda at end of disk fits if using pvcreate --restorefile.
Use maximum metadataarea size that fits with pvcreate --restorefile.
Always clear cached bootloaderarea when wiping label e.g. in pvcreate.
Disallow --bootloaderareasize with pvcreate --restorefile.
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 7db4637..e974f05 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -2078,7 +2078,7 @@ static int _text_pv_add_metadata_area(const struct format_type *fmt,
{
struct format_instance *fid = pv->fid;
const char *pvid = (const char *) (*pv->old_id.uuid ? &pv->old_id : &pv->id);
- uint64_t ba_size, pe_start, pe_end;
+ uint64_t ba_size, pe_start, first_unallocated;
uint64_t alignment, alignment_offset;
uint64_t disk_size;
uint64_t mda_start;
@@ -2213,14 +2213,24 @@ static int _text_pv_add_metadata_area(const struct format_type *fmt,
* if defined or locked. If pe_start is not defined yet, count
* with any existing MDA0. If MDA0 does not exist, just use
* LABEL_SCAN_SIZE.
+ *
+ * The first_unallocated here is the first unallocated byte
+ * beyond existing pe_end if there is any preallocated data area
+ * reserved already so we can take that as lower limit for our MDA1
+ * start calculation. If data area is not reserved yet, we set
+ * first_unallocated to 0, meaning this is not our limiting factor
+ * and we will look at other limiting factors if they exist.
+ * Of course, if we have preallocated data area, we also must
+ * have pe_start assigned too (simply, data area needs its start
+ * and end specification).
*/
- pe_end = pv->pe_count ? (pv->pe_start +
- pv->pe_count * (uint64_t)pv->pe_size - 1) << SECTOR_SHIFT
- : 0;
+ first_unallocated = pv->pe_count ? (pv->pe_start + pv->pe_count *
+ (uint64_t)pv->pe_size) << SECTOR_SHIFT
+ : 0;
if (pe_start || pe_start_locked) {
- limit = pe_end ? pe_end : pe_start;
- limit_name = pe_end ? "pe_end" : "pe_start";
+ limit = first_unallocated ? first_unallocated : pe_start;
+ limit_name = first_unallocated ? "pe_end" : "pe_start";
} else {
if ((mda = fid_get_mda_indexed(fid, pvid, ID_LEN, 0)) &&
(mdac = mda->metadata_locn)) {
@@ -2239,7 +2249,7 @@ static int _text_pv_add_metadata_area(const struct format_type *fmt,
}
}
- if (limit > disk_size)
+ if (limit >= disk_size)
goto bad;
if (mda_size > disk_size) {
@@ -2265,16 +2275,6 @@ static int _text_pv_add_metadata_area(const struct format_type *fmt,
mda_start = disk_size - mda_size;
}
}
-
- /*
- * If PV's pe_end not set yet, set it to the end of the
- * area that precedes the MDA1 we've just calculated.
- * FIXME: do we need to set this? Isn't it always set before?
- */
- /*if (!pe_end) {
- pe_end = mda_start;
- pv->pe_end = pe_end >> SECTOR_SHIFT;
- }*/
}
if (limit_applied)
diff --git a/test/shell/pvcreate-operation.sh b/test/shell/pvcreate-operation.sh
index ad80375..af1c5a2 100644
--- a/test/shell/pvcreate-operation.sh
+++ b/test/shell/pvcreate-operation.sh
@@ -149,16 +149,36 @@ grep "incompatible with restored pe_start value" err
# 300k is multiple of 600k so this should pass
pvcreate --restorefile "$backupfile" --uui "$uuid1" --dataalignment 300k --dataalignmentoffset 32k "$dev1" 2> err
not grep "incompatible with restored pe_start value" err
-rm -f "$backupfile"
# pvcreate rejects non-existent uuid given with restorefile
-not pvcreate --uuid "$uuid1" --restorefile "$backupfile" "$dev1"
+not pvcreate --uuid "$uuid2" --restorefile "$backupfile" "$dev1" 2> err
+grep "Can't find uuid $uuid2 in backup file $backupfile" err
# pvcreate rejects restorefile without uuid
-not pvcreate --restorefile "$backupfile" "$dev1"
+not pvcreate --restorefile "$backupfile" "$dev1" 2>err
+grep -- "--uuid is required with --restorefile" err
# pvcreate rejects uuid restore with multiple volumes specified
-not pvcreate --uuid "$uuid1" --restorefile "$backupfile" "$dev1" "$dev2"
+not pvcreate --uuid "$uuid1" --restorefile "$backupfile" "$dev1" "$dev2" 2>err
+grep "Can only set uuid on one volume at once" err
+
+# --bootloaderareasize not allowed with pvcreate --restorefile
+not pvcreate --uuid "$uuid1" --restorefile "$backupfile" --bootloaderareasize 1m "$dev1" "$dev2" 2>err
+grep -- "Command does not accept option combination: --bootloaderareasize with --restorefile" err
+
+rm -f "$backupfile"
+
+pvcreate --norestorefile --uuid $uuid1 "$dev1"
+vgcreate --physicalextentsize 1m $vg1 "$dev1"
+vgcfgbackup -f "$backupfile" "$vg1"
+vgremove -ff "$vg1"
+pvremove -ff "$dev1"
+
+# when 2nd mda requested on pvcreate --restorefile and not enough space for it, pvcreate fails
+not pvcreate --restorefile "$backupfile" --uuid $uuid1 --metadatacopies 2 "$dev1" 2>err
+grep "Not enough space available for metadata area with index 1 on PV $dev1" err
+
+rm -f "$backupfile"
# pvcreate wipes swap signature when forced
dd if=/dev/zero of="$dev1" bs=1024 count=64
6 years, 3 months
master - raid: more validation checks for segment data_offset member
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=222e1e3acee399b0acf...
Commit: 222e1e3acee399b0acf31565f784716d67c465a8
Parent: 42fa20d0d0136c1aeb3ccdf0654c64beeee05821
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Mon Aug 14 15:00:15 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Mon Aug 14 15:00:15 2017 +0200
raid: more validation checks for segment data_offset member
Upgrade commit fb641c342343ac48cc623c8079900b1f4f395a69 with additional checks.
---
lib/metadata/merge.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index dbe0d58..b0adc5a 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -119,7 +119,7 @@ static void _check_raid0_seg(struct lv_segment *seg, int *error_count)
raid_seg_error_val("non-zero min recovery rate", seg->min_recovery_rate);
if (seg->max_recovery_rate)
raid_seg_error_val("non-zero max recovery rate", seg->max_recovery_rate);
- if (seg->lv->status & LV_RESHAPE_DATA_OFFSET)
+ if ((seg->lv->status & LV_RESHAPE_DATA_OFFSET) || seg->data_offset)
raid_seg_error_val("data_offset", seg->data_offset);
}
@@ -143,7 +143,7 @@ static void _check_raid1_seg(struct lv_segment *seg, int *error_count)
raid_seg_error("no meta areas");
if (seg->stripe_size)
raid_seg_error_val("non-zero stripe size", seg->stripe_size);
- if (seg->lv->status & LV_RESHAPE_DATA_OFFSET)
+ if ((seg->lv->status & LV_RESHAPE_DATA_OFFSET) || seg->data_offset)
raid_seg_error_val("data_offset", seg->data_offset);
_check_raid_region_recovery(seg, error_count);
}
@@ -169,8 +169,10 @@ static void _check_raid45610_seg(struct lv_segment *seg, int *error_count)
_check_raid_region_recovery(seg, error_count);
/* END: checks applying to any raid4/5/6/10 */
- if ((seg->lv->status & LV_RESHAPE_DATA_OFFSET) &&
- (seg->data_offset & (seg->lv->vg->extent_size - 1)))
+ if (seg->lv->status & LV_RESHAPE_DATA_OFFSET) {
+ if (seg->data_offset & (seg->lv->vg->extent_size - 1))
+ raid_seg_error_val("data_offset", seg->data_offset);
+ } else if (seg->data_offset)
raid_seg_error_val("data_offset", seg->data_offset);
/* Specific checks per raid level */
6 years, 3 months
master - pvcreate: Use maximum metadata area size with --restorefile
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=42fa20d0d0136c1aeb3...
Commit: 42fa20d0d0136c1aeb3ccdf0654c64beeee05821
Parent: 4fa5add6b1bd4d7f7313f2950021a09e4130ad08
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Aug 11 20:41:37 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Aug 11 20:41:37 2017 +0100
pvcreate: Use maximum metadata area size with --restorefile
If the PV was originally created with a larger-than-default
metadata area the restored one wasn't and might not even be
large enough to hold the metadata!
---
WHATS_NEW | 1 +
tools/pvcreate.c | 9 +++++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e05fae2..2e1294e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.174 -
=================================
+ Use maximum metadataarea size that fits with pvcreate --restorefile.
Always clear cached bootloaderarea when wiping label e.g. in pvcreate.
Disallow --bootloaderareasize with pvcreate --restorefile.
Fix lvmlockd check for running lock managers during lock adoption.
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
index 0fe5ad5..9dc50e4 100644
--- a/tools/pvcreate.c
+++ b/tools/pvcreate.c
@@ -135,6 +135,15 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
if (!pvcreate_params_from_args(cmd, &pp))
return EINVALID_CMD_LINE;
+ /*
+ * If --metadatasize was not given with --restorefile, set it to pe_start.
+ * Later code treats this as a maximum size and reduces it to fit.
+ */
+ if (!arg_is_set(cmd, metadatasize_ARG) && arg_is_set(cmd, restorefile_ARG))
+ pp.pva.pvmetadatasize = pp.pva.pe_start;
+
+ /* FIXME Also needs to check any 2nd metadata area isn't inside the data area! */
+
pp.pv_count = argc;
pp.pv_names = argv;
6 years, 3 months
master - pvcreate: Wipe cached bootloaderarea when wiping label.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4fa5add6b1bd4d7f731...
Commit: 4fa5add6b1bd4d7f7313f2950021a09e4130ad08
Parent: 7d09d7288b3aaecdfba9a3a05e7697f7dcdfed79
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Aug 11 20:32:04 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Aug 11 20:32:04 2017 +0100
pvcreate: Wipe cached bootloaderarea when wiping label.
Previously the cache remembered an existing bootloaderarea and
reinstated it (without even checking for overlap) when asked to
write out the PV. pvcreate could write out an incorrect layout.
---
WHATS_NEW | 1 +
lib/label/label.c | 8 +++++++-
tools/toollib.c | 5 -----
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b21702c..e05fae2 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.174 -
=================================
+ Always clear cached bootloaderarea when wiping label e.g. in pvcreate.
Disallow --bootloaderareasize with pvcreate --restorefile.
Fix lvmlockd check for running lock managers during lock adoption.
Add --withgeneralpreamble and --withlocalpreamble to lvmconfig.
diff --git a/lib/label/label.c b/lib/label/label.c
index c5f4884..0e99517 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -202,6 +202,7 @@ int label_remove(struct device *dev)
int wipe;
struct labeller_i *li;
struct label_header *lh;
+ struct lvmcache_info *info;
memset(buf, 0, LABEL_SIZE);
@@ -245,8 +246,13 @@ int label_remove(struct device *dev)
if (wipe) {
log_very_verbose("%s: Wiping label at sector %" PRIu64,
dev_name(dev), sector);
- if (!dev_write(dev, sector << SECTOR_SHIFT, LABEL_SIZE,
+ if (dev_write(dev, sector << SECTOR_SHIFT, LABEL_SIZE,
buf)) {
+ /* Also remove the PV record from cache. */
+ info = lvmcache_info_from_pvid(dev->pvid, dev, 0);
+ if (info)
+ lvmcache_del(info);
+ } else {
log_error("Failed to remove label from %s at "
"sector %" PRIu64, dev_name(dev),
sector);
diff --git a/tools/toollib.c b/tools/toollib.c
index c2807b8..1799bc9 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -5398,7 +5398,6 @@ int pvcreate_each_device(struct cmd_context *cmd,
struct pvcreate_prompt *prompt, *prompt2;
struct physical_volume *pv;
struct volume_group *orphan_vg;
- struct lvmcache_info *info;
struct dm_list remove_duplicates;
struct dm_list arg_sort;
struct pv_list *pvl;
@@ -5811,10 +5810,6 @@ do_command:
continue;
}
- info = lvmcache_info_from_pvid(pd->pvid, pd->dev, 0);
- if (info)
- lvmcache_del(info);
-
if (!lvmetad_pv_gone_by_dev(pd->dev)) {
log_error("Failed to remove PV %s from lvmetad.", pd->name);
dm_list_move(&pp->arg_fail, &pd->list);
6 years, 3 months
master - pvcreate: Disallow --bootloaderareasize with --restorefile.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7d09d7288b3aaecdfba...
Commit: 7d09d7288b3aaecdfba9a3a05e7697f7dcdfed79
Parent: 955083e625eb003090ce8f699e8d414a215cce1f
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Aug 11 20:28:53 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Aug 11 20:28:53 2017 +0100
pvcreate: Disallow --bootloaderareasize with --restorefile.
The backup file already holds the bootloader area details to use so
don't overcomplicate things.
---
WHATS_NEW | 1 +
tools/command-lines.in | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c484529..b21702c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.174 -
=================================
+ Disallow --bootloaderareasize with pvcreate --restorefile.
Fix lvmlockd check for running lock managers during lock adoption.
Add --withgeneralpreamble and --withlocalpreamble to lvmconfig.
Improve makefiles' linking.
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 1ef234e..2f4e48f 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -1367,6 +1367,8 @@ OO: --dataalignment SizeKB, --dataalignmentoffset SizeKB, --bootloaderareasize S
--metadataignore Bool, --norestorefile, --setphysicalvolumesize SizeMB,
--reportformat ReportFmt, --restorefile String, --uuidstr String, --zero Bool
ID: pvcreate_general
+RULE: --norestorefile not --restorefile
+RULE: --bootloaderareasize not --restorefile
---
6 years, 3 months
master - commands: recognize lvm command -?
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=955083e625eb003090c...
Commit: 955083e625eb003090ce8f699e8d414a215cce1f
Parent: 8bc89658476d187a6b1d40018bbbac84d389c5be
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Aug 9 15:06:36 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Aug 9 15:06:36 2017 -0500
commands: recognize lvm command -?
and interpret it as lvm command -h
---
tools/lvmcmdline.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index cc1c297..55f72ac 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -3465,9 +3465,11 @@ int lvm2_main(int argc, char **argv)
}
}
- /* turn command -? into command -h */
+ /* turn command -? into command -h and lvm command -? into lvm command -h */
if (alias && (argc > 1) && !strcmp(argv[1], "-?"))
argv[1] = (char *)"-h";
+ if (!alias && (argc > 2) && !strcmp(argv[2], "-?"))
+ argv[2] = (char *)"-h";
if (!(cmd = init_lvm(0, 0)))
return EINIT_FAILED;
6 years, 3 months
master - commands: recognize -? for help
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8bc89658476d187a6b1...
Commit: 8bc89658476d187a6b1d40018bbbac84d389c5be
Parent: 8ecb5817c7e08a9a95a0172386af61ba3715948d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Aug 9 09:34:33 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Aug 9 09:34:33 2017 -0500
commands: recognize -? for help
It's not known when this last worked, but there has
been documentation suggesting it worked, so enable it.
---
tools/lvmcmdline.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 81cc5e0..cc1c297 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -3455,8 +3455,8 @@ int lvm2_main(int argc, char **argv)
if (!strcmp(argv[1], "version"))
return lvm_return_code(version(NULL, argc, argv));
- /* turn 'lvm -h' and 'lvm --help' into 'lvm help' */
- if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
+ /* turn 'lvm -h', 'lvm --help', 'lvm -?' into 'lvm help' */
+ if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || !strcmp(argv[1], "-?"))
argv[1] = (char *)"help";
if (*argv[1] == '-') {
@@ -3465,6 +3465,10 @@ int lvm2_main(int argc, char **argv)
}
}
+ /* turn command -? into command -h */
+ if (alias && (argc > 1) && !strcmp(argv[1], "-?"))
+ argv[1] = (char *)"-h";
+
if (!(cmd = init_lvm(0, 0)))
return EINIT_FAILED;
6 years, 3 months
master - lvmlockd: global name doesn't apply to sanlock
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8ecb5817c7e08a9a95a...
Commit: 8ecb5817c7e08a9a95a0172386af61ba3715948d
Parent: 568c7ed6f1a1df23b9843a54b0bc53816ac5f621
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Aug 7 10:43:28 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Aug 7 10:46:03 2017 -0500
lvmlockd: global name doesn't apply to sanlock
When adopting locks, we shouldn't skip the special
dlm global lockspace name when using sanlock.
---
daemons/lvmlockd/lvmlockd-core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 5f08bbf..01259c0 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -5263,7 +5263,7 @@ static void adopt_locks(void)
list_for_each_entry_safe(ls1, l1safe, &ls_found, list) {
/* The dlm global lockspace is special and doesn't match a VG. */
- if (!strcmp(ls1->name, gl_lsname_dlm)) {
+ if ((ls1->lm_type == LD_LM_DLM) && !strcmp(ls1->name, gl_lsname_dlm)) {
list_del(&ls1->list);
free(ls1);
continue;
6 years, 3 months
master - lvmlockd: fix lm running check during adoption
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=568c7ed6f1a1df23b98...
Commit: 568c7ed6f1a1df23b9843a54b0bc53816ac5f621
Parent: fe423ef583a48ca0f780156ec5f1fe33716318ad
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Aug 7 10:37:22 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Aug 7 10:45:59 2017 -0500
lvmlockd: fix lm running check during adoption
When trying to adopt locks in startup, we want to ignore
a lock manager that isn't running, not fail.
---
WHATS_NEW | 1 +
daemons/lvmlockd/lvmlockd-core.c | 11 ++++-------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ebbc7d1..c484529 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.174 -
=================================
+ Fix lvmlockd check for running lock managers during lock adoption.
Add --withgeneralpreamble and --withlocalpreamble to lvmconfig.
Improve makefiles' linking.
Fix some paths in generated makefiles to respected configured settings.
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 867e3ca..5f08bbf 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -5176,20 +5176,17 @@ static void adopt_locks(void)
* Get list of lockspaces from lock managers.
* Get list of VGs from lvmetad with a lockd type.
* Get list of active lockd type LVs from /dev.
- *
- * ECONNREFUSED means the lock manager is not running.
- * This is expected for at least one of them.
*/
- if (lm_support_dlm()) {
+ if (lm_support_dlm() && lm_is_running_dlm()) {
rv = lm_get_lockspaces_dlm(&ls_found);
- if ((rv < 0) && (rv != -ECONNREFUSED))
+ if (rv < 0)
goto fail;
}
- if (lm_support_sanlock()) {
+ if (lm_support_sanlock() && lm_is_running_sanlock()) {
rv = lm_get_lockspaces_sanlock(&ls_found);
- if ((rv < 0) && (rv != -ECONNREFUSED))
+ if (rv < 0)
goto fail;
}
6 years, 3 months