Resolves: bz 355231
This commit is contained in:
		
							parent
							
								
									74c28eadf7
								
							
						
					
					
						commit
						751f129628
					
				
							
								
								
									
										64
									
								
								irqbalance-0.55-pid-file.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								irqbalance-0.55-pid-file.patch
									
									
									
									
									
										Normal file
									
								
							| @ -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 <stdio.h> | ||||
|  #include <stdlib.h> | ||||
|  #include <malloc.h> | ||||
| +#include <fcntl.h>
 | ||||
| +#include <string.h>
 | ||||
|  #include <sys/time.h> | ||||
| +#include <sys/types.h>
 | ||||
| +#include <sys/stat.h>
 | ||||
|   | ||||
|  #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; | ||||
|  } | ||||
| @ -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 | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -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 <nhorman@redhat.com> - 2:0.55-7 | ||||
| - Update to properly hadndle pid files (bz 355231) | ||||
| 
 | ||||
| * Thu Oct 04 2007 Neil Horman <nhorman@redhat.com> - 2:0.55-6 | ||||
| - Fix irqbalance init script (bz 317219) | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user