From 5cf3b560af903c82e9fc12578fac2fbcb8ca1533 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 7 Mar 2016 14:25:46 -0500 Subject: configfs: move d_rehash() into configfs_create() for regular files ... and turn it into d_add in there Signed-off-by: Al Viro --- fs/configfs/inode.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'fs/configfs/inode.c') diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index cee087d8f7e0..45811ea3fd87 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c @@ -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; } -- cgit v1.2.3