summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2017-11-09 10:23:29 +0100
committerMiklos Szeredi <mszeredi@redhat.com>2017-11-09 10:23:29 +0100
commit95e6d4177cb7a2d7a760180e13f32adaf4188833 (patch)
tree8a0b5389e0a5a05c84dff9d6dc851faa71102279 /fs/overlayfs
parentf7e3a7d947f83684f6622b592136da54bed922e6 (diff)
downloadlinux-95e6d4177cb7a2d7a760180e13f32adaf4188833.tar.bz2
ovl: grab reference to workbasedir early
and related cleanups. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/super.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 6bb874da174d..255c0523148f 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -889,7 +889,7 @@ static int ovl_get_workpath(struct ovl_fs *ufs, struct path *upperpath,
pr_warn("overlayfs: workdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n");
}
- ufs->workbasedir = workpath->dentry;
+ ufs->workbasedir = dget(workpath->dentry);
err = 0;
out:
return err;
@@ -918,7 +918,7 @@ static int ovl_get_workdir(struct super_block *sb, struct ovl_fs *ufs,
struct dentry *temp;
int err;
- ufs->workdir = ovl_workdir_create(sb, ufs, workpath->dentry,
+ ufs->workdir = ovl_workdir_create(sb, ufs, ufs->workbasedir,
OVL_WORKDIR_NAME, false);
if (!ufs->workdir)
return 0;
@@ -971,7 +971,7 @@ static int ovl_get_workdir(struct super_block *sb, struct ovl_fs *ufs,
static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ufs,
struct ovl_entry *oe,
- struct path *upperpath, struct path *workpath)
+ struct path *upperpath)
{
int err;
@@ -985,7 +985,7 @@ static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ufs,
goto out;
}
- ufs->indexdir = ovl_workdir_create(sb, ufs, workpath->dentry,
+ ufs->indexdir = ovl_workdir_create(sb, ufs, ufs->workbasedir,
OVL_INDEXDIR_NAME, true);
if (ufs->indexdir) {
/* Verify upper root is index dir origin */
@@ -1212,7 +1212,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
}
if (!(ovl_force_readonly(ufs)) && ufs->config.index) {
- err = ovl_get_indexdir(sb, ufs, oe, &upperpath, &workpath);
+ err = ovl_get_indexdir(sb, ufs, oe, &upperpath);
if (err)
goto out_put_indexdir;
}
@@ -1243,7 +1243,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
for (i = 0; i < numlower; i++)
mntput(stack[i].mnt);
kfree(stack);
- mntput(workpath.mnt);
+ path_put(&workpath);
if (upperpath.dentry) {
oe->has_upper = true;
@@ -1283,7 +1283,8 @@ out_put_lowerpath:
kfree(stack);
out_unlock_workdentry:
if (ufs->workdir_locked)
- ovl_inuse_unlock(workpath.dentry);
+ ovl_inuse_unlock(ufs->workbasedir);
+ dput(ufs->workbasedir);
path_put(&workpath);
out_unlock_upperdentry:
if (ufs->upperdir_locked)