[PATCHES] CTDB - fix PID file problem

Sumit Bose sbose at redhat.com
Wed Jul 2 04:36:33 MDT 2014

On Wed, Jul 02, 2014 at 07:56:43PM +1000, Martin Schwenke wrote:
> 2 patches:
> * ctdb-daemon: Check PID in ctdb_remove_pidfile(), not unreliable flag
>   If something unexpectedly uses fork() then an exiting child will
>   remove the PID file while the main daemon is still running.  The real
>   test is whether the current process has the PID of the main CTDB
>   daemon.
> * ctdb-daemon: Remove ctdb->ctdbd_pid, just use ctdbd_pid

Wouldn't it be nicer to remove the global variable?

>   The global variable is needed anyway so just use it.

Why? I have found 4 places where ctdbd_pid is used. One is the
assignment, at two other place the ctdb_context is already available.
The remaining one is in ctdb_tevent_trace() where the ctdb_context must
be given as private data in tevent_set_trace_callback() to make
ctdb->ctdbd_pid available.


>   The setting of ctdb->ctdbd_pid in ctdb_start_recoverd() is redundant,
>   so is simply removed.
> Please review and push if OK.
> These patches are in my ctdb branch:
>   http://git.samba.org/?p=martins/samba.git;a=shortlog;h=refs/heads/ctdb
> peace & happiness,
> martin

More information about the samba-technical mailing list