rpms/upstart/F-13 upstart-reexec.patch, NONE, 1.1 upstart.spec, 1.46, 1.47

Bill Nottingham notting at fedoraproject.org
Tue May 4 20:27:15 UTC 2010


Author: notting

Update of /cvs/extras/rpms/upstart/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv1310/F-13

Modified Files:
	upstart.spec 
Added Files:
	upstart-reexec.patch 
Log Message:
Re-add SIGTERM handler. This allows 'kill -TERM 1' on shutdown to work,
avoiding busy inodes when we update glibc/gcc/etc. (#576662)



upstart-reexec.patch:
 main.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

--- NEW FILE upstart-reexec.patch ---
diff -up upstart-0.6.5/init/main.c.foo upstart-0.6.5/init/main.c
--- upstart-0.6.5/init/main.c.foo	2010-04-30 19:38:07.846260462 -0400
+++ upstart-0.6.5/init/main.c	2010-04-30 21:35:38.690487114 -0400
@@ -67,6 +67,7 @@ static void kbd_handler     (void *data,
 static void pwr_handler     (void *data, NihSignal *signal);
 static void hup_handler     (void *data, NihSignal *signal);
 static void usr1_handler    (void *data, NihSignal *signal);
+static void term_handler    (void *data, NihSignal *signal);
 #endif /* DEBUG */
 
 
@@ -241,6 +242,10 @@ main (int   argc,
 	/* SIGUSR1 instructs us to reconnect to D-Bus */
 	nih_signal_set_handler (SIGUSR1, nih_signal_handler);
 	NIH_MUST (nih_signal_add_handler (NULL, SIGUSR1, usr1_handler, NULL));
+
+	/* SIGTERM instructs us to re-exec ourselves */
+	nih_signal_set_handler (SIGTERM, nih_signal_handler);
+	NIH_MUST (nih_signal_add_handler (NULL, SIGTERM, term_handler, NULL));
 #endif /* DEBUG */
 
 
@@ -485,4 +490,42 @@ usr1_handler (void      *data,
 		}
 	}
 }
+
+/**
+ * term_handler:
+ * @data: unused,
+ * @signal: signal that called this handler
+ *
+ * This is called when we recieve the TERM signal, which instructs us
+ * to reexec ourselves.
+ **/
+static void
+term_handler (void      *data,
+	      NihSignal *signal)
+{
+	NihError   *err;
+	sigset_t    mask, oldmask;
+
+	nih_assert (argv0 != NULL);
+	nih_assert (signal != NULL);
+
+	nih_warn (_("Re-executing %s"), argv0);
+
+	/* Block signals while we work.  We're the last signal handler
+	 * installed so this should mean that they're all handled now.
+	 *
+	 * The child must make sure that it unblocks these again when
+	 * it's ready.
+	 */
+	sigfillset (&mask);
+	sigprocmask (SIG_BLOCK, &mask, &oldmask);
+	execl (argv0, argv0, "--restart", NULL);
+	nih_error_raise_system ();
+
+	err = nih_error_get ();
+	nih_error (_("Failed to re-execute %s: %s"), argv0, err->message);
+	nih_free (err);
+
+	sigprocmask (SIG_SETMASK, &oldmask, NULL);
+}
 #endif /* DEBUG */


Index: upstart.spec
===================================================================
RCS file: /cvs/extras/rpms/upstart/F-13/upstart.spec,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -p -r1.46 -r1.47
--- upstart.spec	6 Apr 2010 20:34:49 -0000	1.46
+++ upstart.spec	4 May 2010 20:27:15 -0000	1.47
@@ -1,6 +1,6 @@
 Name:           upstart
 Version:        0.6.5
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        An event-driven init system
 
 Group:          System Environment/Base
@@ -10,6 +10,7 @@ Source0:        http://upstart.ubuntu.co
 Source1:        init-system-dbus.conf
 Patch1:         upstart-telinit.patch
 Patch2:         upstart-audit-events.patch
+Patch3:		upstart-reexec.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Obsoletes: SysVinit < 2.86-24, sysvinit < 2.86-24
 Provides: SysVinit = 2.86-24, sysvinit = 2.86-24
@@ -25,6 +26,7 @@ during shutdown and supervising them whi
 %setup -q
 %patch1 -p1 -b .u
 %patch2 -p1 -b .audit
+%patch3 -p1 -b .reexec
 
 %build
 %configure --sbindir=/sbin --libdir=/%{_lib}
@@ -103,6 +105,9 @@ rm -rf %{buildroot}
 %{_mandir}/man8/reload.8.gz
 
 %changelog
+* Tue May 4 2010 Bill Nottingham <notting at redhat.com> 0.6.5-5
+- re-add SIGTERM handler so restart on shutdown works, avoiding dirty inodes (#576662)
+
 * Tue Apr 6 2010 Casey Dahlin <cdahlin at redhat.com> 0.6.5-4
 - Reload init after install
 



More information about the scm-commits mailing list