From: hujianyang <hujianyang@huawei.com>
To: <miklos@szeredi.hu>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
<linux-unionfs@vger.kernel.org>
Subject: [PATCH] ovl: Enable opauqe setting an removing in userspace
Date: Mon, 24 Nov 2014 18:30:20 +0800 [thread overview]
Message-ID: <547308BC.2000401@huawei.com> (raw)
In-Reply-To: <54730565.4040308@huawei.com>
This patch is an attempt to enbale opauqe setting and removing
in userspace. It may lead to some race conditions.
Signed-off-by: hujianyang <hujianyang@huawei.com>
---
fs/overlayfs/inode.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index b072fb5..f9e3642 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -208,18 +208,25 @@ static bool ovl_is_private_xattr(const char *name)
return strncmp(name, OVL_XATTR_PRE_NAME, OVL_XATTR_PRE_LEN) == 0;
}
+static bool ovl_need_xattr_filter(struct dentry *dentry,
+ enum ovl_path_type type)
+{
+ return type == OVL_PATH_UPPER && S_ISDIR(dentry->d_inode->i_mode);
+}
+
int ovl_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{
int err;
struct dentry *upperdentry;
+ enum ovl_path_type type = ovl_path_type(dentry);
err = ovl_want_write(dentry);
if (err)
goto out;
err = -EPERM;
- if (ovl_is_private_xattr(name))
+ if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name))
goto out_drop_write;
err = ovl_copy_up(dentry);
@@ -235,12 +242,6 @@ out:
return err;
}
-static bool ovl_need_xattr_filter(struct dentry *dentry,
- enum ovl_path_type type)
-{
- return type == OVL_PATH_UPPER && S_ISDIR(dentry->d_inode->i_mode);
-}
-
ssize_t ovl_getxattr(struct dentry *dentry, const char *name,
void *value, size_t size)
{
@@ -296,7 +297,7 @@ int ovl_removexattr(struct dentry *dentry, const char *name)
goto out;
err = -ENODATA;
- if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name))
+ if (!ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name))
goto out_drop_write;
if (type == OVL_PATH_LOWER) {
--
1.6.0.2
next prev parent reply other threads:[~2014-11-24 10:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 10:16 Xattr issues with overlayfs hujianyang
2014-11-24 10:25 ` [PATCH] ovl: Use macros to present ovl_xattr hujianyang
2014-11-24 10:30 ` hujianyang [this message]
2014-11-25 14:41 ` Xattr issues with overlayfs Miklos Szeredi
2014-11-26 8:09 ` hujianyang
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=547308BC.2000401@huawei.com \
--to=hujianyang@huawei.com \
--cc=linux-fsdevel@vger.kernel.org \
--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).