projects
/
platform
/
kernel
/
linux-amlogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c9e5f60
)
ceph: ensure d_name stability in ceph_dentry_hash()
author
Jeff Layton
<jlayton@kernel.org>
Wed, 17 Apr 2019 16:58:28 +0000
(12:58 -0400)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 2 May 2019 07:32:01 +0000
(09:32 +0200)
commit
76a495d666e5043ffc315695f8241f5e94a98849
upstream.
Take the d_lock here to ensure that d_name doesn't change.
Cc: stable@vger.kernel.org
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ceph/dir.c
patch
|
blob
|
history
diff --git
a/fs/ceph/dir.c
b/fs/ceph/dir.c
index cec25691cbae9de126fdd1e8890a9083e0596d80..2ffc7fe8da52f272b5d6bf56da7e75f58a85cbda 100644
(file)
--- a/
fs/ceph/dir.c
+++ b/
fs/ceph/dir.c
@@
-1471,6
+1471,7
@@
void ceph_dentry_lru_del(struct dentry *dn)
unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn)
{
struct ceph_inode_info *dci = ceph_inode(dir);
+ unsigned hash;
switch (dci->i_dir_layout.dl_dir_hash) {
case 0: /* for backward compat */
@@
-1478,8
+1479,11
@@
unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn)
return dn->d_name.hash;
default:
- return ceph_str_hash(dci->i_dir_layout.dl_dir_hash,
+ spin_lock(&dn->d_lock);
+ hash = ceph_str_hash(dci->i_dir_layout.dl_dir_hash,
dn->d_name.name, dn->d_name.len);
+ spin_unlock(&dn->d_lock);
+ return hash;
}
}