Skip to contentSkip to conversation

Revert "dlm_controld: add support for waitplock_recovery switch"

PATCH New Alexander Aring 1 participant 2 messages Sep 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Revert "dlm_controld: add support for waitplock_recovery switch"

This reverts commit 0e9d0a6563f4acef5a27eade8eb29c7e6748c8d2.

---
 dlm_controld/action.c     | 5 -----
 dlm_controld/dlm.conf.5   | 2 --
 dlm_controld/dlm_daemon.h | 1 -
 dlm_controld/main.c       | 5 -----
 4 files changed, 13 deletions(-)
dlm_controld/action.c +0 -5
index bc9c44f2..9e18d286 100644
@@ -881,11 +881,6 @@ int setup_configfs_options(void)
 	    dlm_options[timewarn_ind].file_set)
 		set_configfs_cluster("timewarn_cs", NULL, opt(timewarn_ind));
 
-	if (dlm_options[enable_waitplock_recovery_ind].cli_set ||
-	    dlm_options[enable_waitplock_recovery_ind].file_set)
-		set_configfs_cluster("waitplock_recovery", NULL,
-				     opt(enable_waitplock_recovery_ind));
-
 	set_configfs_cluster("mark", NULL, optu(mark_ind));
 
 	proto_name = opts(protocol_ind);
dlm_controld/dlm.conf.5 +0 -2
index e92dfc8e..1ce0c644 100644
@@ -46,8 +46,6 @@ debug_logfile
 .br
 enable_plock
 .br
-enable_waitplock_recovery
-.br
 plock_debug
 .br
 plock_rate_limit
dlm_controld/dlm_daemon.h +0 -1
index ee21c256..0b4ae5f2 100644
@@ -102,7 +102,6 @@ enum {
         mark_ind,
         enable_fscontrol_ind,
         enable_plock_ind,
-        enable_waitplock_recovery_ind,
         plock_debug_ind,
         plock_rate_limit_ind,
         plock_ownership_ind,
dlm_controld/main.c +0 -5
index 645bd26b..470a067c 100644
@@ -1768,11 +1768,6 @@ static void set_opt_defaults(void)
 			1, NULL, 0,
 			"enable/disable posix lock support for cluster fs");
 
-	set_opt_default(enable_waitplock_recovery_ind,
-			"enable_waitplock_recovery", '\0', req_arg_bool,
-			0, NULL, 0,
-			"enable/disable posix lock to wait for dlm recovery after lock acquire");
-
 	set_opt_default(plock_debug_ind,
 			"plock_debug", 'P', no_arg,
 			0, NULL, 0,
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/2 dlm_controld: set SO_RCVBUF for netlink socket

Saw some:

1597148652 uevent recv error -1 errno 105

on a dlm_tool dump. The errno 105 is ENOBUFS on an recv of an AF_NETLINK socket. Further investigations showed that we dropping uevents in such case, see the added comment. The above error message was on a node which hung inside do_uevent() of dlm kernel code which means that the node is waiting for a sysfs write of "event_done". My guess is that dlm_controld dropped some "important" messages and never writes to "event_done" in this case. However we should prevent such ENOBUFS cases in netlink which this patch is trying to do in a simple way.

---
 dlm_controld/dlm_daemon.h |  2 ++
 dlm_controld/main.c       | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)
dlm_controld/dlm_daemon.h +2 -0
index 0b4ae5f2..95848201 100644
@@ -83,6 +83,8 @@
 #define DEFAULT_LOGFILE_PRIORITY LOG_INFO
 #define DEFAULT_LOGFILE          LOG_FILE_PATH
 
+#define DEFAULT_NETLINK_RCVBUF	(2 * 1024 * 1024)
+
 enum {
         no_arg = 0,
         req_arg_bool = 1,
dlm_controld/main.c +19 -0
index 470a067c..a82fc9c2 100644
@@ -765,6 +765,7 @@ static void process_uevent(int ci)
 static int setup_uevent(void)
 {
 	struct sockaddr_nl snl;
+	int rcvbuf;
 	int s, rv;
 
 	s = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
@@ -773,6 +774,24 @@ static int setup_uevent(void)
 		return s;
 	}
 
+	/* man 7 netlink:
+	 *
+	 * However,  reliable  transmissions from kernel to user are impossible in
+	 * any case.  The kernel can't send a netlink message if the socket buffer
+	 * is  full: the message will be dropped and the kernel and the user-space
+	 * process will no longer have the same view of kernel state.  It is up to
+	 * the  application  to  detect  when  this happens (via the ENOBUFS error
+	 * returned by recvmsg(2)) and resynchronize.
+	 *
+	 * To prevent ENOBUFS errors we just set the receive buffer to two
+	 * megabyte as other applications do it. This will not ensure that we never
+	 * receive ENOBUFS but it's more unlikely. May it's worth to handle ENOBUFS
+	 * errors on a different way in future.
+	 */
+	rcvbuf = DEFAULT_NETLINK_RCVBUF;
+	setsockopt(s, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf));
+	setsockopt(s, SOL_SOCKET, SO_RCVBUFFORCE, &rcvbuf, sizeof(rcvbuf));
+
 	memset(&snl, 0, sizeof(snl));
 	snl.nl_family = AF_NETLINK;
 	snl.nl_pid = getpid();
Signature · 1 line
2.26.2