From: Michael Conrad <mconrad-HsDW+lVSy7tZ66HEZ9PjWw@public.gmane.org>
To: Ryusuke Konishi
<konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>,
Hitoshi Mitake
<mitake.hitoshi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Hitoshi Mitake
<mitake.hitoshi-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
Subject: Re: [PATCH nilfs-utils v2 2/4] cleanerd: call _exit(2) twice for ensuring not being a session leader
Date: Tue, 07 Jan 2014 16:19:01 -0500 [thread overview]
Message-ID: <52CC6F45.9040605@intellitree.com> (raw)
In-Reply-To: <20140106.032857.373562363.konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
On 1/5/2014 1:28 PM, Ryusuke Konishi wrote:
> Oh no, I found this series has a critical issue after I applied them.
>
> The current umount.nilfs2 (and mount.nilfs2 -o remount,nogc) uses pid
> of cleanerd to shutdown it, and this series breaks the logic since the
> fork of cleanerd changes its pid. That was the true reason why nofork
> option is required.
>
> We need to fix it by reverting the series or other means.
>
> Regards,
> Ryusuke Konishi
From what I've learned of writing daemons, good practice is:
* Allow an option for writing a PID file, but don't by default
(location is often distro-specific)
* To daemonize, double-fork, chdir("/"), and then redirect stdin,
stdout, stderr to /dev/null
* Allow users to request messages to syslog, since stdout is lost.
* If you want to capture the PID, have an option to print it on
stderr before redirecting to /dev/null. The caller can read a pipe to
find the final PID of the daemon.
* Allow the option to run the program in the foreground (i.e. do not
daemonize at all) for debugging or in case you want to run the daemon
from a monitoring program which wait()s on it. In this case do not
close stdout, so that debugging messages may be seen on the terminal, or
the messages can be piped to a logger.
Until now, I had thought "-n" was the "no-daemonize" option, which I
thought was strange for mount to use.
-Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-01-07 21:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-05 15:52 [PATCH nilfs-utils v2 0/4] rework daemonize() of cleanerd Hitoshi Mitake
[not found] ` <1388937165-32692-1-git-send-email-mitake.hitoshi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-05 15:52 ` [PATCH nilfs-utils v2 1/4] cleanerd: ignore nofork option Hitoshi Mitake
[not found] ` <1388937165-32692-2-git-send-email-mitake.hitoshi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-05 17:19 ` Ryusuke Konishi
2014-01-05 15:52 ` [PATCH nilfs-utils v2 2/4] cleanerd: call _exit(2) twice for ensuring not being a session leader Hitoshi Mitake
[not found] ` <1388937165-32692-3-git-send-email-mitake.hitoshi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-05 17:20 ` Ryusuke Konishi
[not found] ` <20140106.022042.112826181.konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
2014-01-05 18:28 ` Ryusuke Konishi
[not found] ` <CAFPMYnH8LTD9ctZCSht5NZv6j1TZMfpCZh2pHyLO4wN-5dRDdw@mail.gmail.com>
[not found] ` <CAFPMYnH8LTD9ctZCSht5NZv6j1TZMfpCZh2pHyLO4wN-5dRDdw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-06 3:53 ` Hitoshi Mitake
[not found] ` <20140106.032857.373562363.konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
2014-01-07 21:19 ` Michael Conrad [this message]
2014-01-05 15:52 ` [PATCH nilfs-utils v2 3/4] mount: don't pass -n option to cleanerd Hitoshi Mitake
[not found] ` <1388937165-32692-4-git-send-email-mitake.hitoshi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-05 17:21 ` Ryusuke Konishi
2014-01-05 15:52 ` [PATCH nilfs-utils v2 4/4] man: remove a description of -n option Hitoshi Mitake
[not found] ` <1388937165-32692-5-git-send-email-mitake.hitoshi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-05 17:22 ` Ryusuke Konishi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52CC6F45.9040605@intellitree.com \
--to=mconrad-hsdw+lvsy7tz66hez9pjww@public.gmane.org \
--cc=konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org \
--cc=linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mitake.hitoshi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=mitake.hitoshi-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox