Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359179
b: refs/heads/master
c: 4f522a2
h: refs/heads/master
i:
  359177: 33f6d2c
  359175: 60ffb05
v: v3
  • Loading branch information
Al Viro committed Feb 26, 2013
1 parent e1c2aba commit 5d27f2a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3592ac444017996f5a8ecf85856af0a8938e8fd1
refs/heads/master: 4f522a247bc26d4ab5c8fc406ffffa8b3a77abe3
8 changes: 3 additions & 5 deletions trunk/fs/cifs/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,

cFYI(1, "%s: for %s", __func__, name->name);

if (parent->d_op && parent->d_op->d_hash)
parent->d_op->d_hash(parent, parent->d_inode, name);
else
name->hash = full_name_hash(name->name, name->len);
dentry = d_hash_and_lookup(parent, name);
if (unlikely(IS_ERR(dentry)))
return;

dentry = d_lookup(parent, name);
if (dentry) {
int err;

Expand Down
23 changes: 11 additions & 12 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,6 @@ EXPORT_SYMBOL(d_splice_alias);
struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
struct qstr *name)
{
int error;
struct dentry *found;
struct dentry *new;

Expand All @@ -1681,10 +1680,12 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
* if not go ahead and create it now.
*/
found = d_hash_and_lookup(dentry->d_parent, name);
if (unlikely(IS_ERR(found)))
goto err_out;
if (!found) {
new = d_alloc(dentry->d_parent, name);
if (!new) {
error = -ENOMEM;
found = ERR_PTR(-ENOMEM);
goto err_out;
}

Expand Down Expand Up @@ -1725,7 +1726,7 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,

err_out:
iput(inode);
return ERR_PTR(error);
return found;
}
EXPORT_SYMBOL(d_add_ci);

Expand Down Expand Up @@ -1997,26 +1998,24 @@ struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name)
* @dir: Directory to search in
* @name: qstr of name we wish to find
*
* On hash failure or on lookup failure NULL is returned.
* On lookup failure NULL is returned; on bad name - ERR_PTR(-error)
*/
struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name)
{
struct dentry *dentry = NULL;

/*
* Check for a fs-specific hash function. Note that we must
* calculate the standard hash first, as the d_op->d_hash()
* routine may choose to leave the hash value unchanged.
*/
name->hash = full_name_hash(name->name, name->len);
if (dir->d_flags & DCACHE_OP_HASH) {
if (dir->d_op->d_hash(dir, dir->d_inode, name) < 0)
goto out;
int err = dir->d_op->d_hash(dir, dir->d_inode, name);
if (unlikely(err < 0))
return ERR_PTR(err);
}
dentry = d_lookup(dir, name);
out:
return dentry;
return d_lookup(dir, name);
}
EXPORT_SYMBOL(d_hash_and_lookup);

/**
* d_validate - verify dentry provided from insecure source (deprecated)
Expand Down Expand Up @@ -2995,7 +2994,7 @@ ino_t find_inode_number(struct dentry *dir, struct qstr *name)
ino_t ino = 0;

dentry = d_hash_and_lookup(dir, name);
if (dentry) {
if (!IS_ERR_OR_NULL(dentry)) {
if (dentry->d_inode)
ino = dentry->d_inode->i_ino;
dput(dentry);
Expand Down
10 changes: 3 additions & 7 deletions trunk/fs/ncpfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,14 +593,10 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
return 1; /* I'm not sure */

qname.name = __name;
qname.hash = full_name_hash(qname.name, qname.len);

if (dentry->d_op && dentry->d_op->d_hash)
if (dentry->d_op->d_hash(dentry, dentry->d_inode, &qname) != 0)
goto end_advance;

newdent = d_lookup(dentry, &qname);

newdent = d_hash_and_lookup(dentry, &qname);
if (unlikely(IS_ERR(newdent)))
goto end_advance;
if (!newdent) {
newdent = d_alloc(dentry, &qname);
if (!newdent)
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2618,6 +2618,7 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid)

name.name = buf;
name.len = snprintf(buf, sizeof(buf), "%d", pid);
/* no ->d_hash() rejects on procfs */
dentry = d_hash_and_lookup(mnt->mnt_root, &name);
if (dentry) {
shrink_dcache_parent(dentry);
Expand Down

0 comments on commit 5d27f2a

Please sign in to comment.