[sheepdog] [PATCH v2] sheep: implement a correct mutex of base directory

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Apr 8 18:14:36 CEST 2013


At Tue,  2 Apr 2013 14:24:02 +0900,
Hitoshi Mitake wrote:
> 
> sheep employes lockf() for mutex of lock_base_dir() now. But the
> lockf() is not suitable for sheep bacause sheep calls daemon(3) after
> the lockf(). daemon(3) forks internally and a parent process exits
> immediately. In a case of sheep, daemon() must be called after locking
> base dir so the lock owner, parent process, exits and the lock will be
> released even though the child process is running. This is the reason
> current lock_base_dir() doesn't work well.
> 
> This patch makes lock_base_dir() correct with a new mechanism based on
> O_EXCL of open(2).
> 
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
> v2: call exit_handler() from crash_handler() too
> 
>  sheep/sheep.c      |   12 ++++++++++++
>  sheep/sheep_priv.h |    1 +
>  sheep/store.c      |   37 +++++++++++++++++++++----------------
>  3 files changed, 34 insertions(+), 16 deletions(-)

This cannot pass tests/check.

Thanks,

Kazutaka



More information about the sheepdog mailing list