Merge tag 'configfs-for-5.4' of git://git.infradead.org/users/hch/configfs
Pull configfs updates from Christoph Hellwig: - fix a symlink deadlock (Al Viro) - various cleanups (Al Viro, me) * tag 'configfs-for-5.4' of git://git.infradead.org/users/hch/configfs: configfs: calculate the symlink target only once configfs: make configfs_create() return inode configfs: factor dirent removal into helpers configfs: fix a deadlock in configfs_symlink()
This commit is contained in:
@@ -164,41 +164,27 @@ static void configfs_set_inode_lock_class(struct configfs_dirent *sd,
|
||||
|
||||
#endif /* CONFIG_LOCKDEP */
|
||||
|
||||
int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct inode *))
|
||||
struct inode *configfs_create(struct dentry *dentry, umode_t mode)
|
||||
{
|
||||
int error = 0;
|
||||
struct inode *inode = NULL;
|
||||
struct configfs_dirent *sd;
|
||||
struct inode *p_inode;
|
||||
|
||||
if (!dentry)
|
||||
return -ENOENT;
|
||||
return ERR_PTR(-ENOENT);
|
||||
|
||||
if (d_really_is_positive(dentry))
|
||||
return -EEXIST;
|
||||
return ERR_PTR(-EEXIST);
|
||||
|
||||
sd = dentry->d_fsdata;
|
||||
inode = configfs_new_inode(mode, sd, dentry->d_sb);
|
||||
if (!inode)
|
||||
return -ENOMEM;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
p_inode = d_inode(dentry->d_parent);
|
||||
p_inode->i_mtime = p_inode->i_ctime = current_time(p_inode);
|
||||
configfs_set_inode_lock_class(sd, inode);
|
||||
|
||||
init(inode);
|
||||
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;
|
||||
return inode;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user