提交 5064975e 编写于 作者: M Miklos Szeredi

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: NMiklos Szeredi <mszeredi@redhat.com>
上级 520d7c86
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册