Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234041
b: refs/heads/master
c: d891eed
h: refs/heads/master
i:
  234039: 9793d90
v: v3
  • Loading branch information
J. Bruce Fields authored and Al Viro committed Mar 10, 2011
1 parent 0ff5ea0 commit 694a619
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 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: 1ca551c6caae7b52178555cdedea6ca26444be46
refs/heads/master: d891eedbc3b1b0fade8a9ce60cc0eba1cccb59e5
26 changes: 24 additions & 2 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1523,6 +1523,28 @@ struct dentry * d_alloc_root(struct inode * root_inode)
}
EXPORT_SYMBOL(d_alloc_root);

static struct dentry * __d_find_any_alias(struct inode *inode)
{
struct dentry *alias;

if (list_empty(&inode->i_dentry))
return NULL;
alias = list_first_entry(&inode->i_dentry, struct dentry, d_alias);
__dget(alias);
return alias;
}

static struct dentry * d_find_any_alias(struct inode *inode)
{
struct dentry *de;

spin_lock(&inode->i_lock);
de = __d_find_any_alias(inode);
spin_unlock(&inode->i_lock);
return de;
}


/**
* d_obtain_alias - find or allocate a dentry for a given inode
* @inode: inode to allocate the dentry for
Expand Down Expand Up @@ -1552,7 +1574,7 @@ struct dentry *d_obtain_alias(struct inode *inode)
if (IS_ERR(inode))
return ERR_CAST(inode);

res = d_find_alias(inode);
res = d_find_any_alias(inode);
if (res)
goto out_iput;

Expand All @@ -1565,7 +1587,7 @@ struct dentry *d_obtain_alias(struct inode *inode)


spin_lock(&inode->i_lock);
res = __d_find_alias(inode, 0);
res = __d_find_any_alias(inode);
if (res) {
spin_unlock(&inode->i_lock);
dput(tmp);
Expand Down

0 comments on commit 694a619

Please sign in to comment.