On Mon, 06 Jan 2014 02:20:42 +0900 (JST), Ryusuke Konishi wrote: > On Mon, 6 Jan 2014 00:52:43 +0900, Hitoshi Mitake wrote: >> Current daemonize() function of cleanerd call _exit(2) only once during its >> process of becoming a daemon process. But in the linux environment, a daemon >> should call _exit(2) twice for ensuring not being a session leader. If a >> process don't do that, unexpected SIGHUP can be sent to the process (though it >> happens rarely). The signal would be confusing event for cleanerd of nilfs. This >> patch removes this potential problem. >> >> Signed-off-by: Hitoshi Mitake <mitake.hitoshi@xxxxxxxxxxxxx> >> --- >> sbin/cleanerd/cleanerd.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/sbin/cleanerd/cleanerd.c b/sbin/cleanerd/cleanerd.c >> index 0b5bb70..86dfcf7 100644 >> --- a/sbin/cleanerd/cleanerd.c >> +++ b/sbin/cleanerd/cleanerd.c >> @@ -708,6 +708,14 @@ static int daemonize(int nochdir, int noclose) >> >> /* umask(0); */ >> >> + /* for ensuring I'm not a session leader */ >> + pid = fork(); >> + if (pid < 0) >> + return -1; >> + else if (pid != 0) >> + /* parent */ >> + _exit(0); >> + >> if (!nochdir && (chdir(ROOTDIR) < 0)) >> return -1; >> >> -- >> 1.8.1.2 > > Looks good. > > Applied, thank you. > > Ryusuke Konishi 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 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html