Skip to content

Commit

Permalink
configfs: move d_rehash() into configfs_create() for regular files
Browse files Browse the repository at this point in the history
... and turn it into d_add in there

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Mar 14, 2016
1 parent f7380af commit 5cf3b56
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
9 changes: 2 additions & 7 deletions fs/configfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,9 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den
(sd->s_type & CONFIGFS_ITEM_BIN_ATTR) ?
configfs_init_bin_file :
configfs_init_file);
if (error) {
if (error)
configfs_put(sd);
return error;
}

d_rehash(dentry);

return 0;
return error;
}

static struct dentry * configfs_lookup(struct inode *dir,
Expand Down
12 changes: 10 additions & 2 deletions fs/configfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,17 @@ int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct in
configfs_set_inode_lock_class(sd, inode);

init(inode);
d_instantiate(dentry, inode);
if (S_ISDIR(mode) || S_ISLNK(mode))
if (S_ISDIR(mode) || S_ISLNK(mode)) {
/*
* ->symlink(), ->mkdir(), configfs_register_subsystem() or
* create_default_group() - already hashed.
*/
d_instantiate(dentry, inode);
dget(dentry); /* pin link and directory dentries in core */
} else {
/* ->lookup() */
d_add(dentry, inode);
}
return error;
}

Expand Down

0 comments on commit 5cf3b56

Please sign in to comment.