summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2017-10-17 13:45:53 -0500
committerDavid Teigland <teigland@redhat.com>2017-10-17 13:45:53 -0500
commit1b319f39d6692a6770493d5f751ebbb9062164fc (patch)
treecea58601209091911a1938f6a1b2c0c6a5ef1f38
parent146745ad88abc0512650b5b40d00ca587784ca36 (diff)
downloadlvm2-1b319f39d6692a6770493d5f751ebbb9062164fc.tar.gz
lvmlockd: check error for sanlock access to lvmlock LV
When the sanlock daemon does not have permission to access the lvmlock LV, make the error messages more helpful.
-rw-r--r--daemons/lvmlockd/lvmlockd-client.h1
-rw-r--r--daemons/lvmlockd/lvmlockd-sanlock.c19
-rw-r--r--lib/locking/lvmlockd.c4
3 files changed, 18 insertions, 6 deletions
diff --git a/daemons/lvmlockd/lvmlockd-client.h b/daemons/lvmlockd/lvmlockd-client.h
index 67fcbe35f..1d423388e 100644
--- a/daemons/lvmlockd/lvmlockd-client.h
+++ b/daemons/lvmlockd/lvmlockd-client.h
@@ -48,5 +48,6 @@ static inline void lvmlockd_close(daemon_handle h)
#define EVGKILLED 217 /* sanlock lost access to leases and VG is killed. */
#define ELOCKIO 218 /* sanlock io errors during lock op, may be transient. */
#define EREMOVED 219
+#define EDEVOPEN 220 /* sanlock failed to open lvmlock LV */
#endif /* _LVM_LVMLOCKD_CLIENT_H */
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index a10d02f07..0e8191581 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -356,12 +356,19 @@ int lm_init_vg_sanlock(char *ls_name, char *vg_name, uint32_t flags, char *vg_ar
log_debug("sanlock daemon version %08x proto %08x",
daemon_version, daemon_proto);
- align_size = sanlock_align(&disk);
- if (align_size <= 0) {
- log_error("S %s init_vg_san bad disk align size %d %s",
- ls_name, align_size, disk.path);
- return -EARGS;
- }
+ rv = sanlock_align(&disk);
+ if (rv <= 0) {
+ if (rv == -EACCES) {
+ log_error("S %s init_vg_san sanlock error -EACCES: no permission to access %s",
+ ls_name, disk.path);
+ return -EDEVOPEN;
+ } else {
+ log_error("S %s init_vg_san sanlock error %d trying to get align size of %s",
+ ls_name, rv, disk.path);
+ return -EARGS;
+ }
+ } else
+ align_size = rv;
strncpy(ss.name, ls_name, SANLK_NAME_LEN);
memcpy(ss.host_id_disk.path, disk.path, SANLK_PATH_LEN);
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 0f2b16050..cf2c3d5a6 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -667,6 +667,10 @@ static int _init_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg, in
case -EARGS:
log_error("VG %s init failed: invalid parameters for sanlock", vg->name);
break;
+ case -EDEVOPEN:
+ log_error("VG %s init failed: sanlock cannot open device /dev/mapper/%s-%s", vg->name, vg->name, LOCKD_SANLOCK_LV_NAME);
+ log_error("Check that sanlock has permission to access disks.");
+ break;
case -EMANAGER:
log_error("VG %s init failed: lock manager sanlock is not running", vg->name);
break;