Commit 888e2b03 authored by Al Viro's avatar Al Viro

switch the rest of procfs lookups to d_splice_alias()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0168b9e3
...@@ -256,8 +256,7 @@ struct dentry *proc_lookup_de(struct inode *dir, struct dentry *dentry, ...@@ -256,8 +256,7 @@ struct dentry *proc_lookup_de(struct inode *dir, struct dentry *dentry,
if (!inode) if (!inode)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
d_set_d_op(dentry, &proc_misc_dentry_ops); d_set_d_op(dentry, &proc_misc_dentry_ops);
d_add(dentry, inode); return d_splice_alias(inode, dentry);
return NULL;
} }
read_unlock(&proc_subdir_lock); read_unlock(&proc_subdir_lock);
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
......
...@@ -554,9 +554,8 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, ...@@ -554,9 +554,8 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
if (!inode) if (!inode)
goto out; goto out;
err = NULL;
d_set_d_op(dentry, &proc_sys_dentry_operations); d_set_d_op(dentry, &proc_sys_dentry_operations);
d_add(dentry, inode); err = d_splice_alias(inode, dentry);
out: out:
if (h) if (h)
...@@ -684,6 +683,7 @@ static bool proc_sys_fill_cache(struct file *file, ...@@ -684,6 +683,7 @@ static bool proc_sys_fill_cache(struct file *file,
if (IS_ERR(child)) if (IS_ERR(child))
return false; return false;
if (d_in_lookup(child)) { if (d_in_lookup(child)) {
struct dentry *res;
inode = proc_sys_make_inode(dir->d_sb, head, table); inode = proc_sys_make_inode(dir->d_sb, head, table);
if (!inode) { if (!inode) {
d_lookup_done(child); d_lookup_done(child);
...@@ -691,7 +691,16 @@ static bool proc_sys_fill_cache(struct file *file, ...@@ -691,7 +691,16 @@ static bool proc_sys_fill_cache(struct file *file,
return false; return false;
} }
d_set_d_op(child, &proc_sys_dentry_operations); 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); inode = d_inode(child);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment