lkml.org 
[lkml]   [2013]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 03/13] vfs-introduce-clone_private_mount
    Date
    From: Miklos Szeredi <mszeredi@suse.cz>

    Overlayfs needs a private clone of the mount, so create a function for
    this and export to modules.

    Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
    ---
    fs/namespace.c | 18 ++++++++++++++++++
    include/linux/mount.h | 3 +++
    2 files changed, 21 insertions(+)

    diff --git a/fs/namespace.c b/fs/namespace.c
    index 50ca17d..9791b4e 100644
    --- a/fs/namespace.c
    +++ b/fs/namespace.c
    @@ -1399,6 +1399,24 @@ void drop_collected_mounts(struct vfsmount *mnt)
    release_mounts(&umount_list);
    }

    +struct vfsmount *clone_private_mount(struct path *path)
    +{
    + struct mount *old_mnt = real_mount(path->mnt);
    + struct mount *new_mnt;
    +
    + if (IS_MNT_UNBINDABLE(old_mnt))
    + return ERR_PTR(-EINVAL);
    +
    + down_read(&namespace_sem);
    + new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
    + up_read(&namespace_sem);
    + if (!new_mnt)
    + return ERR_PTR(-ENOMEM);
    +
    + return &new_mnt->mnt;
    +}
    +EXPORT_SYMBOL_GPL(clone_private_mount);
    +
    int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
    struct vfsmount *root)
    {
    diff --git a/include/linux/mount.h b/include/linux/mount.h
    index d7029f4..344a262 100644
    --- a/include/linux/mount.h
    +++ b/include/linux/mount.h
    @@ -66,6 +66,9 @@ extern void mnt_pin(struct vfsmount *mnt);
    extern void mnt_unpin(struct vfsmount *mnt);
    extern int __mnt_is_readonly(struct vfsmount *mnt);

    +struct path;
    +extern struct vfsmount *clone_private_mount(struct path *path);
    +
    struct file_system_type;
    extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
    int flags, const char *name,
    --
    1.7.10.4


    \
     
     \ /
      Last update: 2013-03-12 18:01    [W:7.949 / U:0.712 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site