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 /arch/powerpc | |
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 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/systbl.h | 4 | ||||
-rw-r--r-- | arch/powerpc/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/sys_ppc32.c | 45 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_syscalls.c | 21 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/coredump.c | 40 |
5 files changed, 39 insertions, 72 deletions
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index 559ae1ee6706..840838769853 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h | |||
@@ -189,7 +189,7 @@ SYSCALL_SPU(getcwd) | |||
189 | SYSCALL_SPU(capget) | 189 | SYSCALL_SPU(capget) |
190 | SYSCALL_SPU(capset) | 190 | SYSCALL_SPU(capset) |
191 | COMPAT_SYS(sigaltstack) | 191 | COMPAT_SYS(sigaltstack) |
192 | SYSX_SPU(sys_sendfile64,compat_sys_sendfile,sys_sendfile) | 192 | SYSX_SPU(sys_sendfile,compat_sys_sendfile_wrapper,sys_sendfile) |
193 | SYSCALL(ni_syscall) | 193 | SYSCALL(ni_syscall) |
194 | SYSCALL(ni_syscall) | 194 | SYSCALL(ni_syscall) |
195 | PPC_SYS(vfork) | 195 | PPC_SYS(vfork) |
@@ -229,7 +229,7 @@ COMPAT_SYS_SPU(sched_setaffinity) | |||
229 | COMPAT_SYS_SPU(sched_getaffinity) | 229 | COMPAT_SYS_SPU(sched_getaffinity) |
230 | SYSCALL(ni_syscall) | 230 | SYSCALL(ni_syscall) |
231 | SYSCALL(ni_syscall) | 231 | SYSCALL(ni_syscall) |
232 | SYS32ONLY(sendfile64) | 232 | SYSX(sys_ni_syscall,compat_sys_sendfile64_wrapper,sys_sendfile64) |
233 | COMPAT_SYS_SPU(io_setup) | 233 | COMPAT_SYS_SPU(io_setup) |
234 | SYSCALL_SPU(io_destroy) | 234 | SYSCALL_SPU(io_destroy) |
235 | COMPAT_SYS_SPU(io_getevents) | 235 | COMPAT_SYS_SPU(io_getevents) |
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index bd377a368611..c683fa350add 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
@@ -419,6 +419,7 @@ | |||
419 | #define __ARCH_WANT_COMPAT_SYS_TIME | 419 | #define __ARCH_WANT_COMPAT_SYS_TIME |
420 | #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND | 420 | #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND |
421 | #define __ARCH_WANT_SYS_NEWFSTATAT | 421 | #define __ARCH_WANT_SYS_NEWFSTATAT |
422 | #define __ARCH_WANT_COMPAT_SYS_SENDFILE | ||
422 | #endif | 423 | #endif |
423 | 424 | ||
424 | /* | 425 | /* |
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index 81c570633ead..abd1112da54f 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c | |||
@@ -143,48 +143,17 @@ long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t pt | |||
143 | * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) | 143 | * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) |
144 | * and the register representation of a signed int (msr in 64-bit mode) is performed. | 144 | * and the register representation of a signed int (msr in 64-bit mode) is performed. |
145 | */ | 145 | */ |
146 | asmlinkage long compat_sys_sendfile(u32 out_fd, u32 in_fd, compat_off_t __user * offset, u32 count) | 146 | asmlinkage long compat_sys_sendfile_wrapper(u32 out_fd, u32 in_fd, |
147 | compat_off_t __user *offset, u32 count) | ||
147 | { | 148 | { |
148 | mm_segment_t old_fs = get_fs(); | 149 | return compat_sys_sendfile((int)out_fd, (int)in_fd, offset, count); |
149 | int ret; | ||
150 | off_t of; | ||
151 | off_t __user *up; | ||
152 | |||
153 | if (offset && get_user(of, offset)) | ||
154 | return -EFAULT; | ||
155 | |||
156 | /* The __user pointer cast is valid because of the set_fs() */ | ||
157 | set_fs(KERNEL_DS); | ||
158 | up = offset ? (off_t __user *) &of : NULL; | ||
159 | ret = sys_sendfile((int)out_fd, (int)in_fd, up, count); | ||
160 | set_fs(old_fs); | ||
161 | |||
162 | if (offset && put_user(of, offset)) | ||
163 | return -EFAULT; | ||
164 | |||
165 | return ret; | ||
166 | } | 150 | } |
167 | 151 | ||
168 | asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count) | 152 | asmlinkage long compat_sys_sendfile64_wrapper(u32 out_fd, u32 in_fd, |
153 | compat_loff_t __user *offset, u32 count) | ||
169 | { | 154 | { |
170 | mm_segment_t old_fs = get_fs(); | 155 | return sys_sendfile((int)out_fd, (int)in_fd, |
171 | int ret; | 156 | (off_t __user *)offset, count); |
172 | loff_t lof; | ||
173 | loff_t __user *up; | ||
174 | |||
175 | if (offset && get_user(lof, offset)) | ||
176 | return -EFAULT; | ||
177 | |||
178 | /* The __user pointer cast is valid because of the set_fs() */ | ||
179 | set_fs(KERNEL_DS); | ||
180 | up = offset ? (loff_t __user *) &lof : NULL; | ||
181 | ret = sys_sendfile64(out_fd, in_fd, up, count); | ||
182 | set_fs(old_fs); | ||
183 | |||
184 | if (offset && put_user(lof, offset)) | ||
185 | return -EFAULT; | ||
186 | |||
187 | return ret; | ||
188 | } | 157 | } |
189 | 158 | ||
190 | long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, | 159 | long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, |
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c index 714bbfc3162c..db4e638cf408 100644 --- a/arch/powerpc/platforms/cell/spu_syscalls.c +++ b/arch/powerpc/platforms/cell/spu_syscalls.c | |||
@@ -69,8 +69,6 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags, | |||
69 | umode_t, mode, int, neighbor_fd) | 69 | umode_t, mode, int, neighbor_fd) |
70 | { | 70 | { |
71 | long ret; | 71 | long ret; |
72 | struct file *neighbor; | ||
73 | int fput_needed; | ||
74 | struct spufs_calls *calls; | 72 | struct spufs_calls *calls; |
75 | 73 | ||
76 | calls = spufs_calls_get(); | 74 | calls = spufs_calls_get(); |
@@ -78,11 +76,11 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags, | |||
78 | return -ENOSYS; | 76 | return -ENOSYS; |
79 | 77 | ||
80 | if (flags & SPU_CREATE_AFFINITY_SPU) { | 78 | if (flags & SPU_CREATE_AFFINITY_SPU) { |
79 | struct fd neighbor = fdget(neighbor_fd); | ||
81 | ret = -EBADF; | 80 | ret = -EBADF; |
82 | neighbor = fget_light(neighbor_fd, &fput_needed); | 81 | if (neighbor.file) { |
83 | if (neighbor) { | 82 | ret = calls->create_thread(name, flags, mode, neighbor.file); |
84 | ret = calls->create_thread(name, flags, mode, neighbor); | 83 | fdput(neighbor); |
85 | fput_light(neighbor, fput_needed); | ||
86 | } | 84 | } |
87 | } else | 85 | } else |
88 | ret = calls->create_thread(name, flags, mode, NULL); | 86 | ret = calls->create_thread(name, flags, mode, NULL); |
@@ -94,8 +92,7 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags, | |||
94 | asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus) | 92 | asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus) |
95 | { | 93 | { |
96 | long ret; | 94 | long ret; |
97 | struct file *filp; | 95 | struct fd arg; |
98 | int fput_needed; | ||
99 | struct spufs_calls *calls; | 96 | struct spufs_calls *calls; |
100 | 97 | ||
101 | calls = spufs_calls_get(); | 98 | calls = spufs_calls_get(); |
@@ -103,10 +100,10 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus) | |||
103 | return -ENOSYS; | 100 | return -ENOSYS; |
104 | 101 | ||
105 | ret = -EBADF; | 102 | ret = -EBADF; |
106 | filp = fget_light(fd, &fput_needed); | 103 | arg = fdget(fd); |
107 | if (filp) { | 104 | if (arg.file) { |
108 | ret = calls->spu_run(filp, unpc, ustatus); | 105 | ret = calls->spu_run(arg.file, unpc, ustatus); |
109 | fput_light(filp, fput_needed); | 106 | fdput(arg); |
110 | } | 107 | } |
111 | 108 | ||
112 | spufs_calls_put(calls); | 109 | spufs_calls_put(calls); |
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index c2c5b078ba80..657e3f233a64 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c | |||
@@ -106,6 +106,17 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int dfd) | |||
106 | return total; | 106 | return total; |
107 | } | 107 | } |
108 | 108 | ||
109 | static int match_context(const void *v, struct file *file, unsigned fd) | ||
110 | { | ||
111 | struct spu_context *ctx; | ||
112 | if (file->f_op != &spufs_context_fops) | ||
113 | return 0; | ||
114 | ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx; | ||
115 | if (ctx->flags & SPU_CREATE_NOSCHED) | ||
116 | return 0; | ||
117 | return fd + 1; | ||
118 | } | ||
119 | |||
109 | /* | 120 | /* |
110 | * The additional architecture-specific notes for Cell are various | 121 | * The additional architecture-specific notes for Cell are various |
111 | * context files in the spu context. | 122 | * context files in the spu context. |
@@ -115,29 +126,18 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int dfd) | |||
115 | * internal functionality to dump them without needing to actually | 126 | * internal functionality to dump them without needing to actually |
116 | * open the files. | 127 | * open the files. |
117 | */ | 128 | */ |
129 | /* | ||
130 | * descriptor table is not shared, so files can't change or go away. | ||
131 | */ | ||
118 | static struct spu_context *coredump_next_context(int *fd) | 132 | static struct spu_context *coredump_next_context(int *fd) |
119 | { | 133 | { |
120 | struct fdtable *fdt = files_fdtable(current->files); | ||
121 | struct file *file; | 134 | struct file *file; |
122 | struct spu_context *ctx = NULL; | 135 | int n = iterate_fd(current->files, *fd, match_context, NULL); |
123 | 136 | if (!n) | |
124 | for (; *fd < fdt->max_fds; (*fd)++) { | 137 | return NULL; |
125 | if (!fd_is_open(*fd, fdt)) | 138 | *fd = n - 1; |
126 | continue; | 139 | file = fcheck(*fd); |
127 | 140 | return SPUFS_I(file->f_dentry->d_inode)->i_ctx; | |
128 | file = fcheck(*fd); | ||
129 | |||
130 | if (!file || file->f_op != &spufs_context_fops) | ||
131 | continue; | ||
132 | |||
133 | ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx; | ||
134 | if (ctx->flags & SPU_CREATE_NOSCHED) | ||
135 | continue; | ||
136 | |||
137 | break; | ||
138 | } | ||
139 | |||
140 | return ctx; | ||
141 | } | 141 | } |
142 | 142 | ||
143 | int spufs_coredump_extra_notes_size(void) | 143 | int spufs_coredump_extra_notes_size(void) |