summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-linus' of ↵Linus Torvalds2012-10-02142-2877/+2915
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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() ...
| * MAX_LFS_FILESIZE should be a loff_tChuck Lever2012-10-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fs/nfs/internal.h: In function ‘nfs_super_set_maxbytes’: fs/nfs/internal.h:547:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Seen with gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2). Commit 42cb56ae made s_maxbytes a loff_t, thus the type of MAX_LFS_FILESIZE should also be a loff_t. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * compat: fs: Generic compat_sys_sendfile implementationCatalin Marinas2012-10-0210-89/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function is used by sparc, powerpc and arm64 for compat support. The patch adds a generic implementation which calls do_sendfile() directly and avoids set_fs(). The sparc architecture has wrappers for the sign extensions while powerpc relies on the compiler to do the this. The patch adds wrappers for powerpc to handle the u32->int type conversion. compat_sys_sendfile64() can be replaced by a sys_sendfile() call since compat_loff_t has the same size as off_t on a 64-bit system. On powerpc, the patch also changes the 64-bit sendfile call from sys_sendile64 to sys_sendfile. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: David S. Miller <davem@davemloft.net> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs: push rcu_barrier() from deactivate_locked_super() to filesystemsKirill A. Shutemov2012-10-0247-6/+240
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no reason to call rcu_barrier() on every deactivate_locked_super(). We only need to make sure that all delayed rcu free inodes are flushed before we destroy related cache. Removing rcu_barrier() from deactivate_locked_super() affects some fast paths. E.g. on my machine exit_group() of a last process in IPC namespace takes 0.07538s. rcu_barrier() takes 0.05188s of that time. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * btrfs: reada_extent doesn't need kref for refcountAl Viro2012-10-021-11/+7
| | | | | | | | | | | | | | | | All increments and decrements are under the same spinlock - have to be, since they need to protect the radix_tree it's found in. Just use int, no need to wank with kref... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * coredump: move core dump functionality into its own fileAlex Kelly2012-10-024-645/+689
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This prepares for making core dump functionality optional. The variable "suid_dumpable" and associated functions are left in fs/exec.c because they're used elsewhere, such as in ptrace. Signed-off-by: Alex Kelly <alex.page.kelly@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * coredump: prevent double-free on an error path in core dumperDenys Vlasenko2012-09-261-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate memory for info->fields, it frees already allocated stuff and returns error to its caller, fill_note_info. Which in turn returns error to its caller, elf_core_dump. Which jumps to cleanup label and calls free_note_info, which will happily try to free all info->fields again. BOOM. This is the fix. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Cc: Venu Byravarasu <vbyravarasu@nvidia.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
| * usb/gadget: fix misannotationsAl Viro2012-09-261-2/+2
| | | | | | | | | | | | __user * != * __user Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fcntl: fix misannotationsAl Viro2012-09-261-3/+3
| | | | | | | | | | | | __user * != * __user... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * ceph: don't abuse d_delete() on failure exitsAl Viro2012-09-261-2/+2
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * hypfs: ->d_parent is never NULL or negativeAl Viro2012-09-261-2/+0
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * vfs: delete surplus inode NULL checkAlan Cox2012-09-261-1/+1
| | | | | | | | | | | | | | | | | | Each iteration of d_delete we reload inode from dentry->d_inode and then call S_ISDIR(inode-i_mode), so inode cannot possibly be NULL shortly afterwards unless something went horribly wrong. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch simple cases of fget_light to fdgetAl Viro2012-09-2644-763/+633
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * new helpers: fdget()/fdput()Al Viro2012-09-261-0/+26
| | | | | | | | Signed-off-bs: Al Viro <viro@zeniv.linux.org.uk>
| * switch o2hb_region_dev_write() to fget_light()Al Viro2012-09-261-2/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * proc_map_files_readdir(): don't bother with grabbing filesAl Viro2012-09-261-19/+9
| | | | | | | | | | | | all we need is their ->f_mode, so just collect _that_ Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * make get_file() return its argumentAl Viro2012-09-2616-38/+23
| | | | | | | | | | | | simplifies a bunch of callers... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * vhost_set_vring(): turn pollstart/pollstop into boolAl Viro2012-09-261-4/+4
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch prctl_set_mm_exe_file() to fget_light()Al Viro2012-09-261-4/+4
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch xfs_find_handle() to fget_light()Al Viro2012-09-261-3/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch xfs_swapext() to fget_light()Al Viro2012-09-261-5/+5
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch coda get_device_index() to fget_light()Al Viro2012-09-261-17/+15
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch infinibarf users of fget() to fget_light()Al Viro2012-09-263-14/+10
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch vfio_group_set_container() to fget_light()Al Viro2012-09-261-4/+4
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch btrfs_ioctl_clone() to fget_light()Al Viro2012-09-261-3/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch mqueue syscalls to fget_light()Al Viro2012-09-261-12/+14
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch SNDRV_PCM_IOCTL_LINK to fget_light()Al Viro2012-09-261-6/+7
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch timerfd_[sg]ettime(2) to fget_light()Al Viro2012-09-261-8/+9
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch epoll_wait(2) to fget_light()Al Viro2012-09-261-3/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch btrfs_ioctl_snap_create_transid() to fget_light()Al Viro2012-09-261-7/+7
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch EXT4_IOC_MOVE_EXT to fget_light()Al Viro2012-09-261-3/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * export fget_lightAl Viro2012-09-261-0/+1
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * ext4: close struct file leak on EXT4_IOC_MOVE_EXTAl Viro2012-09-261-1/+2
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch hpux_getdents() to fget_light()Al Viro2012-09-261-3/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch itanic perfmonctl(2) to fget_light()Al Viro2012-09-261-2/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch osf_getdirentries() to fget_light()Al Viro2012-09-261-3/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch readahead(2) to fget_light()Al Viro2012-09-261-2/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch fadvise(2) to fget_light()Al Viro2012-09-261-2/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch fchmod(2) to fget_light()Al Viro2012-09-261-7/+5
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch fallocate(2) to fget_light()Al Viro2012-09-261-3/+3
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch ftruncate(2) to fget_lightAl Viro2012-09-261-5/+5
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * namei.c: fix BS commentAl Viro2012-09-261-1/+1
| | | | | | | | | | | | | | get_write_access() is needed for nfsd, not binfmt_aout (the latter has no business doing anything of that kind, of course) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * don't leak O_CLOEXEC into ->f_flagsAl Viro2012-09-262-2/+2
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * procfs: Convert /proc/pid/fdinfo/ handling routines to seq-file v2Cyrill Gorcunov2012-09-261-48/+64
| | | | | | | | | | | | | | | | | | | | | | This patch converts /proc/pid/fdinfo/ handling routines to seq-file which is needed to extend seq operations and plug in auxiliary fdinfo provides from subsystems like eventfd/eventpoll/fsnotify. Note the proc_fd_link no longer call for proc_fd_info, simply because the guts of proc_fd_info() got merged into ->show() of that seq_file Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * procfs: Move /proc/pid/fd[info] handling code to fd.[ch]Cyrill Gorcunov2012-09-265-387/+416
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch prepares the ground for further extension of /proc/pid/fd[info] handling code by moving fdinfo handling code into fs/proc/fd.c. I think such move makes both fs/proc/base.c and fs/proc/fd.c easier to read. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by: Pavel Emelyanov <xemul@parallels.com> CC: Al Viro <viro@ZenIV.linux.org.uk> CC: Alexey Dobriyan <adobriyan@gmail.com> CC: Andrew Morton <akpm@linux-foundation.org> CC: James Bottomley <jbottomley@parallels.com> CC: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> CC: Alexey Dobriyan <adobriyan@gmail.com> CC: Matthew Helsley <matt.helsley@gmail.com> CC: "J. Bruce Fields" <bfields@fieldses.org> CC: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * new helper: daemonize_descriptors()Al Viro2012-09-263-3/+8
| | | | | | | | | | | | | | | | descriptor-related parts of daemonize, done right. As the result we simplify the locking rules for ->files - we hold task_lock in *all* cases when we modify ->files. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch spufs/coredump to iterate_fd()Al Viro2012-09-261-20/+20
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * do_coredump(): make sure that descriptor table isn't sharedAl Viro2012-09-261-0/+7
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * new helper: iterate_fd()Al Viro2012-09-265-84/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | iterates through the opened files in given descriptor table, calling a supplied function; we stop once non-zero is returned. Callback gets struct file *, descriptor number and const void * argument passed to iterator. It is called with files->file_lock held, so it is not allowed to block. tty_io, netprio_cgroup and selinux flush_unauthorized_files() converted to its use. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * make expand_files() and alloc_fd() staticAl Viro2012-09-263-4/+2
| | | | | | | | | | | | no callers outside of fs/file.c left Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>