Skip to content
Commit 14db7cc5 authored by Michele Mazzucchi's avatar Michele Mazzucchi Committed by Roger Leigh
Browse files

umountfs: Use more sophisticated sed expression for PROTECTED_MOUNTS

This protects all mounts "up to the / ".  However, such sed pattern
matches the root filesystem as "is mounted on path <slash> AND the
mount device starts with <slash>". If the root filesystem is mounted
from a node such as "aufs", the root line does not match, and all
mounts end up in PROTECTED_MOUNTS.

I suppose the additional "/" constraint is a hack used to prevent
matching the initial "rootfs /" entry. I would rewrite this as:

PROTECTED_MOUNTS="$(sed -n ':a;/^[^ ]* \//!{H;n;ba};{H;s/.*//;x;s/\n//;p}' /proc/mounts)"

This unmounts all entries down to the "base" root which is not the
kernel standard "rootfs".  If / is mounted multiple times, this
unmounts all "stacked" entries as well.  In the "aufs" case I described
above, this ensures the additional partitions are cleanly unmounted.
parent 1838523a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment