[torqueusers] [PATCH] pbs_mom truncates pid file if can't lock it

Dave Jackson jacksond at supercluster.org
Mon Nov 1 17:13:42 MST 2004


Garrick,

  Thanks, the patch is in the pre5 snapshot.

Dave

On Mon, 2004-11-01 at 16:20, Garrick Staples wrote:
> It seems that if you start pbs_mom when it is already running, it truncates the
> lock/pid file.  It opens the mom.lock with O_TRUNC and *also* calls ftruncate()
> after successfully locking it.  Here's the one-liner that corrects this
> behaviour..
> 
> 
> diff -ruN torque-1.1.0p4_orig/src/resmom/mom_main.c torque-1.1.0p4/src/resmom/mom_main.c
> --- torque-1.1.0p4_orig/src/resmom/mom_main.c	2004-10-28 15:50:48.000000000 -0700
> +++ torque-1.1.0p4/src/resmom/mom_main.c	2004-11-01 14:59:12.000000000 -0800
> @@ -4245,7 +4245,7 @@
>      return(1);
>      }
>  
> -  lockfds = open("mom.lock",O_CREAT|O_TRUNC|O_WRONLY,0644);
> +  lockfds = open("mom.lock",O_CREAT|O_WRONLY,0644);
>  
>    if (lockfds < 0) 
>      {



More information about the torqueusers mailing list