From: "zhangyi (F)" <yi.zhang@huawei.com>
To: linux-unionfs@vger.kernel.org
Cc: miklos@szeredi.hu, amir73il@gmail.com, yi.zhang@huawei.com,
miaoxie@huawei.com, yangerkun@huawei.com
Subject: [RFC PATCH 4/4] ovl: fix redirect feature for backward compatibility
Date: Thu, 22 Mar 2018 19:35:55 +0800 [thread overview]
Message-ID: <20180322113555.47858-5-yi.zhang@huawei.com> (raw)
In-Reply-To: <20180322113555.47858-1-yi.zhang@huawei.com>
For a redirect dir was created before the overlayfs support
"feature set", upper root dir does not contain the redirect dir
feature xattr. In that case, we cannot detect this feature during
mount time, so fix this feature set once a redirect xattr is detected
in ovl_lookup().
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
---
fs/overlayfs/namei.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 70fcfcc684cc..9325c5a870c0 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -914,6 +914,18 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
ctr++;
/*
+ * Detect redirect xattr but not enable this feature, this
+ * redirect maybe set by the old overlay driver, fix this
+ * feature for backward compatibility.
+ */
+ if (d.redirect && !ofs->config.redirect_dir &&
+ !ovl_has_feature_redirect_dir(dentry->d_sb)) {
+ err = ovl_set_feature_redirect_dir(dentry->d_sb);
+ if (err)
+ goto out_put;
+ }
+
+ /*
* Following redirects can have security consequences: it's like
* a symlink into the lower layer without the permission checks.
* This is only a problem if the upper layer is untrusted (e.g
--
2.13.6
next prev parent reply other threads:[~2018-03-22 11:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 11:35 [RFC PATCH 0/4] ovl: implement overlay feature set zhangyi (F)
2018-03-22 11:35 ` [RFC PATCH 1/4] ovl: add feature set support zhangyi (F)
2018-03-23 12:12 ` Amir Goldstein
2018-03-24 12:55 ` zhangyi (F)
2018-03-24 13:56 ` Amir Goldstein
2018-03-22 11:35 ` [RFC PATCH 2/4] ovl: update features on upper root dir from lower layers zhangyi (F)
2018-03-23 11:54 ` Amir Goldstein
2018-03-22 11:35 ` [RFC PATCH 3/4] ovl: enable features according to mount options zhangyi (F)
2018-03-23 12:50 ` Amir Goldstein
2018-03-22 11:35 ` zhangyi (F) [this message]
2018-03-23 12:32 ` [RFC PATCH 0/4] ovl: implement overlay feature set Amir Goldstein
2018-03-24 12:57 ` zhangyi (F)
2018-03-24 14:09 ` 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=20180322113555.47858-5-yi.zhang@huawei.com \
--to=yi.zhang@huawei.com \
--cc=amir73il@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miaoxie@huawei.com \
--cc=miklos@szeredi.hu \
--cc=yangerkun@huawei.com \
/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