lkml.org 
[lkml]   [2013]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 0/3] vfs: Detach mounts on unlink.
On 10/08/2013 03:03:03 AM, Karel Zak wrote:
> On Sat, Oct 05, 2013 at 06:42:44PM -0500, Rob Landley wrote:
> > Oh, attached is a dumb "zapchroot" script I've been using for years
> to
> > unlink all mount points under a given directory, taking advantage
> of the
> > fact that mount points are appended to the end of the list so if
> you unlink
> > from the end to the front you should get the sub-mounts before the
> parent
> > mounts (modulo mount --move not reordering the list, but that's
> uncommon).
>
> util-linux umount supports --recursive, it uses /proc/self/mountinfo
> to compose the hierarchy. The important is that the mountinfo file
> contains Id and Parent_Id relations, so you don't rely on the order
> only.

Ah, that's what happened.

For some reason /proc/self/mounts stopped adjusting itself for chroot a
while back, apparently because containers use switch_root instead so
chroot is generally deprecated or something? This made /proc/mounts
completely useless in a chroot because the paths it showed were not the
ones you actually had to use to umount anything.

Instead they added a new way to get this info, in a new format where
you have to parse the 5th field out of each line to get the mount point
(to make it friendly to scripts and tools).

Good to know.

Rob

\
 
 \ /
  Last update: 2013-10-10 09:01    [W:0.164 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site