James Hunt has proposed merging lp:~jamesodhunt/upstart/bug-1338637 into lp:upstart.
Requested reviews: Upstart Reviewers (upstart-reviewers) Related bugs: Bug #1338637 in upstart : "continuous re-exec can result in a build-up of inotify fds" https://bugs.launchpad.net/upstart/+bug/1338637 For more details, see: https://code.launchpad.net/~jamesodhunt/upstart/bug-1338637/+merge/225945 -- https://code.launchpad.net/~jamesodhunt/upstart/bug-1338637/+merge/225945 Your team Upstart Reviewers is requested to review the proposed merge of lp:~jamesodhunt/upstart/bug-1338637 into lp:upstart.
=== modified file 'ChangeLog' --- ChangeLog 2014-07-07 10:15:25 +0000 +++ ChangeLog 2014-07-08 10:07:29 +0000 @@ -1,3 +1,9 @@ +2014-07-08 James Hunt <james.h...@ubuntu.com> + + * init/main.c: main(): + - Only create inotify watches if not restarting or if performing a + stateless re-exec (LP: #1338637). + 2014-07-07 James Hunt <james.h...@ubuntu.com> * init/tests/test_job_process.c: test_handler(): === modified file 'init/main.c' --- init/main.c 2014-06-05 22:35:01 +0000 +++ init/main.c 2014-07-08 10:07:29 +0000 @@ -601,38 +601,44 @@ } } - /* Read configuration */ - if (prepend_conf_dirs[0]) { - for (char **d = prepend_conf_dirs; d && *d; d++) { - nih_debug ("Prepending configuration directory %s", *d); - NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR)); - } - } - - if (! user_mode) { - nih_assert (conf_dirs[0]); - - NIH_MUST (conf_source_new (NULL, CONFFILE, CONF_FILE)); - - for (char **d = conf_dirs; d && *d; d++) { - nih_debug ("Using configuration directory %s", *d); - NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR)); - } - } else { - nih_local char **dirs = NULL; - - dirs = NIH_MUST (get_user_upstart_dirs ()); - - for (char **d = conf_dirs[0] ? conf_dirs : dirs; d && *d; d++) { - nih_debug ("Using configuration directory %s", *d); - NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR)); - } - } - - if (append_conf_dirs[0]) { - for (char **d = append_conf_dirs; d && *d; d++) { - nih_debug ("Adding configuration directory %s", *d); - NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR)); + /* Only honour command-line options affecting configuration + * directories if not restarting, or if performing a stateless + * re-exec. + */ + if (! restart || (restart && state_fd == -1)) { + /* Read configuration */ + if (prepend_conf_dirs[0]) { + for (char **d = prepend_conf_dirs; d && *d; d++) { + nih_debug ("Prepending configuration directory %s", *d); + NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR)); + } + } + + if (! user_mode) { + nih_assert (conf_dirs[0]); + + NIH_MUST (conf_source_new (NULL, CONFFILE, CONF_FILE)); + + for (char **d = conf_dirs; d && *d; d++) { + nih_debug ("Using configuration directory %s", *d); + NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR)); + } + } else { + nih_local char **dirs = NULL; + + dirs = NIH_MUST (get_user_upstart_dirs ()); + + for (char **d = conf_dirs[0] ? conf_dirs : dirs; d && *d; d++) { + nih_debug ("Using configuration directory %s", *d); + NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR)); + } + } + + if (append_conf_dirs[0]) { + for (char **d = append_conf_dirs; d && *d; d++) { + nih_debug ("Adding configuration directory %s", *d); + NIH_MUST (conf_source_new (NULL, *d, CONF_JOB_DIR)); + } } } @@ -644,6 +650,9 @@ conf_reload (); + /* We must have atleast one source of configuration */ + nih_assert (! NIH_LIST_EMPTY (conf_sources)); + /* Create a listening server for private connections. */ if (use_session_bus == FALSE) { while (control_server_open () < 0) {
-- upstart-devel mailing list upstart-devel@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel