aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-12-29 15:58:39 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-12-30 13:01:03 -0500
commitfceef393a538134f03b778c5d2519e670269342f (patch)
treecd43c9afdc07852d286965ad4d11772f6c275d1a /fs/proc
parentcd3417c8fc9504cc1afe944515f338aff9ec286b (diff)
switch ->get_link() to delayed_call, kill ->put_link()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/base.c8
-rw-r--r--fs/proc/inode.c16
-rw-r--r--fs/proc/namespaces.c3
-rw-r--r--fs/proc/self.c7
-rw-r--r--fs/proc/thread_self.c7
5 files changed, 23 insertions, 18 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 1a489e2b9768..71660bb9e9f7 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1565,7 +1565,8 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
1565} 1565}
1566 1566
1567static const char *proc_pid_get_link(struct dentry *dentry, 1567static const char *proc_pid_get_link(struct dentry *dentry,
1568 struct inode *inode, void **cookie) 1568 struct inode *inode,
1569 struct delayed_call *done)
1569{ 1570{
1570 struct path path; 1571 struct path path;
1571 int error = -EACCES; 1572 int error = -EACCES;
@@ -1949,12 +1950,13 @@ struct map_files_info {
1949 */ 1950 */
1950static const char * 1951static const char *
1951proc_map_files_get_link(struct dentry *dentry, 1952proc_map_files_get_link(struct dentry *dentry,
1952 struct inode *inode, void **cookie) 1953 struct inode *inode,
1954 struct delayed_call *done)
1953{ 1955{
1954 if (!capable(CAP_SYS_ADMIN)) 1956 if (!capable(CAP_SYS_ADMIN))
1955 return ERR_PTR(-EPERM); 1957 return ERR_PTR(-EPERM);
1956 1958
1957 return proc_pid_get_link(dentry, inode, NULL); 1959 return proc_pid_get_link(dentry, inode, done);
1958} 1960}
1959 1961
1960/* 1962/*
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 10360b268794..d0e9b9b6223e 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -393,25 +393,25 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
393}; 393};
394#endif 394#endif
395 395
396static void proc_put_link(void *p)
397{
398 unuse_pde(p);
399}
400
396static const char *proc_get_link(struct dentry *dentry, 401static const char *proc_get_link(struct dentry *dentry,
397 struct inode *inode, void **cookie) 402 struct inode *inode,
403 struct delayed_call *done)
398{ 404{
399 struct proc_dir_entry *pde = PDE(inode); 405 struct proc_dir_entry *pde = PDE(inode);
400 if (unlikely(!use_pde(pde))) 406 if (unlikely(!use_pde(pde)))
401 return ERR_PTR(-EINVAL); 407 return ERR_PTR(-EINVAL);
402 *cookie = pde; 408 set_delayed_call(done, proc_put_link, pde);
403 return pde->data; 409 return pde->data;
404} 410}
405 411
406static void proc_put_link(struct inode *unused, void *p)
407{
408 unuse_pde(p);
409}
410
411const struct inode_operations proc_link_inode_operations = { 412const struct inode_operations proc_link_inode_operations = {
412 .readlink = generic_readlink, 413 .readlink = generic_readlink,
413 .get_link = proc_get_link, 414 .get_link = proc_get_link,
414 .put_link = proc_put_link,
415}; 415};
416 416
417struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) 417struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index 63861c15e109..1dece8781f91 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -31,7 +31,8 @@ static const struct proc_ns_operations *ns_entries[] = {
31}; 31};
32 32
33static const char *proc_ns_get_link(struct dentry *dentry, 33static const char *proc_ns_get_link(struct dentry *dentry,
34 struct inode *inode, void **cookie) 34 struct inode *inode,
35 struct delayed_call *done)
35{ 36{
36 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; 37 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops;
37 struct task_struct *task; 38 struct task_struct *task;
diff --git a/fs/proc/self.c b/fs/proc/self.c
index 7a8b19ead3b6..67e8db442cf0 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -19,7 +19,8 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
19} 19}
20 20
21static const char *proc_self_get_link(struct dentry *dentry, 21static const char *proc_self_get_link(struct dentry *dentry,
22 struct inode *inode, void **cookie) 22 struct inode *inode,
23 struct delayed_call *done)
23{ 24{
24 struct pid_namespace *ns = inode->i_sb->s_fs_info; 25 struct pid_namespace *ns = inode->i_sb->s_fs_info;
25 pid_t tgid = task_tgid_nr_ns(current, ns); 26 pid_t tgid = task_tgid_nr_ns(current, ns);
@@ -32,13 +33,13 @@ static const char *proc_self_get_link(struct dentry *dentry,
32 if (unlikely(!name)) 33 if (unlikely(!name))
33 return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD); 34 return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD);
34 sprintf(name, "%d", tgid); 35 sprintf(name, "%d", tgid);
35 return *cookie = name; 36 set_delayed_call(done, kfree_link, name);
37 return name;
36} 38}
37 39
38static const struct inode_operations proc_self_inode_operations = { 40static const struct inode_operations proc_self_inode_operations = {
39 .readlink = proc_self_readlink, 41 .readlink = proc_self_readlink,
40 .get_link = proc_self_get_link, 42 .get_link = proc_self_get_link,
41 .put_link = kfree_put_link,
42}; 43};
43 44
44static unsigned self_inum; 45static unsigned self_inum;
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index 03eaa84604da..9eacd59e0360 100644
--- a/fs/proc/thread_self.c
+++ b/fs/proc/thread_self.c
@@ -20,7 +20,8 @@ static int proc_thread_self_readlink(struct dentry *dentry, char __user *buffer,
20} 20}
21 21
22static const char *proc_thread_self_get_link(struct dentry *dentry, 22static const char *proc_thread_self_get_link(struct dentry *dentry,
23 struct inode *inode, void **cookie) 23 struct inode *inode,
24 struct delayed_call *done)
24{ 25{
25 struct pid_namespace *ns = inode->i_sb->s_fs_info; 26 struct pid_namespace *ns = inode->i_sb->s_fs_info;
26 pid_t tgid = task_tgid_nr_ns(current, ns); 27 pid_t tgid = task_tgid_nr_ns(current, ns);
@@ -34,13 +35,13 @@ static const char *proc_thread_self_get_link(struct dentry *dentry,
34 if (unlikely(!name)) 35 if (unlikely(!name))
35 return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD); 36 return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD);
36 sprintf(name, "%d/task/%d", tgid, pid); 37 sprintf(name, "%d/task/%d", tgid, pid);
37 return *cookie = name; 38 set_delayed_call(done, kfree_link, name);
39 return name;
38} 40}
39 41
40static const struct inode_operations proc_thread_self_inode_operations = { 42static const struct inode_operations proc_thread_self_inode_operations = {
41 .readlink = proc_thread_self_readlink, 43 .readlink = proc_thread_self_readlink,
42 .get_link = proc_thread_self_get_link, 44 .get_link = proc_thread_self_get_link,
43 .put_link = kfree_put_link,
44}; 45};
45 46
46static unsigned thread_self_inum; 47static unsigned thread_self_inum;