Bug 57314 - netfs init script has errors
Summary: netfs init script has errors
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 7.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-12-10 07:38 UTC by Zenon Mousmoulas
Modified: 2014-03-17 02:24 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-12-10 19:59:22 UTC
Embargoed:


Attachments (Terms of Use)
patch against netfs init script from initscripts-6.40-1: fixes possible errors when unmounting _netdev and other filesystems (1.05 KB, patch)
2001-12-10 07:44 UTC, Zenon Mousmoulas
no flags Details | Diff
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 (2.02 KB, patch)
2001-12-10 18:48 UTC, Zenon Mousmoulas
no flags Details | Diff

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!


Note You need to log in before you can comment on or make changes to this bug.