Bug 57314

Summary: netfs init script has errors
Product: [Retired] Red Hat Linux Reporter: Zenon Mousmoulas <zmousm>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-12-10 19:59:22 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 against netfs init script from initscripts-6.40-1: fixes possible errors when unmounting _netdev and other filesystems
none
patch against netfs init script from initscripts-6.40-1, version 2: fixes errors when unmounting filesystems on loop devices and filesystems mounted with the _netdev option none

Description Zenon Mousmoulas 2001-12-10 07:38:06 UTC
Description of Problem:
The netfs init script has some errors that could stop it from functioning 
properly. More specifically:

line 28:
NETDEVMTAB=`grep -v '^#' /proc/mounts | awk '{ if (($4 ~ /_netdev$/) && 
($2 != "/")) print $2}'`
I am not sure if this is a problem but the patterm '/_netdev$/' in the 
awk program assumes that _netdev will only be found if it is at the end 
of the 4th field (mount options) in /proc/mounts. In another similar awk 
program later in the script (line 82) there is once again the 
pattern '/_netdev/'. In that case, it doesn't have to be at the end of 
the field. I suggest that '$' is removed from the pattern (see the 
proposed patch below).

line 74:
while [ -n "$remaining" -a "$retry" -gt 0 ]
This loop occurs in the context of: '[ -n "$NETDEVMTAB" ] && { ... }' 
(line 71-89). In this case there is an error that may prevent network 
block filesystems (mounted with the _netdev option) to be properly 
unmounted. The problem is that the variable $remaining is not set before 
the loop starts, unlike with loop devices (line 48) and NFS filesystems 
(line 93) where it is set before a similar 'while' loop begins. As a 
result, if this variable is not set previously, the loop will never be 
executed because $remaining is null and the '-n "$remaining"' condition 
is not met. I suggest the variable should be assigned before the 
execution of this loop. See the proposed patch.

Version-Release number of selected component (if applicable):
initscripts-6.40-1

How Reproducible:

Steps to Reproduce:
1. 
2. 
3. 

Actual Results:


Expected Results:


Additional Information:

Comment 1 Zenon Mousmoulas 2001-12-10 07:44:22 UTC
Created attachment 40247 [details]
patch against netfs init script from initscripts-6.40-1: fixes possible errors when unmounting _netdev and other filesystems

Comment 2 Zenon Mousmoulas 2001-12-10 18:45:49 UTC
I have updated the patch to include a fix suggested by avi.il (see Bug 
#57283) that takes care of loop devices not being unmounted properly when 
executing 'service netfs stop'.

Comment 3 Zenon Mousmoulas 2001-12-10 18:48:38 UTC
Created attachment 40307 [details]
patch against netfs init script from initscripts-6.40-1, version 2: fixes errors when unmounting filesystems on loop devices and filesystems mounted with the _netdev option

Comment 4 Zenon Mousmoulas 2001-12-10 19:59:16 UTC
It looks like in RawHide (initscripts-6.40.2-1) the problem that was reported 
by avi.il in Bug #57283 is addressed. A different approach is used, 
however the problem seems to be solved. So the proposed fix (which I have 
included in my second patch) is probably not needed anymore.

Therefore please ignore the second patch I submitted and only consider the 
first one; the problem with fs mounted with option_netdev and $remaining is 
still there, even in the RawHide rpm.


Comment 5 Bill Nottingham 2002-01-25 06:35:59 UTC
Applied in 6.51-1, thanks!