From: Gao Xiang <gaoxiang25@huawei.com> To: "Theodore Y. Ts'o" <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org> Cc: Eric Biggers <ebiggers@google.com>, linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Yu <yuchao0@huawei.com>, Miao Xie <miaoxie@huawei.com>, weidu.du@huawei.com, Gao Xiang <gaoxiang25@huawei.com> Subject: [RFC PATCH 1/2] fscrypt: remove d_lock on reading DCACHE_ENCRYPTED_WITH_KEY Date: Mon, 10 Sep 2018 21:01:07 +0800 [thread overview] Message-ID: <1536584468-15695-1-git-send-email-gaoxiang25@huawei.com> (raw) It seems there is no need to take d_lock when accessing dentry->d_flags & DCACHE_ENCRYPTED_WITH_KEY in fscrypt_d_revalidate. It only needs to be serialized for updating. Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> --- Hi, At glance, I have no idea why fscrypt_d_revalidate disables RCU-lookup. Therefore I made patches to raise a question and do some basic test, and it seems to work. Thanks, fs/crypto/crypto.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index 0f46cf5..b38c574 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -329,9 +329,8 @@ static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags) return 0; } - spin_lock(&dentry->d_lock); - cached_with_key = dentry->d_flags & DCACHE_ENCRYPTED_WITH_KEY; - spin_unlock(&dentry->d_lock); + cached_with_key = READ_ONCE(dentry->d_flags) & + DCACHE_ENCRYPTED_WITH_KEY; dir_has_key = (d_inode(dir)->i_crypt_info != NULL); dput(dir); -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Gao Xiang <gaoxiang25@huawei.com> To: "Theodore Y. Ts'o" <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org> Cc: Eric Biggers <ebiggers@google.com>, <linux-fscrypt@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Chao Yu <yuchao0@huawei.com>, Miao Xie <miaoxie@huawei.com>, <weidu.du@huawei.com>, Gao Xiang <gaoxiang25@huawei.com> Subject: [RFC PATCH 1/2] fscrypt: remove d_lock on reading DCACHE_ENCRYPTED_WITH_KEY Date: Mon, 10 Sep 2018 21:01:07 +0800 [thread overview] Message-ID: <1536584468-15695-1-git-send-email-gaoxiang25@huawei.com> (raw) It seems there is no need to take d_lock when accessing dentry->d_flags & DCACHE_ENCRYPTED_WITH_KEY in fscrypt_d_revalidate. It only needs to be serialized for updating. Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> --- Hi, At glance, I have no idea why fscrypt_d_revalidate disables RCU-lookup. Therefore I made patches to raise a question and do some basic test, and it seems to work. Thanks, fs/crypto/crypto.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index 0f46cf5..b38c574 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -329,9 +329,8 @@ static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags) return 0; } - spin_lock(&dentry->d_lock); - cached_with_key = dentry->d_flags & DCACHE_ENCRYPTED_WITH_KEY; - spin_unlock(&dentry->d_lock); + cached_with_key = READ_ONCE(dentry->d_flags) & + DCACHE_ENCRYPTED_WITH_KEY; dir_has_key = (d_inode(dir)->i_crypt_info != NULL); dput(dir); -- 1.9.1
next reply other threads:[~2018-09-10 17:55 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-09-10 13:01 Gao Xiang [this message] 2018-09-10 13:01 ` [RFC PATCH 1/2] fscrypt: remove d_lock on reading DCACHE_ENCRYPTED_WITH_KEY Gao Xiang 2018-09-10 13:01 ` [RFC PATCH 2/2] fscrypt: enable RCU-walk path for .d_revalidate Gao Xiang 2018-09-10 13:01 ` Gao Xiang 2018-09-10 13:08 ` [RFC PATCH v2 " Gao Xiang 2018-09-10 13:08 ` Gao Xiang 2018-09-10 23:20 ` Eric Biggers 2018-09-11 5:29 ` Gao Xiang 2018-09-11 5:29 ` Gao Xiang
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=1536584468-15695-1-git-send-email-gaoxiang25@huawei.com \ --to=gaoxiang25@huawei.com \ --cc=ebiggers@google.com \ --cc=jaegeuk@kernel.org \ --cc=linux-fscrypt@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=miaoxie@huawei.com \ --cc=tytso@mit.edu \ --cc=weidu.du@huawei.com \ --cc=yuchao0@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.