commit:     aa2b7b6ff12d6f4965e1896681366841deb89b9b
Author:     Rick Farina (zero_chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  6 16:15:44 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Oct  6 20:27:13 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=aa2b7b6f

localmount: unmount aufs branches

---
 init.d/localmount.in | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/init.d/localmount.in b/init.d/localmount.in
index bf3dd0f..1335aa9 100644
--- a/init.d/localmount.in
+++ b/init.d/localmount.in
@@ -63,6 +63,31 @@ stop()
 
        . "$RC_LIBEXECDIR"/sh/rc-mount.sh
 
+       if [ "$RC_UNAME" = Linux ] && [ -d /sys/fs/aufs ] ; then
+               #if / is aufs we remount it noxino during shutdown
+               if mountinfo -q -f '^aufs$' / ; then
+                       mount -o remount,noxino,rw /
+                       sync
+               fi
+
+               local aufs_branch aufs_mount_dir aufs_mount_point aufs_si_dir 
aufs_si_id
+               for aufs_si_dir in /sys/fs/aufs/*; do
+                       aufs_mount_dir=${aufs_si_dir#/sys/fs/aufs/}
+                       aufs_si_id="$(printf "%s" $aufs_mount_dir | sed 
's/_/=/g')"
+                       aufs_mount_point="$(mountinfo -o ${aufs_si_id})"
+                       for x in $aufs_si_dir/br[0-9][0-9][0-9]; do
+                               aufs_branch=$(sed 's/=.*//g' $x)
+                               eindent
+                               if ! mount -o "remount,del:$aufs_branch" 
"$aufs_mount_point" > /dev/null 2>&1; then
+                                       ewarn "Failed to remove branch 
$aufs_branch from aufs \
+                                               $aufs_mount_point"
+                               fi
+                               eoutdent
+                               sync
+                       done
+               done
+       fi
+
        # Umount loop devices
        einfo "Unmounting loop devices"
        eindent

Reply via email to