[sheepdog] [PATCH] sheep: implement a correct mutex of base directory
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Apr 2 05:13:23 CEST 2013
At Tue, 2 Apr 2013 11:40:48 +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).
The lock will not be released if the program exits unexpectedly, no?
init_base_path() was called after daemon() in the old code, and the
order was changed in f092748b. I think we should fix the commit.
Thanks,
Kazutaka
More information about the sheepdog
mailing list