]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ovl: allow redirect_dir to default to "on"
authorMiklos Szeredi <mszeredi@redhat.com>
Fri, 16 Dec 2016 10:02:57 +0000 (11:02 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 16 Dec 2016 10:02:57 +0000 (11:02 +0100)
This patch introduces a kernel config option and a module param.  Both can
be used independently to turn the default value of redirect_dir on or off.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/Kconfig
fs/overlayfs/super.c

index 34355818a2e03460759b144f8f9c284d5a810423..0daac5112f7a32384b5febd39bd8499f31da8c31 100644 (file)
@@ -8,3 +8,17 @@ config OVERLAY_FS
          merged with the 'upper' object.
 
          For more information see Documentation/filesystems/overlayfs.txt
+
+config OVERLAY_FS_REDIRECT_DIR
+       bool "Overlayfs: turn on redirect dir feature by default"
+       depends on OVERLAY_FS
+       help
+         If this config option is enabled then overlay filesystems will use
+         redirects when renaming directories by default.  In this case it is
+         still possible to turn off redirects globally with the
+         "redirect_dir=off" module option or on a filesystem instance basis
+         with the "redirect_dir=off" mount option.
+
+         Note, that redirects are not backward compatible.  That is, mounting
+         an overlay which has redirects on a kernel that doesn't support this
+         feature will have unexpected results.
index 520f9ab0e9ef3b267b01be948251a643067ecf5f..2750aef24d166455505413874ece6c5980b8aa74 100644 (file)
@@ -28,6 +28,10 @@ struct ovl_dir_cache;
 
 #define OVL_MAX_STACK 500
 
+static bool ovl_redirect_dir_def = IS_ENABLED(CONFIG_OVERLAY_FS_REDIRECT_DIR);
+module_param_named(redirect_dir, ovl_redirect_dir_def, bool, 0644);
+MODULE_PARM_DESC(ovl_redirect_dir_def,
+                "Default to on or off for the redirect_dir feature");
 
 static void ovl_dentry_release(struct dentry *dentry)
 {
@@ -702,6 +706,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
        if (!ufs)
                goto out;
 
+       ufs->config.redirect_dir = ovl_redirect_dir_def;
        err = ovl_parse_opt((char *) data, &ufs->config);
        if (err)
                goto out_free_config;