diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-10 15:44:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-10 15:44:24 -0400 |
commit | b05430fc9341fea7a6228a3611c850a476809596 (patch) | |
tree | 91bd662d269a3478db78d6a04a34901f0cfe521b /kernel | |
parent | d0d272771035a36a7839bb70ab6ebae3f4f4960b (diff) | |
parent | 48f5ec21d9c67e881ff35343988e290ef5cf933f (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile 3 (of many) from Al Viro:
"Waiman's conversion of d_path() and bits related to it,
kern_path_mountpoint(), several cleanups and fixes (exportfs
one is -stable fodder, IMO).
There definitely will be more... ;-/"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
split read_seqretry_or_unlock(), convert d_walk() to resulting primitives
dcache: Translating dentry into pathname without taking rename_lock
autofs4 - fix device ioctl mount lookup
introduce kern_path_mountpoint()
rename user_path_umountat() to user_path_mountpoint_at()
take unlazy_walk() into umount_lookup_last()
Kill indirect include of file.h from eventfd.h, use fdget() in cgroup.c
prune_super(): sb->s_op is never NULL
exportfs: don't assume that ->iterate() won't feed us too long entries
afs: get rid of redundant ->d_name.len checks
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index e0aeb32415ff..2418b6e71a85 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/poll.h> | 60 | #include <linux/poll.h> |
61 | #include <linux/flex_array.h> /* used in cgroup_attach_task */ | 61 | #include <linux/flex_array.h> /* used in cgroup_attach_task */ |
62 | #include <linux/kthread.h> | 62 | #include <linux/kthread.h> |
63 | #include <linux/file.h> | ||
63 | 64 | ||
64 | #include <linux/atomic.h> | 65 | #include <linux/atomic.h> |
65 | 66 | ||
@@ -4034,8 +4035,8 @@ static int cgroup_write_event_control(struct cgroup_subsys_state *dummy_css, | |||
4034 | struct cgroup_event *event; | 4035 | struct cgroup_event *event; |
4035 | struct cgroup_subsys_state *cfile_css; | 4036 | struct cgroup_subsys_state *cfile_css; |
4036 | unsigned int efd, cfd; | 4037 | unsigned int efd, cfd; |
4037 | struct file *efile; | 4038 | struct fd efile; |
4038 | struct file *cfile; | 4039 | struct fd cfile; |
4039 | char *endp; | 4040 | char *endp; |
4040 | int ret; | 4041 | int ret; |
4041 | 4042 | ||
@@ -4058,31 +4059,31 @@ static int cgroup_write_event_control(struct cgroup_subsys_state *dummy_css, | |||
4058 | init_waitqueue_func_entry(&event->wait, cgroup_event_wake); | 4059 | init_waitqueue_func_entry(&event->wait, cgroup_event_wake); |
4059 | INIT_WORK(&event->remove, cgroup_event_remove); | 4060 | INIT_WORK(&event->remove, cgroup_event_remove); |
4060 | 4061 | ||
4061 | efile = eventfd_fget(efd); | 4062 | efile = fdget(efd); |
4062 | if (IS_ERR(efile)) { | 4063 | if (!efile.file) { |
4063 | ret = PTR_ERR(efile); | 4064 | ret = -EBADF; |
4064 | goto out_kfree; | 4065 | goto out_kfree; |
4065 | } | 4066 | } |
4066 | 4067 | ||
4067 | event->eventfd = eventfd_ctx_fileget(efile); | 4068 | event->eventfd = eventfd_ctx_fileget(efile.file); |
4068 | if (IS_ERR(event->eventfd)) { | 4069 | if (IS_ERR(event->eventfd)) { |
4069 | ret = PTR_ERR(event->eventfd); | 4070 | ret = PTR_ERR(event->eventfd); |
4070 | goto out_put_efile; | 4071 | goto out_put_efile; |
4071 | } | 4072 | } |
4072 | 4073 | ||
4073 | cfile = fget(cfd); | 4074 | cfile = fdget(cfd); |
4074 | if (!cfile) { | 4075 | if (!cfile.file) { |
4075 | ret = -EBADF; | 4076 | ret = -EBADF; |
4076 | goto out_put_eventfd; | 4077 | goto out_put_eventfd; |
4077 | } | 4078 | } |
4078 | 4079 | ||
4079 | /* the process need read permission on control file */ | 4080 | /* the process need read permission on control file */ |
4080 | /* AV: shouldn't we check that it's been opened for read instead? */ | 4081 | /* AV: shouldn't we check that it's been opened for read instead? */ |
4081 | ret = inode_permission(file_inode(cfile), MAY_READ); | 4082 | ret = inode_permission(file_inode(cfile.file), MAY_READ); |
4082 | if (ret < 0) | 4083 | if (ret < 0) |
4083 | goto out_put_cfile; | 4084 | goto out_put_cfile; |
4084 | 4085 | ||
4085 | event->cft = __file_cft(cfile); | 4086 | event->cft = __file_cft(cfile.file); |
4086 | if (IS_ERR(event->cft)) { | 4087 | if (IS_ERR(event->cft)) { |
4087 | ret = PTR_ERR(event->cft); | 4088 | ret = PTR_ERR(event->cft); |
4088 | goto out_put_cfile; | 4089 | goto out_put_cfile; |
@@ -4103,7 +4104,7 @@ static int cgroup_write_event_control(struct cgroup_subsys_state *dummy_css, | |||
4103 | 4104 | ||
4104 | ret = -EINVAL; | 4105 | ret = -EINVAL; |
4105 | event->css = cgroup_css(cgrp, event->cft->ss); | 4106 | event->css = cgroup_css(cgrp, event->cft->ss); |
4106 | cfile_css = css_from_dir(cfile->f_dentry->d_parent, event->cft->ss); | 4107 | cfile_css = css_from_dir(cfile.file->f_dentry->d_parent, event->cft->ss); |
4107 | if (event->css && event->css == cfile_css && css_tryget(event->css)) | 4108 | if (event->css && event->css == cfile_css && css_tryget(event->css)) |
4108 | ret = 0; | 4109 | ret = 0; |
4109 | 4110 | ||
@@ -4121,25 +4122,25 @@ static int cgroup_write_event_control(struct cgroup_subsys_state *dummy_css, | |||
4121 | if (ret) | 4122 | if (ret) |
4122 | goto out_put_css; | 4123 | goto out_put_css; |
4123 | 4124 | ||
4124 | efile->f_op->poll(efile, &event->pt); | 4125 | efile.file->f_op->poll(efile.file, &event->pt); |
4125 | 4126 | ||
4126 | spin_lock(&cgrp->event_list_lock); | 4127 | spin_lock(&cgrp->event_list_lock); |
4127 | list_add(&event->list, &cgrp->event_list); | 4128 | list_add(&event->list, &cgrp->event_list); |
4128 | spin_unlock(&cgrp->event_list_lock); | 4129 | spin_unlock(&cgrp->event_list_lock); |
4129 | 4130 | ||
4130 | fput(cfile); | 4131 | fdput(cfile); |
4131 | fput(efile); | 4132 | fdput(efile); |
4132 | 4133 | ||
4133 | return 0; | 4134 | return 0; |
4134 | 4135 | ||
4135 | out_put_css: | 4136 | out_put_css: |
4136 | css_put(event->css); | 4137 | css_put(event->css); |
4137 | out_put_cfile: | 4138 | out_put_cfile: |
4138 | fput(cfile); | 4139 | fdput(cfile); |
4139 | out_put_eventfd: | 4140 | out_put_eventfd: |
4140 | eventfd_ctx_put(event->eventfd); | 4141 | eventfd_ctx_put(event->eventfd); |
4141 | out_put_efile: | 4142 | out_put_efile: |
4142 | fput(efile); | 4143 | fdput(efile); |
4143 | out_kfree: | 4144 | out_kfree: |
4144 | kfree(event); | 4145 | kfree(event); |
4145 | 4146 | ||