Blame SOURCES/lvm2-2_02_187-lvmetad-fix-timeout-on-shutdown.patch

b83e05
 WHATS_NEW                        |  1 +
b83e05
 libdaemon/server/daemon-server.c | 11 +++++++++--
b83e05
 2 files changed, 10 insertions(+), 2 deletions(-)
b83e05
b83e05
diff --git a/WHATS_NEW b/WHATS_NEW
b83e05
index 00b84f9..ac70074 100644
b83e05
--- a/WHATS_NEW
b83e05
+++ b/WHATS_NEW
b83e05
@@ -1,5 +1,6 @@
b83e05
 Version 2.02.187 - 
b83e05
 ===================================
b83e05
+  Fix lvmetad shutdown and avoid lenghty timeouts when rebooting system.
b83e05
   Prevent creating VGs with PVs with different logical block sizes.
b83e05
   Pvmove runs in exlusively activating mode for exclusively active LVs.
b83e05
   Activate thin-pool layered volume as 'read-only' device.
b83e05
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
b83e05
index bc58f7b..62f403a 100644
b83e05
--- a/libdaemon/server/daemon-server.c
b83e05
+++ b/libdaemon/server/daemon-server.c
b83e05
@@ -89,6 +89,13 @@ static int _is_idle(daemon_state s)
b83e05
 
b83e05
 static struct timespec *_get_timeout(daemon_state s)
b83e05
 {
b83e05
+	static struct timespec _tm = { 0 };
b83e05
+
b83e05
+	if (_shutdown_requested) {
b83e05
+		_tm.tv_sec = 1;
b83e05
+		return &_tm;
b83e05
+	}
b83e05
+
b83e05
 	return s.idle ? s.idle->ptimeout : NULL;
b83e05
 }
b83e05
 
b83e05
@@ -506,7 +513,7 @@ static int _handle_connect(daemon_state s)
b83e05
 	socklen_t sl = sizeof(sockaddr);
b83e05
 
b83e05
 	client.socket_fd = accept(s.socket_fd, (struct sockaddr *) &sockaddr, &sl);
b83e05
-	if (client.socket_fd < 0) {
b83e05
+	if (client.socket_fd < 0 || _shutdown_requested) {
b83e05
 		if (errno != EAGAIN || !_shutdown_requested)
b83e05
 			ERROR(&s, "Failed to accept connection: %s.", strerror(errno));
b83e05
 		return 0;
b83e05
@@ -672,7 +679,7 @@ void daemon_start(daemon_state s)
b83e05
 			continue;
b83e05
 		}
b83e05
 
b83e05
-		if (FD_ISSET(s.socket_fd, &in)) {
b83e05
+		if (!_shutdown_requested && FD_ISSET(s.socket_fd, &in)) {
b83e05
 			timeout_count = 0;
b83e05
 			_handle_connect(s);
b83e05
 		}