diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-19 13:09:28 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-19 13:09:28 -0700 |
commit | c9fe5630dae1df2328d82042602e2c4d1add8d57 (patch) | |
tree | 7429c9a2f36fc8b1410cfebe45762cbc9b5d84b8 /fs/configfs/inode.c | |
parent | 7e3d2c8210e67ebff472a0b371bb0efb4236ef52 (diff) | |
parent | e9c03af21cc7e5723d4f1e90fe45d2cdccb70dc7 (diff) |
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()
Diffstat (limited to 'fs/configfs/inode.c')
-rw-r--r-- | fs/configfs/inode.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index 884dcf06cfbe..680aba9c00d5 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c @@ -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; } /* |