summaryrefslogtreecommitdiff
path: root/daemons/lvmlockd
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2017-11-29 14:59:11 -0600
committerDavid Teigland <teigland@redhat.com>2017-12-05 11:53:03 -0600
commitbd893348b415d4e604a7f9a503f17623d485e76e (patch)
tree4937e83db5e8f139144ff30ac2c65ffe1c67fe1f /daemons/lvmlockd
parent94632eb155a0a1814e69b1baa0516323cbbae648 (diff)
downloadlvm2-bd893348b415d4e604a7f9a503f17623d485e76e.tar.gz
lvmlockd: avoid blocking in sanlock_convert
Use the same flag as sanlock_acquire() for the same purpose. sanlock_convert can block like acquire when doing a sh to ex conversion.
Diffstat (limited to 'daemons/lvmlockd')
-rw-r--r--daemons/lvmlockd/lvmlockd-sanlock.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index 358c588a8..079e9526d 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -1688,6 +1688,16 @@ int lm_convert_sanlock(struct lockspace *ls, struct resource *r,
if (daemon_test)
return 0;
+ /*
+ * Don't block waiting for a failed lease to expire since it causes
+ * sanlock_convert to block for a long time, which would prevent this
+ * thread from processing other lock requests.
+ *
+ * FIXME: SANLK_CONVERT_OWNER_NOWAIT is the same as SANLK_ACQUIRE_OWNER_NOWAIT.
+ * Change to use the CONVERT define when the latest sanlock version has it.
+ */
+ flags |= SANLK_ACQUIRE_OWNER_NOWAIT;
+
rv = sanlock_convert(lms->sock, -1, flags, rs);
if (rv == -EAGAIN) {
/* FIXME: When could this happen? Should something different be done? */