Skip to content

Commit

Permalink
localmount: clean up handling of aufs branches
Browse files Browse the repository at this point in the history
X-Gentoo-Bug: 560008
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=560008
  • Loading branch information
axs-gentoo authored and williamh committed Oct 8, 2015
1 parent 6fa0d63 commit b86d170
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions init.d/localmount.in
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,24 @@ stop()
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 \
local aufs_branch aufs_mount_point aufs_si_id aufs_br_id branches
for aufs_si_dir in /sys/fs/aufs/si*; do
if [ -d "${aufs_si_dir}" ]; then
aufs_si_id="si=${aufs_si_dir#/sys/fs/aufs/si_}"
aufs_mount_point="$(mountinfo -o ${aufs_si_id})"
branches="$aufs_si_dir/br[0-9] $aufs_si_dir/br[0-9][0-9] $aufs_si_dir/br[0-9][0-9][0-9]"
for x in $branches; do
[ -e "${x}" ] || continue
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
fi
eoutdent
sync
done
fi
done
fi

Expand Down

0 comments on commit b86d170

Please sign in to comment.