Comment 0 for bug 145523

Revision history for this message
SurJector (loic-grenie) wrote :

Binary package hint: initscripts

When umounting NFS (or networked filesystem) dirs, other "dependent
dirs" have to be unmounted as well. This includes all the dirs below an
NFS dir and all dirs which are loops over files which are mounted below
an NFS dir. The following patch attempts to correct somewhat the
situation. It is not perfect because losetup does not show the complete
filename of a loop device, but the filename that was indicated to the
kernel at loop creation.
(sorry for the borked patch, but I don't know how to attach)
-----------------------------------------------
*** /etc/init.d/umountnfs.sh.orig 2007-09-27 11:18:53.000000000 +0200
--- /etc/init.d/umountnfs.sh 2007-09-27 11:31:12.000000000 +0200
***************
*** 59,64 ****
--- 59,89 ----
                  proc|procfs|linprocfs|devfs|devpts|usbfs|usbdevfs|sysfs)
                        DIRS="$MTPT $DIRS"
                        ;;
+ *)
+ #
+ # We must unmount all dirs that are below NFS dirs
+ # and those that are loops of files on NFS dirs
+ #
+ loopfile=""
+ case "$DEV" in
+ /dev/loop*)
+ loopfile="`losetup $DEV|cut -f2- -d\(|sed s/\)$//`"
+ ;;
+ esac
+ for d in $DIRS
+ do
+ case "$loopfile" in
+ $d/*)
+ DIRS="$MTPT $DIRS"
+ ;;
+ esac
+ case "MTPT" in
+ $d/*)
+ DIRS="$MTPT $DIRS"
+ ;;
+ esac
+ done
+ ;;
                esac
        done