The earlier messages piqued an interest in me and I started reading
code.  :)

When we call 'nfs stop' if calls a function killproc

killproc calls another function pidofproc

pidofproc calls pidof

pidof, a link to killall5 from the sysvinit package, looks in
/proc/process_id#/{stat,cmdline} for info.  In stat, it looks for a name
inside of parens and strips the parens, and in cmdline, it looks for argv0.

For an nfsd process, we have in stat '(nfsd').  The cmdline is empty.
So, for nfsd, what we are looking for is 'nfsd', not '[nfsd]'.  The
brackets are only for ps to show that the process is inside the kernel.
 Note that the brackets do not show up in top.

Now, going back to killproc; it uses kill (from procps) to send a signal
to the pid found.  A signal is a kernel primitive.

Since the real nfsd process runs in the kernel, we have to look at the
code there to see how it responds to a particular signal.  I haven't
gotten there yet, but need to find out what signal(s) it wants for
proper shutdown.  A quick grep in fs/nfs for SIG shows the only thing
that show up is SIGKILL.

In any case, killproc then calls pidofproc to see if the process still
exists.  If it does, an error is returned.  An [OK] or [FAIL] is printed
according to the result of this last call to pidofproc.
-----------------

What this means:

1. We need to use nfsd as the target to kill, not [nfsd].
2. The default signal sent is TERM, and then KILL after a delay of
KILLDELAY seconds.  The default KILLDELAY is 3 seconds.
3. If a specific signal is sent, or after the KILL after the default
TERM, there is no delay before checking if the process is gone.

I suggest we put a sleep 1 before the last pidofproc "${1}" call to
determine if the program is still running.  This will give the system
time to react to the KILL (or specified) signal for all the nfsd
processes.  Perhaps the extra sleep time could be sent as a parameter to
killproc.  (Its not KILLDELAY, that's soemthing different.)

We may also want to go directly to a KILL in the nfsd shutdown script
with killproc nfsd KILL

  -- Bruce
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to