Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=664fa6d1be10a807…
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);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e79325308454814d…
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;