diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2017-11-10 09:39:15 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2017-11-10 09:39:15 +0100 |
commit | 5064975e7fecdf9c7fc550ddef345aa50d0b04bb (patch) | |
tree | bd2830dc5f1521914241f53079eadf78c5bbc645 /fs/overlayfs | |
parent | 520d7c867f26d216730e0d0e43b2f2ac90953a2d (diff) | |
download | linux-5064975e7fecdf9c7fc550ddef345aa50d0b04bb.tar.gz linux-5064975e7fecdf9c7fc550ddef345aa50d0b04bb.tar.bz2 linux-5064975e7fecdf9c7fc550ddef345aa50d0b04bb.zip |
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>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r-- | fs/overlayfs/super.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 3807472b718e..03202ad7b481 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -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 @@ out: 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; |