From b90eaeb3bcff444e61ef889ad57c61fa3bd35b29 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Oct 17 2017 17:57:22 +0000 Subject: sanlock: expand access error message Make it easier to recognize disk/file permission errors. --- diff --git a/src/diskio.c b/src/diskio.c index 4025f94..57fcaa5 100644 --- a/src/diskio.c +++ b/src/diskio.c @@ -124,7 +124,12 @@ int open_disks_fd(struct sync_disk *disks, int num_disks) fd = open(disk->path, O_RDWR | O_DIRECT | O_SYNC, 0); if (fd < 0) { rv = -errno; - log_error("open error %d %s", fd, disk->path); + if (rv == -EACCES) { + log_error("open error %d EACCES: no permission to open %s", rv, disk->path); + log_error("check that daemon user %s %d group %s %d has access to disk or file.", + com.uname, com.uid, com.gname, com.gid); + } else + log_error("open error %d %s", fd, disk->path); continue; } @@ -159,7 +164,12 @@ int open_disk(struct sync_disk *disk) fd = open(disk->path, O_RDWR | O_DIRECT | O_SYNC, 0); if (fd < 0) { rv = -errno; - log_error("open error %d %s", rv, disk->path); + if (rv == -EACCES) { + log_error("open error %d EACCES: no permission to open %s", rv, disk->path); + log_error("check that daemon user %s %d group %s %d has access to disk or file.", + com.uname, com.uid, com.gname, com.gid); + } else + log_error("open error %d %s", rv, disk->path); goto fail; }