summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2013-06-29locks: protect most of the file_lock handling with i_lockJeff Layton13-113/+155
Having a global lock that protects all of this code is a clear scalability problem. Instead of doing that, move most of the code to be protected by the i_lock instead. The exceptions are the global lists that the ->fl_link sits on, and the ->fl_block list. ->fl_link is what connects these structures to the global lists, so we must ensure that we hold those locks when iterating over or updating these lists. Furthermore, sound deadlock detection requires that we hold the blocked_list state steady while checking for loops. We also must ensure that the search and update to the list are atomic. For the checking and insertion side of the blocked_list, push the acquisition of the global lock into __posix_lock_file and ensure that checking and update of the blocked_list is done without dropping the lock in between. On the removal side, when waking up blocked lock waiters, take the global lock before walking the blocked list and dequeue the waiters from the global list prior to removal from the fl_block list. With this, deadlock detection should be race free while we minimize excessive file_lock_lock thrashing. Finally, in order to avoid a lock inversion problem when handling /proc/locks output we must ensure that manipulations of the fl_block list are also protected by the file_lock_lock. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29locks: encapsulate the fl_link list handlingJeff Layton1-9/+36
Move the fl_link list handling routines into a separate set of helpers. Also ensure that locks and requests are always put on global lists last (after fully initializing them) and are taken off before unintializing them. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29locks: make "added" in __posix_lock_file a boolJeff Layton1-4/+5
Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29locks: comment cleanups and clarificationsJeff Layton2-8/+31
Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29locks: make generic_add_lease and generic_delete_lease staticJeff Layton1-2/+2
Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29cifs: use posix_unblock_lock instead of locks_delete_blockJeff Layton3-8/+2
commit 66189be74 (CIFS: Fix VFS lock usage for oplocked files) exported the locks_delete_block symbol. There's already an exported helper function that provides this capability however, so make cifs use that instead and turn locks_delete_block back into a static function. Note that if fl->fl_next == NULL then this lock has already been through locks_delete_block(), so we should be OK to ignore an ENOENT error here and simply not retry the lock. Cc: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29locks: drop the unused filp argument to posix_unblock_lockJeff Layton3-7/+4
Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29Don't pass inode to ->d_hash() and ->d_compare()Linus Torvalds23-165/+108
Instances either don't look at it at all (the majority of cases) or only want it to find the superblock (which can be had as dentry->d_sb). A few cases that want more are actually safe with dentry->d_inode - the only precaution needed is the check that it hadn't been replaced with NULL by rmdir() or by overwriting rename(), which case should be simply treated as cache miss. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29minix: bug widening a binary "not" operationDan Carpenter1-1/+1
"chunk_size" is an unsigned int and "pos" is an unsigned long. The "& ~(chunk_size-1)" operation clears the high 32 bits unintentionally. The ALIGN() macro does the correct thing. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-06-29splice: lift checks from do_splice_from() into callersAl Viro1-11/+20
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29constify rw_verify_area()Al Viro4-2/+4
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29ps3flash: switch to generic_file_llseek_size()Al Viro1-26/+2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29wlcore: use *ppos, not file->f_posAl Viro1-2/+2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29bfa: switch to fixed_size_llseek()Al Viro1-25/+3
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29fnic: switch to fixed_size_llseek()Al Viro1-14/+2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29vc: switch to fixed_size_llseek()Al Viro1-16/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29eisa_eeprom: switch to fixed_size_llseek()Al Viro1-13/+2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29bna: switch to fixed_size_llseek()Al Viro1-21/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29zorro: switch to fixed_size_llseek()Al Viro1-21/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29mtdchar: switch to fixed_size_llseek()Al Viro1-19/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29new helper: fixed_size_llseek()Al Viro2-0/+22
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29ecryptfs: switch ecryptfs_decode_and_decrypt_filename() from dentry to sbAl Viro4-10/+8
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29fuse: another open-coded file_inode()Al Viro1-2/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29btrfs: more open-coded file_inode()Al Viro1-4/+4
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29fanotify: quit wanking with FASYNC in ->release()Al Viro1-3/+0
... especially since there's no way to get that sucker on the list fsnotify_fasync() works with - the only thing adding to it is fsnotify_fasync() itself and it's never called for fanotify files while they are opened. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29comedi: quit wanking with FASYNC in ->release()Al Viro1-3/+0
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29more open-coded file_inode() callsAl Viro3-4/+4
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29kill find_inode_number()Al Viro3-32/+0
the only remaining caller (in ncpfs) is guaranteed to return 0 - we only hit it if we'd just checked that there's no dentry with such name. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29coda: don't bother with find_inode_number()Al Viro1-7/+1
the fallback it's using for dcache misses is actually the same value we would've used for inumber anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29proc_fill_cache(): clean up, get rid of pointless find_inode_number() useAl Viro1-23/+13
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29proc_fill_cache(): just make instantiate_t return intAl Viro4-49/+43
all instances always return ERR_PTR(-E...) or NULL, anyway Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29proc_pid_readdir(): stop wanking with proc_fill_cache() for /proc/selfAl Viro1-3/+3
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29proc_fill_cache(): kill pointless checkAl Viro1-4/+2
we'd just checked that child->d_inode is non-NULL, for fuck sake! Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29ncpfs: don't bother with EBUSY on removal of busy directoriesAl Viro2-11/+4
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29don't call file_pos_write() if vfs_{read,write}{,v}() failsAl Viro1-6/+12
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29SELinux: Institute file_path_has_perm()David Howells1-6/+18
Create a file_path_has_perm() function that is like path_has_perm() but instead takes a file struct that is the source of both the path and the inode (rather than getting the inode from the dentry in the path). This is then used where appropriate. This will be useful for situations like unionmount where it will be possible to have an apparently-negative dentry (eg. a fallthrough) that is open with the file struct pointing to an inode on the lower fs. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29Replace a bunch of file->dentry->d_inode refs with file_inode()David Howells3-6/+6
Replace a bunch of file->dentry->d_inode refs with file_inode(). In __fput(), use file->f_inode instead so as not to be affected by any tricks that file_inode() might grow. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29udf: provide ->tmpfile()Al Viro1-0/+24
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29ext3 ->tmpfile() supportAl Viro1-1/+46
In this case we do need a bit more than usual, due to orphan list handling. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29allow the temp files created by open() to be linked toAl Viro3-3/+18
O_TMPFILE | O_CREAT => linkat() with AT_SYMLINK_FOLLOW and /proc/self/fd/<n> as oldpath (i.e. flink()) will create a link O_TMPFILE | O_CREAT | O_EXCL => ENOENT on attempt to link those guys Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29[O_TMPFILE] it's still short a few helpers, but infrastructure should be OK ↵Al Viro12-5/+164
now... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29allow build_open_flags() to return an errorAl Viro4-31/+41
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29lift file_*_write out of do_splice_direct()Al Viro2-2/+2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29lift file_*_write out of do_splice_from()Al Viro1-4/+5
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29do_last(): fix missing checks for LAST_BIND caseAl Viro1-21/+3
/proc/self/cwd with O_CREAT should fail with EISDIR. /proc/self/exe, OTOH, should fail with ENOTDIR when opened with O_DIRECTORY. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29pcm_native: switch to fdget()/fdput()Al Viro1-25/+15
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29[readdir] constify ->actorAl Viro9-68/+57
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29[readdir] ->readdir() is goneAl Viro7-16/+13
everything's converted to ->iterate() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29[readdir] convert ecryptfsAl Viro1-20/+15
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29[readdir] convert codaAl Viro1-58/+19
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>