]> git.ipfire.org Git - thirdparty/kernel/linux.git/blobdiff - fs/overlayfs/super.c
ovl: remove redundant ofs->indexdir member
[thirdparty/kernel/linux.git] / fs / overlayfs / super.c
index a0967bb250036d38c6ee922950aec7f46608aed3..f78161cf838813553c59f5c92687eb1cae66d6c4 100644 (file)
@@ -853,10 +853,8 @@ static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ofs,
        if (IS_ERR(indexdir)) {
                err = PTR_ERR(indexdir);
        } else if (indexdir) {
-               ofs->indexdir = indexdir;
-               ofs->workdir = dget(indexdir);
-
-               err = ovl_setup_trap(sb, ofs->indexdir, &ofs->indexdir_trap,
+               ofs->workdir = indexdir;
+               err = ovl_setup_trap(sb, indexdir, &ofs->workdir_trap,
                                     "indexdir");
                if (err)
                        goto out;
@@ -869,16 +867,15 @@ static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ofs,
                 * ".overlay.upper" to indicate that index may have
                 * directory entries.
                 */
-               if (ovl_check_origin_xattr(ofs, ofs->indexdir)) {
-                       err = ovl_verify_origin_xattr(ofs, ofs->indexdir,
+               if (ovl_check_origin_xattr(ofs, indexdir)) {
+                       err = ovl_verify_origin_xattr(ofs, indexdir,
                                                      OVL_XATTR_ORIGIN,
                                                      upperpath->dentry, true,
                                                      false);
                        if (err)
                                pr_err("failed to verify index dir 'origin' xattr\n");
                }
-               err = ovl_verify_upper(ofs, ofs->indexdir, upperpath->dentry,
-                                      true);
+               err = ovl_verify_upper(ofs, indexdir, upperpath->dentry, true);
                if (err)
                        pr_err("failed to verify index dir 'upper' xattr\n");
 
@@ -886,7 +883,7 @@ static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ofs,
                if (!err)
                        err = ovl_indexdir_cleanup(ofs);
        }
-       if (err || !ofs->indexdir)
+       if (err || !indexdir)
                pr_warn("try deleting index dir or mounting with '-o index=off' to disable inodes index.\n");
 
 out:
@@ -1406,7 +1403,7 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc)
                        goto out_free_oe;
 
                /* Force r/o mount with no index dir */
-               if (!ofs->indexdir)
+               if (!ofs->workdir)
                        sb->s_flags |= SB_RDONLY;
        }
 
@@ -1415,7 +1412,7 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc)
                goto out_free_oe;
 
        /* Show index=off in /proc/mounts for forced r/o mount */
-       if (!ofs->indexdir) {
+       if (!ofs->workdir) {
                ofs->config.index = false;
                if (ovl_upper_mnt(ofs) && ofs->config.nfs_export) {
                        pr_warn("NFS export requires an index dir, falling back to nfs_export=off.\n");