Bug 183130

Summary: mount leaks socket descriptors under some conditions
Product: Red Hat Enterprise Linux 3 Reporter: Neil Horman <nhorman>
Component: util-linuxAssignee: Steve Dickson <steved>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-28 15:27:10 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:
Attachments:
Description Flags
patch to correct mount socket leak none

Description Neil Horman 2006-02-26 18:52:12 UTC
Description of problem:
if try_mount_one function in the mount utility follows the retry_nfs goto
(usually occuring because of a local mount error following a successful contact
of the nfs server, the mount utility will leak socket descriptors.  This is due
to the fact that nfsmount records the socket that is bound and connected to an
nfs server in a static data structure which gets overwritten without being first
closed on repetative calls to nfsmount through the retry_nfs path in try_mount_one.

Version-Release number of selected component (if applicable):
2.11y and forward

How reproducible:
always

Steps to Reproduce:
1.add ~600 nfs mounts to /etc/fstab
2.issue a service netfs start
3.
  
Actual results:
not all mounts are mounted.  mounts begin failing eventually with EADDRINUSE

Expected results:
all mounts successful.

Additional info:
I've written the attached patch to correct this problem by initalizing the
static data in nfsmount() and checking it on each entry to the function.  If it
is greater than zero it is closed before attempting to open a new socket. 
Tested by myself and the reporter with successful results.

Comment 1 Neil Horman 2006-02-26 18:52:13 UTC
Created attachment 125282 [details]
patch to correct mount socket leak