summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'work.misc' of ↵Linus Torvalds2016-01-12125-1478/+792
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull misc vfs updates from Al Viro: "All kinds of stuff. That probably should've been 5 or 6 separate branches, but by the time I'd realized how large and mixed that bag had become it had been too close to -final to play with rebasing. Some fs/namei.c cleanups there, memdup_user_nul() introduction and switching open-coded instances, burying long-dead code, whack-a-mole of various kinds, several new helpers for ->llseek(), assorted cleanups and fixes from various people, etc. One piece probably deserves special mention - Neil's lookup_one_len_unlocked(). Similar to lookup_one_len(), but gets called without ->i_mutex and tries to avoid ever taking it. That, of course, means that it's not useful for any directory modifications, but things like getting inode attributes in nfds readdirplus are fine with that. I really should've asked for moratorium on lookup-related changes this cycle, but since I hadn't done that early enough... I *am* asking for that for the coming cycle, though - I'm going to try and get conversion of i_mutex to rwsem with ->lookup() done under lock taken shared. There will be a patch closer to the end of the window, along the lines of the one Linus had posted last May - mechanical conversion of ->i_mutex accesses to inode_lock()/inode_unlock()/inode_trylock()/ inode_is_locked()/inode_lock_nested(). To quote Linus back then: ----- | This is an automated patch using | | sed 's/mutex_lock(&\(.*\)->i_mutex)/inode_lock(\1)/' | sed 's/mutex_unlock(&\(.*\)->i_mutex)/inode_unlock(\1)/' | sed 's/mutex_lock_nested(&\(.*\)->i_mutex,[ ]*I_MUTEX_\([A-Z0-9_]*\))/inode_lock_nested(\1, I_MUTEX_\2)/' | sed 's/mutex_is_locked(&\(.*\)->i_mutex)/inode_is_locked(\1)/' | sed 's/mutex_trylock(&\(.*\)->i_mutex)/inode_trylock(\1)/' | | with a very few manual fixups ----- I'm going to send that once the ->i_mutex-affecting stuff in -next gets mostly merged (or when Linus says he's about to stop taking merges)" * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits) nfsd: don't hold i_mutex over userspace upcalls fs:affs:Replace time_t with time64_t fs/9p: use fscache mutex rather than spinlock proc: add a reschedule point in proc_readfd_common() logfs: constify logfs_block_ops structures fcntl: allow to set O_DIRECT flag on pipe fs: __generic_file_splice_read retry lookup on AOP_TRUNCATED_PAGE fs: xattr: Use kvfree() [s390] page_to_phys() always returns a multiple of PAGE_SIZE nbd: use ->compat_ioctl() fs: use block_device name vsprintf helper lib/vsprintf: add %*pg format specifier fs: use gendisk->disk_name where possible poll: plug an unused argument to do_poll amdkfd: don't open-code memdup_user() cdrom: don't open-code memdup_user() rsxx: don't open-code memdup_user() mtip32xx: don't open-code memdup_user() [um] mconsole: don't open-code memdup_user_nul() [um] hostaudio: don't open-code memdup_user() ...
| * nfsd: don't hold i_mutex over userspace upcallsNeilBrown2016-01-095-19/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need information about exports when crossing mountpoints during lookup or NFSv4 readdir. If we don't already have that information cached, we may have to ask (and wait for) rpc.mountd. In both cases we currently hold the i_mutex on the parent of the directory we're asking rpc.mountd about. We've seen situations where rpc.mountd performs some operation on that directory that tries to take the i_mutex again, resulting in deadlock. With some care, we may be able to avoid that in rpc.mountd. But it seems better just to avoid holding a mutex while waiting on userspace. It appears that lookup_one_len is pretty much the only operation that needs the i_mutex. So we could just drop the i_mutex elsewhere and do something like mutex_lock() lookup_one_len() mutex_unlock() In many cases though the lookup would have been cached and not required the i_mutex, so it's more efficient to create a lookup_one_len() variant that only takes the i_mutex when necessary. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs:affs:Replace time_t with time64_tDengChao2016-01-093-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | The affs code uses "time_t" and "get_seconds()". This will cause problems on 32-bit architectures in 2038 when time_t overflows. This patch replaces them with "time64_t" and "ktime_get_real_seconds()". This patch introduces expensive 64-bit divsion in "secs_to_datestamp()", considering this function is not called so often, the cost should be acceptable. Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: DengChao <chao.deng@linaro.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs/9p: use fscache mutex rather than spinlockSasha Levin2016-01-093-6/+6
| | | | | | | | | | | | | | We may sleep inside a the lock, so use a mutex rather than spinlock. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * proc: add a reschedule point in proc_readfd_common()Eric Dumazet2016-01-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User can pass an arbitrary large buffer to getdents(). It is typically a 32KB buffer used by libc scandir() implementation. When scanning /proc/{pid}/fd, we can hold cpu way too long, so add a cond_resched() to be kind with other tasks. We've seen latencies of more than 50ms on real workloads. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * logfs: constify logfs_block_ops structuresJulia Lawall2016-01-093-5/+5
| | | | | | | | | | | | | | | | | | | | The logfs_block_ops structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fcntl: allow to set O_DIRECT flag on pipeStanislav Kinsburskiy2016-01-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | With packetized mode for pipes, it's not possible to set O_DIRECT on pipe file via sys_fcntl, because of unsupported sanity checks. Ability to set this flag will be used by CRIU to migrate packetized pipes. v2: Fixed typos and mode variable to check. Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs: __generic_file_splice_read retry lookup on AOP_TRUNCATED_PAGEAbhi Das2016-01-091-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During testing, I discovered that __generic_file_splice_read() returns 0 (EOF) when aops->readpage fails with AOP_TRUNCATED_PAGE on the first page of a single/multi-page splice read operation. This EOF return code causes the userspace test to (correctly) report a zero-length read error when it was expecting otherwise. The current strategy of returning a partial non-zero read when ->readpage returns AOP_TRUNCATED_PAGE works only when the failed page is not the first of the lot being processed. This patch attempts to retry lookup and call ->readpage again on pages that had previously failed with AOP_TRUNCATED_PAGE. With this patch, my tests pass and I haven't noticed any unwanted side effects. This version removes the thrice-retry loop and instead indefinitely retries lookups on AOP_TRUNCATED_PAGE errors from ->readpage. This behavior is now similar to do_generic_file_read(). Signed-off-by: Abhi Das <adas@redhat.com> Reviewed-by: Jan Kara <jack@suse.cz> Cc: Bob Peterson <rpeterso@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs: xattr: Use kvfree()Richard Weinberger2016-01-091-24/+14
| | | | | | | | | | | | | | ... instead of open coding it. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * [s390] page_to_phys() always returns a multiple of PAGE_SIZEAl Viro2016-01-091-2/+1
| | | | | | | | | | Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * nbd: use ->compat_ioctl()Al Viro2016-01-082-11/+1
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * Merge branch 'for-linus' into work.miscAl Viro2016-01-0877-568/+855
| |\
| * | fs: use block_device name vsprintf helperDmitry Monakhov2016-01-0617-90/+49
| | | | | | | | | | | | | | | Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | lib/vsprintf: add %*pg format specifierDmitry Monakhov2016-01-062-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allow to directly print block_device name. Currently one should use bdevname() with temporal char buffer. This is very ineffective because bloat stack usage for deep IO call-traces Example: %pg -> sda, sda1 or loop0p1 [AV: fixed a minor braino - position updates should not be dependent upon having reached the of buffer] Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | fs: use gendisk->disk_name where possibleDmitry Monakhov2016-01-061-9/+3
| | | | | | | | | | | | | | | | | | | | | gendisk with part==0 is obviously gendisk->disk_name. Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | poll: plug an unused argument to do_pollMateusz Guzik2016-01-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Number of fds is already known based on passed list. No functional changes. Signed-off-by: Mateusz Guzik <mguzik@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | amdkfd: don't open-code memdup_user()Al Viro2016-01-061-26/+7
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | cdrom: don't open-code memdup_user()Al Viro2016-01-061-7/+3
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | rsxx: don't open-code memdup_user()Al Viro2016-01-061-7/+4
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | mtip32xx: don't open-code memdup_user()Al Viro2016-01-061-15/+8
| | | | | | | | | | | | | | | | | | [folded a fix by Dan Carpenter] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | [um] mconsole: don't open-code memdup_user_nul()Al Viro2016-01-041-11/+3
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | [um] hostaudio: don't open-code memdup_user()Al Viro2016-01-041-7/+3
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | HFS wants 8Kb per-superblock allocation; just use kmalloc()Al Viro2016-01-041-2/+2
| | | | | | | | | | | | | | | | | | | | | ... rather than play with __get_free_pages() (and figuring out the allocation order, etc.) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | jfs: microoptimize get_zeroed_page / virt_to_pageAl Viro2016-01-041-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | get_zeroed_page does alloc_page and returns page_address of the result; subsequent virt_to_page will recover the page, but since the caller needs both page and its page_address() anyway, why bother going through that wrapper at all? Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | ... and a couple in net/9pAl Viro2016-01-041-2/+2
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | md: more open-coded offset_in_page()Al Viro2016-01-042-3/+3
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | dm-bufio: virt_to_phys() doesn't change remainder modulo PAGE_SIZEAl Viro2016-01-041-1/+1
| | | | | | | | | | | | | | | | | | | | | ... so virt_to_phys(p) & (PAGE_SIZE - 1) is a very odd way to spell offset_in_page(p). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | hpfs: missing endianness annotationAl Viro2016-01-041-1/+1
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | drivers/mtd/maps/pcmciamtd.c: __iomem annotationsAl Viro2016-01-041-14/+14
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | don't carry MAY_OPEN in op->acc_modeAl Viro2016-01-043-18/+12
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | saner calling conventions for copy_mount_options()Al Viro2016-01-043-30/+28
| | | | | | | | | | | | | | | | | | let it just return NULL, pointer to kernel copy or ERR_PTR(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | fix the leak in integrity_read_file()Al Viro2016-01-041-5/+6
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | ppc: get rid of the remnants of __get_user64()Al Viro2016-01-041-15/+0
| | | | | | | | | | | | | | | | | | | | | When __get_user64() had been removed, its helper (__get_user64_nocheck) got missed. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | put the remnants of ..._user_ret() to restAl Viro2016-01-045-130/+0
| | | | | | | | | | | | | | | | | | they hadn't been used in last 15 years... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | proc_pid_attr_write(): switch to memdup_user()Al Viro2016-01-041-10/+7
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | kernel/*: switch to memdup_user_nul()Al Viro2016-01-044-95/+48
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | cciss: switch to memdup_user_nul()Al Viro2016-01-041-10/+4
| | | | | | | | | | | | | | | | | | all we do to buffer is strncmp()... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | switch wireless debugfs ->write() instances to memdup_user_nul()Al Viro2016-01-042-174/+89
| | | | | | | | | | | | | | | | | | | | | | | | again, it only parses the contents of the copied buffer, so get_zeroed_page() might as well had been kmalloc(), which makes it open-coded memdup_user_nul() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | selinuxfs: switch to memdup_user_nul()Al Viro2016-01-041-73/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | Nothing in there gives a damn about the buffer alignment - it just parses its contents. So the use of get_zeroed_page() doesn't buy us anything - might as well had been kmalloc(), which makes that code equivalent to open-coded memdup_user_nul() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | convert a bunch of open-coded instances of memdup_user_nul()Al Viro2016-01-0412-197/+71
| | | | | | | | | | | | | | | | | | | | | A _lot_ of ->write() instances were open-coding it; some are converted to memdup_user_nul(), a lot more remain... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | Merge branch 'memdup_user_nul' into work.miscAl Viro2016-01-04596-2937/+5015
| |\ \
| | * | new helper: memdup_user_nul()Al Viro2016-01-042-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to memdup_user(), except that allocated buffer is one byte longer and '\0' is stored after the copied data. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | [mips] switch pvc_proc_cleanup() to remove_proc_subtree()Al Viro2015-12-231-12/+6
| | | | | | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | new helpers: no_seek_end_llseek{,_size}()Al Viro2015-12-2313-222/+54
| | | | | | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | don't open-code generic_file_llseek_size()Al Viro2015-12-094-74/+12
| | | | | | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | restore_nameidata(): no need to clear now->stackAl Viro2015-12-061-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | microoptimization: in all callers *now is in the frame we are about to leave. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | namei.c: take "jump to root" into a new helperAl Viro2015-12-061-28/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and use it both in path_init() (for absolute pathnames) and get_link() (for absolute symlinks). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | path_init(): set nd->inode earlier in cwd-relative caseAl Viro2015-12-061-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that allows to kill the recheck of nd->seq on the way out in this case, and this check on the way out is left only for absolute pathnames. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | namei.c: fold set_root_rcu() into set_root()Al Viro2015-12-061-24/+20
| | | | | | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | don't opencode iget_failed()Al Viro2015-12-062-6/+2
| | | | | | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
OpenPOWER on IntegriCloud