[lvm-devel] master - lvmetad: check for socket in connect

David Teigland teigland at fedoraproject.org
Thu Apr 21 14:28:25 UTC 2016


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d00b70c789cca1ca73b3d1311db9981d9ca5056b
Commit:        d00b70c789cca1ca73b3d1311db9981d9ca5056b
Parent:        0778d2e9857966e2d7e8f44c7f769fbdebb03a73
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Thu Apr 21 09:27:20 2016 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Thu Apr 21 09:27:20 2016 -0500

lvmetad: check for socket in connect

We can connect if the socket is present, even
though the pidfile may not exist, since systemd
may start the process when the socket is opened.
---
 lib/cache/lvmetad.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index bbf3550..e50234a 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -126,8 +126,8 @@ void lvmetad_disconnect(void)
 
 int lvmetad_connect(struct cmd_context *cmd)
 {
-	if (access(getenv("LVM_LVMETAD_PIDFILE") ? : LVMETAD_PIDFILE, F_OK)) {
-		log_debug_lvmetad("Failed to connect to lvmetad: not running.");
+	if (!lvmetad_socket_present()) {
+		log_debug_lvmetad("Failed to connect to lvmetad: socket not present.");
 		_lvmetad_connected = 0;
 		_lvmetad_use = 0;
 		_lvmetad_cmd = NULL;




More information about the lvm-devel mailing list