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:
Created attachment 40247 [details] patch against netfs init script from initscripts-6.40-1: fixes possible errors when unmounting _netdev and other filesystems
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'.
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
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.
Applied in 6.51-1, thanks!