diff --git a/irqbalance-0.55-pid-file.patch b/irqbalance-0.55-pid-file.patch new file mode 100644 index 0000000..9e38b5d --- /dev/null +++ b/irqbalance-0.55-pid-file.patch @@ -0,0 +1,64 @@ +diff -up irqbalance-0.55/irqbalance-0.55/irqbalance.c.orig irqbalance-0.55/irqbalance-0.55/irqbalance.c +--- irqbalance-0.55/irqbalance-0.55/irqbalance.c.orig 2007-11-01 11:43:24.000000000 -0400 ++++ irqbalance-0.55/irqbalance-0.55/irqbalance.c 2007-11-01 15:00:53.000000000 -0400 +@@ -22,7 +22,11 @@ + #include + #include + #include ++#include ++#include + #include ++#include ++#include + + #include "irqbalance.h" + +@@ -52,6 +56,9 @@ void sleep_approx(int seconds) + + int main(int argc, char** argv) + { ++ int pidf; ++ char buf[16]; ++ + if (argc>1 && strstr(argv[1],"debug")) + debug_mode=1; + if (argc>1 && strstr(argv[1],"oneshot")) +@@ -67,9 +74,6 @@ int main(int argc, char** argv) + if (getenv("IRQBALANCE_DEBUG")) + debug_mode=1; + +- parse_cpu_tree(); +- +- + /* On single core UP systems irqbalance obviously has no work to do */ + if (core_count<2) + exit(EXIT_SUCCESS); +@@ -82,6 +86,19 @@ int main(int argc, char** argv) + if (daemon(0,0)) + exit(EXIT_FAILURE); + ++ pidf = open("/var/run/irqbalance.pid",O_RDWR|O_CREAT|O_EXCL,0666); ++ if (pidf < 0) ++ exit(EXIT_FAILURE); ++ ++ snprintf(buf, 16, "%d", getpid()); ++ if (write(pidf, buf, strlen(buf)) < strlen(buf)) { ++ close(pidf); ++ unlink("/var/run/irqbalance.pid"); ++ exit(EXIT_FAILURE); ++ } ++ ++ close(pidf); ++ + parse_proc_interrupts(); + sleep(SLEEP_INTERVAL/4); + reset_counts(); +@@ -134,5 +151,8 @@ int main(int argc, char** argv) + break; + counter++; + } ++ ++ unlink("/var/run/irqbalance.pid"); ++ + return EXIT_SUCCESS; + } diff --git a/irqbalance.init b/irqbalance.init index 38593ad..5b34ec7 100755 --- a/irqbalance.init +++ b/irqbalance.init @@ -46,7 +46,7 @@ esac RETVAL=0 start() { - if [ -n "$ONESHOT" -a -f /var/lock/subsys/irqbalance ]; then + if [ -n "$ONESHOT" -a -f /var/run/irqbalance.pid ]; then exit 0 fi echo -n $"Starting $prog: " @@ -54,12 +54,9 @@ start() { then export IRQBALANCE_BANNED_CPUS=$IRQ_AFFINITY_MASK fi - daemon irqbalance $ONESHOT $IRQ_AFFINITY + daemon irqbalance $ONESHOT RETVAL=$? echo - if [ $RETVAL -eq 0 ]; then - touch /var/lock/subsys/irqbalance - fi return $RETVAL } diff --git a/irqbalance.spec b/irqbalance.spec index 9cafad3..48c0213 100644 --- a/irqbalance.spec +++ b/irqbalance.spec @@ -1,7 +1,7 @@ Summary: IRQ balancing daemon. Name: irqbalance Version: 0.55 -Release: 6%{?dist} +Release: 7%{?dist} Epoch: 2 Group: System Environment/Base License: GPL/OSL @@ -19,6 +19,7 @@ Requires: glib2 Patch0: irqbalance-pie.patch Patch1: irqbalance-0.55-cputree-parse.patch +Patch2: irqbalance-0.55-pid-file.patch %description irqbalance is a daemon that evenly distributes IRQ load across @@ -29,6 +30,7 @@ multiple CPUs for enhanced performance. #%patch0 -p1 %patch1 -p1 +%patch2 -p1 %build rm -rf $RPM_BUILD_ROOT @@ -76,6 +78,9 @@ exit 0 %changelog +* Thu Nov 01 2007 Neil Horman - 2:0.55-7 +- Update to properly hadndle pid files (bz 355231) + * Thu Oct 04 2007 Neil Horman - 2:0.55-6 - Fix irqbalance init script (bz 317219)