summaryrefslogtreecommitdiff
path: root/fs/overlayfs/super.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2023-04-03 20:36:16 +0300
committerAmir Goldstein <amir73il@gmail.com>2023-06-19 14:01:13 +0300
commit163db0da3515d1d32343906a2fb7854492191d19 (patch)
treeb841dd58ee42fc5946172a7857633507d4b6c444 /fs/overlayfs/super.c
parent5522c9c7cbd2ab4e886fa1c70896f0bdd483ce0b (diff)
downloadlwn-163db0da3515d1d32343906a2fb7854492191d19.tar.gz
lwn-163db0da3515d1d32343906a2fb7854492191d19.zip
ovl: factor out ovl_free_entry() and ovl_stack_*() helpers
In preparation for moving lowerstack into ovl_inode. Note that in ovl_lookup() the temp stack dentry refs are now cloned into the final ovl_lowerstack instead of being transferred, so cleanup always needs to call ovl_stack_free(stack). Reviewed-by: Alexander Larsson <alexl@redhat.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/super.c')
-rw-r--r--fs/overlayfs/super.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index baa970a2b398..35ecea4b60b0 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -54,15 +54,6 @@ module_param_named(xino_auto, ovl_xino_auto_def, bool, 0644);
MODULE_PARM_DESC(xino_auto,
"Auto enable xino feature");
-static void ovl_entry_stack_free(struct ovl_entry *oe)
-{
- struct ovl_path *lowerstack = ovl_lowerstack(oe);
- unsigned int i;
-
- for (i = 0; i < ovl_numlower(oe); i++)
- dput(lowerstack[i].dentry);
-}
-
static bool ovl_metacopy_def = IS_ENABLED(CONFIG_OVERLAY_FS_METACOPY);
module_param_named(metacopy, ovl_metacopy_def, bool, 0644);
MODULE_PARM_DESC(metacopy,
@@ -73,7 +64,7 @@ static void ovl_dentry_release(struct dentry *dentry)
struct ovl_entry *oe = dentry->d_fsdata;
if (oe) {
- ovl_entry_stack_free(oe);
+ ovl_stack_put(ovl_lowerstack(oe), ovl_numlower(oe));
kfree_rcu(oe, rcu);
}
}
@@ -2070,8 +2061,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
return 0;
out_free_oe:
- ovl_entry_stack_free(oe);
- kfree(oe);
+ ovl_free_entry(oe);
out_err:
kfree(splitlower);
path_put(&upperpath);