We are triggering the cleanup_timeout_fn() too often, on exiting when an smbd is...
authorJeremy Allison <jra@samba.org>
Fri, 1 Jun 2012 19:28:33 +0000 (12:28 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 13 Jun 2012 17:42:13 +0000 (19:42 +0200)
Calls to exit_server_cleanly() should be treated as a "clean" shutdown,
and not trigger the master smbd to call cleanup_timeout_fn.

The last 2 patches address bug #8971 (cleanup_timeout_fn() is called too often,
on exiting when an smbd is idle.)

source3/smbd/server_exit.c

index 4c71d8fa92a5c80484c8540a88583c021223864f..fc77deec72b241e699f53dde81c5b997fc59d350 100644 (file)
@@ -83,7 +83,6 @@ static void exit_server_common(enum server_exit_reason how,
 static void exit_server_common(enum server_exit_reason how,
        const char *const reason)
 {
-       bool had_open_conn = false;
        struct smbd_server_connection *sconn = smbd_server_conn;
 
        if (!exit_firsttime)
@@ -101,7 +100,7 @@ static void exit_server_common(enum server_exit_reason how,
                        bool found = false;
                        files_forall(sconn, log_writeable_file_fn, &found);
                }
-               had_open_conn = conn_close_all(sconn);
+               (void)conn_close_all(sconn);
                invalidate_all_vuids(sconn);
        }
 
@@ -175,6 +174,8 @@ static void exit_server_common(enum server_exit_reason how,
 
                dump_core();
 
+               /* Notreached. */
+               exit(1);
        } else {
                DEBUG(3,("Server exit (%s)\n",
                        (reason ? reason : "normal exit")));
@@ -184,15 +185,7 @@ static void exit_server_common(enum server_exit_reason how,
                gencache_stabilize();
        }
 
-       /* if we had any open SMB connections when we exited then we
-          need to tell the parent smbd so that it can trigger a retry
-          of any locks we may have been holding or open files we were
-          blocking */
-       if (had_open_conn) {
-               exit(1);
-       } else {
-               exit(0);
-       }
+       exit(0);
 }
 
 void exit_server(const char *const explanation)