forked from luck/tmp_suning_uos_patched
ovl: clean up getting upper layer
Merge ovl_get_upper() and ovl_get_upperpath(). The resulting function is named ovl_get_upper(), though it still returns upperpath as well. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
520d7c867f
commit
5064975e7f
|
@ -831,8 +831,9 @@ static const struct xattr_handler *ovl_xattr_handlers[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
static int ovl_get_upperpath(struct ovl_fs *ufs, struct path *upperpath)
|
||||
static int ovl_get_upper(struct ovl_fs *ufs, struct path *upperpath)
|
||||
{
|
||||
struct vfsmount *upper_mnt;
|
||||
int err;
|
||||
|
||||
err = ovl_mount_dir(ufs->config.upperdir, upperpath);
|
||||
|
@ -859,6 +860,17 @@ static int ovl_get_upperpath(struct ovl_fs *ufs, struct path *upperpath)
|
|||
} else {
|
||||
pr_warn("overlayfs: upperdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n");
|
||||
}
|
||||
|
||||
upper_mnt = clone_private_mount(upperpath);
|
||||
err = PTR_ERR(upper_mnt);
|
||||
if (IS_ERR(upper_mnt)) {
|
||||
pr_err("overlayfs: failed to clone upperpath\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Don't inherit atime flags */
|
||||
upper_mnt->mnt_flags &= ~(MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME);
|
||||
ufs->upper_mnt = upper_mnt;
|
||||
err = 0;
|
||||
out:
|
||||
return err;
|
||||
|
@ -954,23 +966,6 @@ static int ovl_get_workpath(struct ovl_fs *ufs, struct path *upperpath,
|
|||
return err;
|
||||
}
|
||||
|
||||
static int ovl_get_upper(struct ovl_fs *ufs, struct path *upperpath)
|
||||
{
|
||||
struct vfsmount *upper_mnt;
|
||||
|
||||
upper_mnt = clone_private_mount(upperpath);
|
||||
if (IS_ERR(upper_mnt)) {
|
||||
pr_err("overlayfs: failed to clone upperpath\n");
|
||||
return PTR_ERR(upper_mnt);
|
||||
}
|
||||
|
||||
/* Don't inherit atime flags */
|
||||
upper_mnt->mnt_flags &= ~(MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME);
|
||||
ufs->upper_mnt = upper_mnt;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ovl_get_indexdir(struct ovl_fs *ufs, struct ovl_entry *oe,
|
||||
struct path *upperpath)
|
||||
{
|
||||
|
@ -1169,10 +1164,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
|
|||
goto out_err;
|
||||
}
|
||||
|
||||
err = ovl_get_upperpath(ufs, &upperpath);
|
||||
if (err)
|
||||
goto out_err;
|
||||
|
||||
err = ovl_get_upper(ufs, &upperpath);
|
||||
if (err)
|
||||
goto out_err;
|
||||
|
|
Loading…
Reference in New Issue
Block a user