diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2018-05-03 15:45:06 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-05-26 20:20:50 +0200 |
commit | 888e2b03ef56694290e58bd9ac23f8033bf6369f (patch) | |
tree | 71b2bfef0e1a8c09b47ceac8d1f94411499e5c94 /fs/proc/proc_sysctl.c | |
parent | procfs: switch instantiate_t to d_splice_alias() (diff) | |
download | linux-888e2b03ef56694290e58bd9ac23f8033bf6369f.tar.xz linux-888e2b03ef56694290e58bd9ac23f8033bf6369f.zip |
switch the rest of procfs lookups to d_splice_alias()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc/proc_sysctl.c')
-rw-r--r-- | fs/proc/proc_sysctl.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 8989936f2995..4d765e5e91ed 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -554,9 +554,8 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, if (!inode) goto out; - err = NULL; d_set_d_op(dentry, &proc_sys_dentry_operations); - d_add(dentry, inode); + err = d_splice_alias(inode, dentry); out: if (h) @@ -684,6 +683,7 @@ static bool proc_sys_fill_cache(struct file *file, if (IS_ERR(child)) return false; if (d_in_lookup(child)) { + struct dentry *res; inode = proc_sys_make_inode(dir->d_sb, head, table); if (!inode) { d_lookup_done(child); @@ -691,7 +691,16 @@ static bool proc_sys_fill_cache(struct file *file, return false; } d_set_d_op(child, &proc_sys_dentry_operations); - d_add(child, inode); + res = d_splice_alias(inode, child); + d_lookup_done(child); + if (unlikely(res)) { + if (IS_ERR(res)) { + dput(child); + return false; + } + dput(child); + child = res; + } } } inode = d_inode(child); |