For non-upper overlay mount, the value of index mount option is moot. When mounter tries to set this mount options, emit a warning and leave the value at the default so it won't show up in /proc/mounts. Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> --- fs/overlayfs/super.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 5d5e2b39ba69..7e33c83c5a07 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -496,12 +496,18 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) } } - /* Workdir is useless in non-upper mount */ - if (!config->upperdir && config->workdir) { - pr_info("overlayfs: option \"workdir=%s\" is useless in a non-upper mount, ignore\n", - config->workdir); - kfree(config->workdir); - config->workdir = NULL; + if (!config->upperdir) { + /* Workdir is useless in non-upper mount */ + if (config->workdir) { + pr_info("overlayfs: option \"workdir=%s\" is useless in a non-upper mount, ignore\n", + config->workdir); + kfree(config->workdir); + config->workdir = NULL; + } + if (config->index != ovl_index_def) { + pr_info("overlayfs: option \"index\" is useless in a non-upper mount, ignore\n"); + config->index = ovl_index_def; + } } return ovl_parse_redirect_mode(config, config->redirect_mode); @@ -698,7 +704,8 @@ static int ovl_lower_dir(const char *name, struct path *path, * The inodes index feature needs to encode and decode file * handles, so it requires that all layers support them. */ - if (ofs->config.index && !ovl_can_decode_fh(path->dentry->d_sb)) { + if (ofs->config.upperdir && ofs->config.index && + !ovl_can_decode_fh(path->dentry->d_sb)) { ofs->config.index = false; pr_warn("overlayfs: fs on '%s' does not support file handles, falling back to index=off.\n", name); } -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html