master - vg_write: add list of pvs to write
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5e5ad77f5f89bd...
Commit: 5e5ad77f5f89bdc8a054d962a89e450900b249e7
Parent: 3ac860334b4502fca2f0c780ee968bd62733a73e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 16 12:43:24 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Feb 25 09:14:09 2016 -0600
vg_write: add list of pvs to write
The vg->pv_write_list contains pv_list structs for which
vg_write() should call pv_write().
The new list will replace vg->pvs_to_write that contains
vg_to_create structs which are used to perform higher-level
pvcreate-related operations. The higher level pvcreate
operations will be moved out of vg_write() to higher levels.
---
lib/metadata/metadata.c | 9 ++++++++-
lib/metadata/vg.c | 1 +
lib/metadata/vg.h | 4 +++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index a41c227..d3d4cab 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3146,7 +3146,8 @@ static int _check_old_pv_ext_for_vg(struct volume_group *vg)
int vg_write(struct volume_group *vg)
{
struct dm_list *mdah;
- struct pv_to_write *pv_to_write, *pv_to_write_safe;
+ struct pv_to_write *pv_to_write, *pv_to_write_safe;
+ struct pv_list *pvl, *pvl_safe;
struct metadata_area *mda;
struct lv_list *lvl;
int revert = 0, wrote = 0;
@@ -3207,6 +3208,12 @@ int vg_write(struct volume_group *vg)
memlock_unlock(vg->cmd);
vg->seqno++;
+ dm_list_iterate_items_safe(pvl, pvl_safe, &vg->pv_write_list) {
+ if (!pv_write(vg->cmd, pvl->pv, 1))
+ return_0;
+ dm_list_del(&pvl->list);
+ }
+
dm_list_iterate_items_safe(pv_to_write, pv_to_write_safe, &vg->pvs_to_write) {
if (!_pvcreate_write(vg->cmd, pv_to_write))
return_0;
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index e93108c..1456fbb 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -61,6 +61,7 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
dm_list_init(&vg->pvs);
dm_list_init(&vg->pvs_to_write);
+ dm_list_init(&vg->pv_write_list);
dm_list_init(&vg->pvs_outdated);
dm_list_init(&vg->lvs);
dm_list_init(&vg->tags);
diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h
index f6c7bcc..f41def8 100644
--- a/lib/metadata/vg.h
+++ b/lib/metadata/vg.h
@@ -91,7 +91,9 @@ struct volume_group {
* a PV label yet. They need to be pvcreate'd at vg_write time.
*/
- struct dm_list pvs_to_write;
+ struct dm_list pvs_to_write; /* struct pv_to_write */
+
+ struct dm_list pv_write_list; /* struct pv_list */
/*
* List of physical volumes that carry outdated metadata that belongs
8 years, 1 month
master - configure
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3ac860334b4502...
Commit: 3ac860334b4502fca2f0c780ee968bd62733a73e
Parent: 718a695b0c0fe0c9088758499e5daae2cb0652a2
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Feb 25 13:58:48 2016 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Feb 25 13:58:48 2016 +0000
configure
---
configure | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/configure b/configure
index 1d742ec..75967d7 100755
--- a/configure
+++ b/configure
@@ -11518,12 +11518,12 @@ if test -n "$LOCKD_SANLOCK_CFLAGS"; then
pkg_cv_LOCKD_SANLOCK_CFLAGS="$LOCKD_SANLOCK_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsanlock_client\""; } >&5
- ($PKG_CONFIG --exists --print-errors "libsanlock_client") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsanlock_client >= 3.3.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libsanlock_client >= 3.3.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_LOCKD_SANLOCK_CFLAGS=`$PKG_CONFIG --cflags "libsanlock_client" 2>/dev/null`
+ pkg_cv_LOCKD_SANLOCK_CFLAGS=`$PKG_CONFIG --cflags "libsanlock_client >= 3.3.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -11535,12 +11535,12 @@ if test -n "$LOCKD_SANLOCK_LIBS"; then
pkg_cv_LOCKD_SANLOCK_LIBS="$LOCKD_SANLOCK_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsanlock_client\""; } >&5
- ($PKG_CONFIG --exists --print-errors "libsanlock_client") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsanlock_client >= 3.3.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libsanlock_client >= 3.3.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_LOCKD_SANLOCK_LIBS=`$PKG_CONFIG --libs "libsanlock_client" 2>/dev/null`
+ pkg_cv_LOCKD_SANLOCK_LIBS=`$PKG_CONFIG --libs "libsanlock_client >= 3.3.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -11561,9 +11561,9 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- LOCKD_SANLOCK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsanlock_client" 2>&1`
+ LOCKD_SANLOCK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsanlock_client >= 3.3.0" 2>&1`
else
- LOCKD_SANLOCK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsanlock_client" 2>&1`
+ LOCKD_SANLOCK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsanlock_client >= 3.3.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LOCKD_SANLOCK_PKG_ERRORS" >&5
8 years, 1 month
master - configure: require sanlock 3.3.0
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=718a695b0c0fe0...
Commit: 718a695b0c0fe0c9088758499e5daae2cb0652a2
Parent: 664fa6d1be10a807f8edc13801b1cd62248ae76f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Feb 24 13:22:23 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Feb 24 13:22:23 2016 -0600
configure: require sanlock 3.3.0
For a sanlock flag added in that version.
---
configure.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/configure.in b/configure.in
index 7a5aa5d..e8723f4 100644
--- a/configure.in
+++ b/configure.in
@@ -1159,7 +1159,7 @@ BUILD_LOCKDSANLOCK=$LOCKDSANLOCK
dnl -- Look for sanlock libraries
if test "$BUILD_LOCKDSANLOCK" = yes; then
- PKG_CHECK_MODULES(LOCKD_SANLOCK, libsanlock_client, [HAVE_LOCKD_SANLOCK=yes], $bailout)
+ PKG_CHECK_MODULES(LOCKD_SANLOCK, libsanlock_client >= 3.3.0, [HAVE_LOCKD_SANLOCK=yes], $bailout)
AC_DEFINE([LOCKDSANLOCK_SUPPORT], 1, [Define to 1 to include code that uses lvmlockd sanlock option.])
BUILD_LVMLOCKD=yes
fi
8 years, 1 month
master - lvmlockd: use new sanlock flag to avoid blocking
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=664fa6d1be10a8...
Commit: 664fa6d1be10a807f8edc13801b1cd62248ae76f
Parent: 77f034bfa3d85600ec9b9581c17352202ce09ae8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Feb 24 10:10:59 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Feb 24 10:10:59 2016 -0600
lvmlockd: use new sanlock flag to avoid blocking
This flag allows sanlock requests to avoid all blocking.
---
daemons/lvmlockd/lvmlockd-sanlock.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index 6694652..c6534d8 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -1416,14 +1416,12 @@ int lm_lock_sanlock(struct lockspace *ls, struct resource *r, int ld_mode,
if (adopt)
flags |= SANLK_ACQUIRE_ORPHAN_ONLY;
-#ifdef SANLOCK_HAS_ACQUIRE_OWNER_NOWAIT
/*
* Don't block waiting for a failed lease to expire since it causes
* sanlock_acquire to block for a long time, which would prevent this
* thread from processing other lock requests.
*/
flags |= SANLK_ACQUIRE_OWNER_NOWAIT;
-#endif
memset(&opt, 0, sizeof(opt));
sprintf(opt.owner_name, "%s", "lvmlockd");
@@ -1498,7 +1496,6 @@ int lm_lock_sanlock(struct lockspace *ls, struct resource *r, int ld_mode,
return -EAGAIN;
}
-#ifdef SANLOCK_HAS_ACQUIRE_OWNER_NOWAIT
if (rv == SANLK_ACQUIRE_OWNED_RETRY) {
/*
* The lock is held by a failed host, and will eventually
@@ -1517,7 +1514,7 @@ int lm_lock_sanlock(struct lockspace *ls, struct resource *r, int ld_mode,
*retry = 0;
return -EAGAIN;
}
-#endif
+
if (rv < 0) {
log_error("S %s R %s lock_san acquire error %d",
ls->name, r->name, rv);
8 years, 1 month
master - tests: include lvmlockd in default make check
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=77f034bfa3d856...
Commit: 77f034bfa3d85600ec9b9581c17352202ce09ae8
Parent: e79325308454814d968dd3e06cd261a269716675
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 23 16:34:46 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Feb 23 16:34:46 2016 -0600
tests: include lvmlockd in default make check
---
test/Makefile.in | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 6ed9b9e..98f6cc9 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -54,6 +54,11 @@ LVMPOLLD_NDEV_FLAVOUR = ,ndev-lvmpolld,ndev-cluster-lvmpolld,ndev-lvmetad-lvmpol
LVMPOLLD_UDEV_FLAVOUR = ,udev-lvmpolld,udev-cluster-lvmpolld,udev-lvmetad-lvmpolld
endif
+ifeq ("@BUILD_LVMLOCKD@", "yes")
+LVMLOCKD_RUN_BASE = $(RUN_BASE)
+LVMLOCKD_UDEV_FLAVOUR = ,udev-lvmlockd-test
+endif
+
# Shell quote;
SHELL_PATH_SQ := $(subst ','\'',$(SHELL_PATH))
@@ -112,7 +117,7 @@ help:
check: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir $(LVM_TEST_RESULTS) \
- --flavours ndev-vanilla,ndev-cluster$(LVMETAD_NDEV_FLAVOUR)$(LVMPOLLD_NDEV_FLAVOUR) --only $(T) --skip $(S)
+ --flavours ndev-vanilla,ndev-cluster$(LVMETAD_NDEV_FLAVOUR)$(LVMPOLLD_NDEV_FLAVOUR)$(LVMLOCKD_UDEV_FLAVOUR) --only $(T) --skip $(S)
check_system: .tests-stamp
VERBOSE=$(VERBOSE) ./lib/runner \
8 years, 1 month
master - lvmlockd: fix sparse snapshot case
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e7932530845481...
Commit: e79325308454814d968dd3e06cd261a269716675
Parent: 79809d6cdc3a1e4dfb4466fc0e10040bd069211d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 23 15:44:14 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Feb 23 15:45:25 2016 -0600
lvmlockd: fix sparse snapshot case
A snapshot can be created without a real origin LV
in this case, so there's no lock to use.
---
lib/locking/lvmlockd.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index e78e2cb..c55f2b5 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2331,6 +2331,12 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
* represents itself and all associated cow snapshots.
*/
+ if (!lp->origin_name) {
+ /* Sparse LV case. We require a lock from the origin LV. */
+ log_error("Cannot create snapshot without origin LV in shared VG.");
+ return 0;
+ }
+
if (!(origin_lv = find_lv(vg, lp->origin_name))) {
log_error("Failed to find origin LV %s/%s", vg->name, lp->origin_name);
return 0;
8 years, 1 month
master - cleanup: use sizeof instead of macro.
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=79809d6cdc3a1e...
Commit: 79809d6cdc3a1e4dfb4466fc0e10040bd069211d
Parent: 9267e0c5e73b74177fc54dda200f012765b33673
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 23 20:19:50 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 23 21:40:17 2016 +0100
cleanup: use sizeof instead of macro.
Keep the buffer size defined at a single place and then use
its sizeof.
---
libdm/libdm-report.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 0163910..8250a35 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -889,7 +889,7 @@ static void _all_match_combine(const struct dm_report_object_type *types,
const struct dm_report_object_type *t;
size_t prefix_len;
- if (!_get_canonical_field_name(field, flen, field_canon, DM_REPORT_FIELD_TYPE_ID_LEN, NULL))
+ if (!_get_canonical_field_name(field, flen, field_canon, sizeof(field_canon), NULL))
return;
flen = strlen(field_canon);
@@ -949,7 +949,7 @@ static int _get_field(struct dm_report *rh, const char *field, size_t flen,
if (!flen)
return 0;
- if (!_get_canonical_field_name(field, flen, field_canon, DM_REPORT_FIELD_TYPE_ID_LEN, NULL))
+ if (!_get_canonical_field_name(field, flen, field_canon, sizeof(field_canon), NULL))
return_0;
for (f = 0; _implicit_report_fields[f].report_fn; f++) {
@@ -1063,7 +1063,7 @@ static int _key_match(struct dm_report *rh, const char *key, size_t len,
return 0;
}
- if (!_get_canonical_field_name(key, len, key_canon, DM_REPORT_FIELD_TYPE_ID_LEN, NULL))
+ if (!_get_canonical_field_name(key, len, key_canon, sizeof(key_canon), NULL))
return_0;
for (f = 0; _implicit_report_fields[f].report_fn; f++)
@@ -1196,7 +1196,7 @@ static int _canonicalize_field_ids(struct dm_report *rh)
for (i = 0; i < registered_field_count; i++) {
if (!_get_canonical_field_name(rh->fields[i].id, strlen(rh->fields[i].id),
- canonical_field, DM_REPORT_FIELD_TYPE_ID_LEN, &differs))
+ canonical_field, sizeof(canonical_field), &differs))
return_0;
if (differs) {
8 years, 1 month
master - cleanup: use braces around macro params
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9267e0c5e73b74...
Commit: 9267e0c5e73b74177fc54dda200f012765b33673
Parent: 63c052b9e2a69b94fea33490130e76aac9a8c735
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 23 19:51:45 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 23 21:40:17 2016 +0100
cleanup: use braces around macro params
---
lib/device/dev-type.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/device/dev-type.h b/lib/device/dev-type.h
index 75ef36f..5494511 100644
--- a/lib/device/dev-type.h
+++ b/lib/device/dev-type.h
@@ -21,9 +21,9 @@
#define NUMBER_OF_MAJORS 4096
#ifdef __linux__
-# define MAJOR(dev) ((dev & 0xfff00) >> 8)
-# define MINOR(dev) ((dev & 0xff) | ((dev >> 12) & 0xfff00))
-# define MKDEV(ma,mi) ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12))
+# define MAJOR(dev) (((dev) & 0xfff00) >> 8)
+# define MINOR(dev) (((dev) & 0xff) | (((dev) >> 12) & 0xfff00))
+# define MKDEV(ma,mi) (((mi) & 0xff) | ((ma) << 8) | (((mi) & ~0xff) << 12))
#else
# define MAJOR(x) major((x))
# define MINOR(x) minor((x))
8 years, 1 month
master - coverity: ensure thin_pool_seg is not NULL
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=63c052b9e2a69b...
Commit: 63c052b9e2a69b94fea33490130e76aac9a8c735
Parent: ddfec5b51a46faab3f64de3e07dc52e0adaf81bc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 23 21:36:51 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 23 21:40:17 2016 +0100
coverity: ensure thin_pool_seg is not NULL
thin_pool_seg being NULL would be an internal error.
---
lib/metadata/lv_manip.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 64eb6b7..5e4a81f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1662,8 +1662,10 @@ static int _setup_alloced_segment(struct logical_volume *lv, uint64_t status,
lv->size += (uint64_t) extents * lv->vg->extent_size;
if (lv_is_thin_pool_data(lv)) {
+ if (!(thin_pool_seg = get_only_segment_using_this_lv(lv)))
+ return_0;
+
/* Update thin pool segment from the layered LV */
- thin_pool_seg = get_only_segment_using_this_lv(lv);
thin_pool_seg->lv->le_count =
thin_pool_seg->len =
thin_pool_seg->area_len = lv->le_count;
8 years, 1 month
master - coverity: use same arithmetic for both major and minor
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ddfec5b51a46fa...
Commit: ddfec5b51a46faab3f64de3e07dc52e0adaf81bc
Parent: 9e3a9eab0ebf06fb5ed969269e11cb9b31d033fa
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 23 21:16:08 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 23 21:40:17 2016 +0100
coverity: use same arithmetic for both major and minor
Run all arithmetic in the same 'dev_t' type.
---
lib/activate/dev_manager.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 7ad8982..2d59cf4 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -316,7 +316,7 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
if (!(tmp_dev = dev_create_file(buf, NULL, NULL, 0)))
goto_out;
- tmp_dev->dev = MKDEV((dev_t)sm->logs[0].major, sm->logs[0].minor);
+ tmp_dev->dev = MKDEV((dev_t)sm->logs[0].major, (dev_t)sm->logs[0].minor);
if (device_is_usable(tmp_dev, (struct dev_usable_check_params)
{ .check_empty = 1,
.check_blocked = 1,
8 years, 1 month