[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131022190825.GC10600@mail.hallyn.com>
Date: Tue, 22 Oct 2013 19:08:25 +0000
From: "Serge E. Hallyn" <serge@...lyn.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Miklos Szeredi <miklos@...redi.hu>,
Andy Lutomirski <luto@...capital.net>,
"Serge E. Hallyn" <serge@...lyn.com>,
Al Viro <viro@...iv.linux.org.uk>,
Linux-Fsdevel <linux-fsdevel@...r.kernel.org>,
Kernel Mailing List <linux-kernel@...r.kernel.org>,
Rob Landley <rob@...dley.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Matthias Schniedermeyer <ms@...d.de>,
Linux Containers <containers@...ts.linux-foundation.org>
Subject: Re: [REVIEW][PATCH 3/4] vfs: Add a function to lazily unmount all
mounts from any dentry. v3
Quoting Eric W. Biederman (ebiederm@...ssion.com):
>
> v2: Always drop the lock when exiting early.
> v3: Make detach_mounts robust about freeing several
> mounts on the same mountpoint at one time, and remove
> the unneeded mnt_list list test.
>
> Signed-off-by: Eric W. Biederman <ebiederman@...tter.com>
Acked-by: Serge Hallyn <serge.hallyn@...onical.com>
> ---
> fs/mount.h | 1 +
> fs/namespace.c | 24 ++++++++++++++++++++++++
> 2 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/fs/mount.h b/fs/mount.h
> index e4342b8dfab1..7a6a2bb3f290 100644
> --- a/fs/mount.h
> +++ b/fs/mount.h
> @@ -79,6 +79,7 @@ static inline int is_mounted(struct vfsmount *mnt)
> }
>
> extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *, int);
> +extern void detach_mounts(struct dentry *dentry);
>
> static inline void get_mnt_ns(struct mnt_namespace *ns)
> {
> diff --git a/fs/namespace.c b/fs/namespace.c
> index e4fe22c23e00..78f7c5c9e673 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -1295,6 +1295,30 @@ static int do_umount(struct mount *mnt, int flags)
> return retval;
> }
>
> +void detach_mounts(struct dentry *dentry)
> +{
> + struct mountpoint *mp;
> + struct mount *mnt;
> +
> + namespace_lock();
> + if (!d_mountpoint(dentry))
> + goto out_unlock;
> +
> + mp = new_mountpoint(dentry);
> + if (IS_ERR(mp))
> + goto out_unlock;
> +
> + br_write_lock(&vfsmount_lock);
> + while (!list_empty(&mp->m_list)) {
> + mnt = list_first_entry(&mp->m_list, struct mount, mnt_mp_list);
> + umount_tree(mnt, 1);
> + }
> + br_write_unlock(&vfsmount_lock);
> + put_mountpoint(mp);
> +out_unlock:
> + namespace_unlock();
> +}
> +
> /*
> * Is the caller allowed to modify his namespace?
> */
> --
> 1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists