mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
ceph: ensure d_name stability in ceph_dentry_hash()
Take the d_lock here to ensure that d_name doesn't change. Cc: [email protected] Signed-off-by: Jeff Layton <[email protected]> Reviewed-by: "Yan, Zheng" <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
This commit is contained in:
parent
1bcb344086
commit
76a495d666
1 changed files with 5 additions and 1 deletions
|
|
@ -1766,6 +1766,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
|
|||
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 */
|
||||
|
|
@ -1773,8 +1774,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue