From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-unionfs@vger.kernel.org
Subject: [PATCH 5/7] ovl: ignore redirect_dir and index when no upper layer
Date: Tue, 17 Oct 2017 18:23:51 +0300 [thread overview]
Message-ID: <1508253833-9866-6-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1508253833-9866-1-git-send-email-amir73il@gmail.com>
For non-upper overlay mount, the values of redirect_dir and index
config are moot. When mounter tries to change the default value
of these mount options, emit a warning and leave their values at
their defaults so they won't show up in /proc/mounts.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
fs/overlayfs/super.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index a908f4f2e7c3..f4c81767523f 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -434,12 +434,20 @@ 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->redirect_dir != ovl_redirect_dir_def ||
+ config->index != ovl_index_def) {
+ pr_info("overlayfs: options \"redirect_dir\" and \"index\" are useless in a non-upper mount, ignore\n");
+ config->redirect_dir = ovl_redirect_dir_def;
+ config->index = ovl_index_def;
+ }
}
return 0;
@@ -641,10 +649,12 @@ static int ovl_lower_dir(const char *name, struct path *path,
*remote = true;
/*
- * The inodes index feature needs to encode and decode file
- * handles, so it requires that all layers support them.
+ * The inodes index feature needs to encode and decode lower file
+ * handles stored in upper inodes, so it requires that all lower
+ * layers support file handles.
*/
- if (ofs->config.index && !ovl_can_decode_fh(path->dentry->d_sb)) {
+ if (ofs->config.upperdir && !ovl_can_decode_fh(path->dentry->d_sb) &&
+ ofs->config.index) {
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
next prev parent reply other threads:[~2017-10-17 15:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 15:23 [PATCH 0/7] Implement overlayfs verify_dir mount option Amir Goldstein
2017-10-17 15:23 ` [PATCH 1/7] ovl: fix rmdir problem on origin dir Amir Goldstein
2017-10-31 12:54 ` Miklos Szeredi
2017-10-17 15:23 ` [PATCH 2/7] ovl: no direct iteration for dir with copy up origin Amir Goldstein
2017-10-31 13:08 ` Miklos Szeredi
2017-10-17 15:23 ` [PATCH 3/7] ovl: remove unneeded arg from ovl_verify_origin() Amir Goldstein
2017-10-17 15:23 ` [PATCH 4/7] ovl: disable redirect_dir and index when no xattr support Amir Goldstein
2017-10-17 15:23 ` Amir Goldstein [this message]
2017-10-17 15:23 ` [PATCH 6/7] ovl: add support for verify_dir mount option Amir Goldstein
2017-10-17 15:23 ` [PATCH 7/7] ovl: follow decoded origin file handle of merge dir Amir Goldstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1508253833-9866-6-git-send-email-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).