diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:25:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:25:04 -0400 |
commit | aab174f0df5d72d31caccf281af5f614fa254578 (patch) | |
tree | 2a172c5009c4ac8755e858593154c258ce7709a0 /net/core | |
parent | ca41cc96b2813221b05af57d0355157924de5a07 (diff) | |
parent | 2bd2c1941f141ad780135ccc1cd08ca71a24f10a (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs update from Al Viro:
- big one - consolidation of descriptor-related logics; almost all of
that is moved to fs/file.c
(BTW, I'm seriously tempted to rename the result to fd.c. As it is,
we have a situation when file_table.c is about handling of struct
file and file.c is about handling of descriptor tables; the reasons
are historical - file_table.c used to be about a static array of
struct file we used to have way back).
A lot of stray ends got cleaned up and converted to saner primitives,
disgusting mess in android/binder.c is still disgusting, but at least
doesn't poke so much in descriptor table guts anymore. A bunch of
relatively minor races got fixed in process, plus an ext4 struct file
leak.
- related thing - fget_light() partially unuglified; see fdget() in
there (and yes, it generates the code as good as we used to have).
- also related - bits of Cyrill's procfs stuff that got entangled into
that work; _not_ all of it, just the initial move to fs/proc/fd.c and
switch of fdinfo to seq_file.
- Alex's fs/coredump.c spiltoff - the same story, had been easier to
take that commit than mess with conflicts. The rest is a separate
pile, this was just a mechanical code movement.
- a few misc patches all over the place. Not all for this cycle,
there'll be more (and quite a few currently sit in akpm's tree)."
Fix up trivial conflicts in the android binder driver, and some fairly
simple conflicts due to two different changes to the sock_alloc_file()
interface ("take descriptor handling from sock_alloc_file() to callers"
vs "net: Providing protocol type via system.sockprotoname xattr of
/proc/PID/fd entries" adding a dentry name to the socket)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (72 commits)
MAX_LFS_FILESIZE should be a loff_t
compat: fs: Generic compat_sys_sendfile implementation
fs: push rcu_barrier() from deactivate_locked_super() to filesystems
btrfs: reada_extent doesn't need kref for refcount
coredump: move core dump functionality into its own file
coredump: prevent double-free on an error path in core dumper
usb/gadget: fix misannotations
fcntl: fix misannotations
ceph: don't abuse d_delete() on failure exits
hypfs: ->d_parent is never NULL or negative
vfs: delete surplus inode NULL check
switch simple cases of fget_light to fdget
new helpers: fdget()/fdput()
switch o2hb_region_dev_write() to fget_light()
proc_map_files_readdir(): don't bother with grabbing files
make get_file() return its argument
vhost_set_vring(): turn pollstart/pollstop into bool
switch prctl_set_mm_exe_file() to fget_light()
switch xfs_find_handle() to fget_light()
switch xfs_swapext() to fget_light()
...
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/netprio_cgroup.c | 38 | ||||
-rw-r--r-- | net/core/scm.c | 3 |
2 files changed, 13 insertions, 28 deletions
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index 4a83fb3c8e87..79285a36035f 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
@@ -239,38 +239,24 @@ out_free_devname: | |||
239 | return ret; | 239 | return ret; |
240 | } | 240 | } |
241 | 241 | ||
242 | static int update_netprio(const void *v, struct file *file, unsigned n) | ||
243 | { | ||
244 | int err; | ||
245 | struct socket *sock = sock_from_file(file, &err); | ||
246 | if (sock) | ||
247 | sock->sk->sk_cgrp_prioidx = (u32)(unsigned long)v; | ||
248 | return 0; | ||
249 | } | ||
250 | |||
242 | void net_prio_attach(struct cgroup *cgrp, struct cgroup_taskset *tset) | 251 | void net_prio_attach(struct cgroup *cgrp, struct cgroup_taskset *tset) |
243 | { | 252 | { |
244 | struct task_struct *p; | 253 | struct task_struct *p; |
254 | void *v; | ||
245 | 255 | ||
246 | cgroup_taskset_for_each(p, cgrp, tset) { | 256 | cgroup_taskset_for_each(p, cgrp, tset) { |
247 | unsigned int fd; | ||
248 | struct fdtable *fdt; | ||
249 | struct files_struct *files; | ||
250 | |||
251 | task_lock(p); | 257 | task_lock(p); |
252 | files = p->files; | 258 | v = (void *)(unsigned long)task_netprioidx(p); |
253 | if (!files) { | 259 | iterate_fd(p->files, 0, update_netprio, v); |
254 | task_unlock(p); | ||
255 | continue; | ||
256 | } | ||
257 | |||
258 | spin_lock(&files->file_lock); | ||
259 | fdt = files_fdtable(files); | ||
260 | for (fd = 0; fd < fdt->max_fds; fd++) { | ||
261 | struct file *file; | ||
262 | struct socket *sock; | ||
263 | int err; | ||
264 | |||
265 | file = fcheck_files(files, fd); | ||
266 | if (!file) | ||
267 | continue; | ||
268 | |||
269 | sock = sock_from_file(file, &err); | ||
270 | if (sock) | ||
271 | sock_update_netprioidx(sock->sk, p); | ||
272 | } | ||
273 | spin_unlock(&files->file_lock); | ||
274 | task_unlock(p); | 260 | task_unlock(p); |
275 | } | 261 | } |
276 | } | 262 | } |
diff --git a/net/core/scm.c b/net/core/scm.c index 9c1c63da3ca8..ab570841a532 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -301,11 +301,10 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) | |||
301 | break; | 301 | break; |
302 | } | 302 | } |
303 | /* Bump the usage count and install the file. */ | 303 | /* Bump the usage count and install the file. */ |
304 | get_file(fp[i]); | ||
305 | sock = sock_from_file(fp[i], &err); | 304 | sock = sock_from_file(fp[i], &err); |
306 | if (sock) | 305 | if (sock) |
307 | sock_update_netprioidx(sock->sk, current); | 306 | sock_update_netprioidx(sock->sk, current); |
308 | fd_install(new_fd, fp[i]); | 307 | fd_install(new_fd, get_file(fp[i])); |
309 | } | 308 | } |
310 | 309 | ||
311 | if (i > 0) | 310 | if (i > 0) |