Bug 218231

Summary: NFSd shutdown is very slow due to script bug
Product: Red Hat Enterprise Linux 4 Reporter: Tamas Kerecsen <kerecsen>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0316 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-01 23:27:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 222001    

Description Tamas Kerecsen 2006-12-03 22:53:32 UTC
Description of problem:
The /etc/init.d/nfs script tries to shut down nfsd using "killproc nfsd".
Killproc first sends a TERM signal to all nfsd instances, then waits for 4
seconds and finally sends a KILL signal. Since nfsd ignores the TERM signal, the
script will always have to wait 4 seconds, slowing down the shutdown by 4
seconds each time.

(I'm not sure about the rationale behind ignoring TERM, but based on some
comments in the equivalent code in freeBSD, it seems that the designers wanted
to make sure nfsd is the last daemon to get killed so the loopback mounts can be
unmounted properly.) 

As the comments in the kernel's fs/nfsd/nfssvc.c explain, the virtual nfsd
kernel processes should be killed by sending a KILL, HUP, INT or QUIT signal to
them (with HUP being the fastest as it will forgo cleaning the exports table).

An even more future-proof and robust solution is calling "rpc.nfsd -- 0", which
sets the number of nfsd processes to 0 thus killing all current instances.
(Internally it is equivalent to sending a HUP to all processes, but much faster
and more robust because it's only a single kernel call.)

Version-Release number of selected component (if applicable):
N/A

How reproducible:

Steps to Reproduce:
1. Execute "/etc/init.d/nfs stop"
2.
3.
  
Actual results:
It takes just over 4 seconds for the script to complete

Expected results:
It should take less than 1 second for the script to complete

Additional info:
N/A

Comment 1 RHEL Program Management 2006-12-08 13:33:14 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 3 Steve Dickson 2007-01-09 15:29:51 UTC
Fixed in nfs-utils-1.0.6-76

Comment 7 Red Hat Bugzilla 2007-05-01 23:27:57 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0316.html