Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117478
b: refs/heads/master
c: 360da90
h: refs/heads/master
v: v3
  • Loading branch information
OGAWA Hirofumi authored and Al Viro committed Oct 23, 2008
1 parent a20dfb9 commit 41b5271
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 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: e2761a1167633ed943fea29002f990194923d060
refs/heads/master: 360da90029196c9449bc61e5a07ce8404e4cba57
31 changes: 16 additions & 15 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,15 @@ struct dentry *d_alloc_name(struct dentry *parent, const char *name)
return d_alloc(parent, &q);
}

/* the caller must hold dcache_lock */
static void __d_instantiate(struct dentry *dentry, struct inode *inode)
{
if (inode)
list_add(&dentry->d_alias, &inode->i_dentry);
dentry->d_inode = inode;
fsnotify_d_instantiate(dentry, inode);
}

/**
* d_instantiate - fill in inode information for a dentry
* @entry: dentry to complete
Expand All @@ -1000,10 +1009,7 @@ void d_instantiate(struct dentry *entry, struct inode * inode)
{
BUG_ON(!list_empty(&entry->d_alias));
spin_lock(&dcache_lock);
if (inode)
list_add(&entry->d_alias, &inode->i_dentry);
entry->d_inode = inode;
fsnotify_d_instantiate(entry, inode);
__d_instantiate(entry, inode);
spin_unlock(&dcache_lock);
security_d_instantiate(entry, inode);
}
Expand Down Expand Up @@ -1033,7 +1039,7 @@ static struct dentry *__d_instantiate_unique(struct dentry *entry,
unsigned int hash = entry->d_name.hash;

if (!inode) {
entry->d_inode = NULL;
__d_instantiate(entry, NULL);
return NULL;
}

Expand All @@ -1052,9 +1058,7 @@ static struct dentry *__d_instantiate_unique(struct dentry *entry,
return alias;
}

list_add(&entry->d_alias, &inode->i_dentry);
entry->d_inode = inode;
fsnotify_d_instantiate(entry, inode);
__d_instantiate(entry, inode);
return NULL;
}

Expand Down Expand Up @@ -1213,10 +1217,8 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
d_move(new, dentry);
iput(inode);
} else {
/* d_instantiate takes dcache_lock, so we do it by hand */
list_add(&dentry->d_alias, &inode->i_dentry);
dentry->d_inode = inode;
fsnotify_d_instantiate(dentry, inode);
/* already taking dcache_lock, so d_add() by hand */
__d_instantiate(dentry, inode);
spin_unlock(&dcache_lock);
security_d_instantiate(dentry, inode);
d_rehash(dentry);
Expand Down Expand Up @@ -1299,8 +1301,7 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
* d_instantiate() by hand because it takes dcache_lock which
* we already hold.
*/
list_add(&found->d_alias, &inode->i_dentry);
found->d_inode = inode;
__d_instantiate(found, inode);
spin_unlock(&dcache_lock);
security_d_instantiate(found, inode);
return found;
Expand Down Expand Up @@ -1833,7 +1834,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)

if (!inode) {
actual = dentry;
dentry->d_inode = NULL;
__d_instantiate(dentry, NULL);
goto found_lock;
}

Expand Down

0 comments on commit 41b5271

Please sign in to comment.