quota-nld: fix open PID file failed when systemd read it

Running quota_nld by systemd might cause the problem that systemd
couldn't open the PID file generated by quota_nld. In fact, the PID
file hasn't existed yet because it originates from the child process
of quota_nld which is a daemon process. As the main process exit,
systemd try to access the PID file but the daemon hadn't create it
that time.

In this situation, we move the procedure of creating PID file into the
parent process to ensure the PID file must existed when quota_nld exit.
After that, the above problem would never occur again.

[JK: Fixed up SIGTERM handling and format strings]

Signed-off-by: lihaoxiang <lihaoxiang9@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
1 file changed