eventscripts: Remove calls to "smbstatus -np" for samba cleanup
authorAmitay Isaacs <amitay@gmail.com>
Mon, 11 Feb 2013 00:25:49 +0000 (11:25 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 19 Feb 2013 06:29:52 +0000 (17:29 +1100)
This is an artifact from older versions of Samba. In the newer versions of
Samba, "smbstatus -np" command does not do anything useful, but causes a
traverse in CTDB which is expensive and causes CPU utilization to shoot up.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Conflicts:
config/events.d/50.samba

Cherry-pick-from: 053b89c6dbce47001505524606889334559d2ec4

config/events.d/50.samba

index 55ddf32ae64362c9cdde898d71286489bb09bbda..0a7d5b8870c650d19218997144785382d1835731 100755 (executable)
@@ -107,11 +107,6 @@ stop_samba() {
        return 0
 }
 
-# set default samba cleanup period - in minutes
-[ -z "$SAMBA_CLEANUP_PERIOD" ] && {
-    SAMBA_CLEANUP_PERIOD=10
-}
-
 # we keep a cached copy of smb.conf here
 smbconf_cache="$CTDB_VARDIR/state/samba/smb.conf.cache"
 
@@ -206,15 +201,6 @@ list_samba_shares ()
 }
 
 
-###########################
-# periodic cleanup function
-periodic_cleanup() {
-    # running smbstatus scrubs any dead entries from the connections
-    # and sessionid database
-    # echo "Running periodic cleanup of samba databases"
-    smbstatus -np > /dev/null 2>&1 &
-}
-
 ###########################
 
 [ "$1" = "monitor" ] && {
@@ -226,11 +212,11 @@ is_ctdb_managed_service || is_ctdb_managed_service "winbind" || exit 0
 
 ###########################
 
-case "$1" in 
+case "$1" in
      startup)
        ctdb_service_start
        ;;
-       
+
      shutdown)
        ctdb_service_stop
        ;;
@@ -239,17 +225,6 @@ case "$1" in
        # create the state directory for samba
        /bin/mkdir -p $CTDB_VARDIR/state/samba
 
-       # Create a dummy file to track when we need to do periodic cleanup
-       # of samba databases
-       [ -f $CTDB_VARDIR/state/samba/periodic_cleanup ] || {
-               touch $CTDB_VARDIR/state/samba/periodic_cleanup
-       }
-       [ `/usr/bin/find $CTDB_VARDIR/state/samba/periodic_cleanup -mmin +$SAMBA_CLEANUP_PERIOD | wc -l` -eq 1 ] && {
-               # Cleanup the databases
-               periodic_cleanup
-               touch $CTDB_VARDIR/state/samba/periodic_cleanup
-       }
-
        [ "$CTDB_MANAGES_SAMBA" = "yes" ] && {
                [ "$CTDB_SAMBA_SKIP_SHARE_CHECK" = "yes" ] || {
                        testparm_background_update
@@ -261,7 +236,7 @@ case "$1" in
                                exit 1
                            }
                        }
-                       
+
                        list_samba_shares |
                        ctdb_check_directories_probe || {
                            testparm_foreground_update