LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

[PATCH] Sanity checking in stop_sync_thread()

To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Subject: [PATCH] Sanity checking in stop_sync_thread()
From: Bryan Berg <bryan@xxxxxxxxx>
Date: Wed, 02 Feb 2005 16:52:45 -0800
Hi,

I've attached a patch below to address some issues I experienced
with keepalived 1.1.8 and the ipvs sync thread getting deadlocked
or not stopping properly in kernel 2.6.10.  I've sent a patch for
keepalived to the keepalived-devel list that should keep the
problematic behavior from occurring, but it would probably be helpful
to have a little bit more sanity checking in the kernel for this.

To sum up the actual issue this addresses, keepalived was causing
stop_sync_thread(0) to get called; it looks like it had previously
assumed that this invocation would cause any running syncd thread
to be killed.  This doesn't seem to be the case anymore (presumably
after support for having a running master and backup thread running
simultaneously was introduced.) so I've patched keepalived to
explicitly cause stop_sync_thread(IP_VS_STATE_MASTER) and
stop_sync_thread(IP_VS_STATE_BACKUP) to be called instead.

Here's a small patch to ip_vs_sync.c to validate the arguments and
help eliminate the inconsistent behavior.

Hope it's helpful.

-Bryan

*** ip_vs_sync.c.orig   2005-02-02 16:32:16.007542520 -0800
--- ip_vs_sync.c        2005-02-02 16:33:54.563559728 -0800
***************
*** 872,877 ****
--- 872,881 ----
           (state == IP_VS_STATE_BACKUP && !sync_backup_pid))
               return -ESRCH;
+ /* make sure we're being given a valid state to stop */
+       if (state != IP_VS_STATE_MASTER && state != IP_VS_STATE_BACKUP)
+               return -EINVAL;
+
       IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid);
       IP_VS_INFO("stopping sync thread %d ...\n",
                  (state == IP_VS_STATE_MASTER) ? sync_master_pid : 
sync_backup_pid);

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] Sanity checking in stop_sync_thread(), Bryan Berg <=