summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* VFS: normal filesystems (and lustre): d_inode() annotationsDavid Howells2015-04-15266-1351/+1350
| | | | | | | that's the bulk of filesystem drivers dealing with inodes of their own Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* VFS: Cachefiles should perform fs modifications on the top layer onlyDavid Howells2015-04-152-28/+28
| | | | | | | | Cachefiles should perform fs modifications (eg. vfs_unlink()) on the top layer only and should not attempt to alter the lower layer. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* configfs: Fix inconsistent use of file_inode() vs file->f_path.dentry->d_inodeDavid Howells2015-04-151-1/+1
| | | | | | | | Fix inconsistent use of file_inode() vs file->f_path.dentry->d_inode. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* VFS: Make pathwalk use d_is_reg() rather than S_ISREG()David Howells2015-04-151-1/+1
| | | | | | | | | | Make pathwalk use d_is_reg() rather than S_ISREG() to determine whether to honour O_TRUNC. Since this occurs after complete_walk(), the dentry type field cannot change and the inode pointer cannot change as we hold a ref on the dentry, so this should be safe. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* VFS: Fix up debugfs to use d_is_dir() in place of S_ISDIR()David Howells2015-04-151-1/+1
| | | | | | | | Fix up debugfs to use d_is_dir(dentry) in place of S_ISDIR(dentry->d_inode->i_mode). Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* VFS: Combine inode checks with d_is_negative() and d_is_positive() in pathwalkDavid Howells2015-04-151-3/+3
| | | | | | | | | | | | | | | Where we have: if (!dentry->d_inode || d_is_negative(dentry)) { type constructions in pathwalk we should be able to eliminate the check of d_inode and rely solely on the result of d_is_negative() or d_is_positive(). What we do have to take care to do is to read d_inode after calling a d_is_xxx() typecheck function to get the barriering right. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* NFS: Don't use d_inode as a variable nameDavid Howells2015-04-151-4/+4
| | | | | | | Don't use d_inode as a variable name as it now masks a function name. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* VFS: Impose ordering on accesses of d_inode and d_flagsDavid Howells2015-04-151-8/+39
| | | | | | | | | | | | | | | | | | | | | | | | Impose ordering on accesses of d_inode and d_flags to avoid the need to do this: if (!dentry->d_inode || d_is_negative(dentry)) { when this: if (d_is_negative(dentry)) { should suffice. This check is especially problematic if a dentry can have its type field set to something other than DENTRY_MISS_TYPE when d_inode is NULL (as in unionmount). What we really need to do is stick a write barrier between setting d_inode and setting d_flags and a read barrier between reading d_flags and reading d_inode. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* nfs: generic_write_checks() shouldn't be done on swapout...Al Viro2015-04-152-13/+10
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* ocfs2: use __generic_file_write_iter()Al Viro2015-04-111-57/+7
| | | | | | | we can do that now - all we need is to clear IOCB_DIRECT from ->ki_flags in "can't do dio" case. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* mirror O_APPEND and O_DIRECT into iocb->ki_flagsAl Viro2015-04-119-20/+20
| | | | | | ... avoiding write_iter/fcntl races. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* switch generic_write_checks() to iocb and iterAl Viro2015-04-1112-140/+79
| | | | | | | | | | | | ... returning -E... upon error and amount of data left in iter after (possible) truncation upon success. Note, that normal case gives a non-zero (positive) return value, so any tests for != 0 _must_ be updated. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Conflicts: fs/ext4/file.c
* ocfs2: move generic_write_checks() before the alignment checksAl Viro2015-04-111-24/+18
| | | | | | | | | | | | | Alignment checks for dio depend upon the range truncation done by generic_write_checks(). They can be done as soon as we got ocfs2_rw_lock() and that actually makes ocfs2_prepare_inode_for_write() simpler. The only thing to watch out for is restoring the original count in "unlock and redo without dio" case. Position doesn't need to be restored, since we change it only in O_APPEND case and in that case it will be reassigned anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* ocfs2_file_write_iter: stop messing with pposAl Viro2015-04-111-12/+12
| | | | | | it's &iocb->ki_pos; no need to obfuscate. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* Merge branch 'for-linus' into for-nextAl Viro2015-04-112-12/+25
|\
| * ocfs2: _really_ sync the right rangeAl Viro2015-04-091-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "ocfs2 syncs the wrong range" had been broken; prior to it the code was doing the wrong thing in case of O_APPEND, all right, but _after_ it we were syncing the wrong range in 100% cases. *ppos, aka iocb->ki_pos is incremented prior to that point, so we are always doing sync on the area _after_ the one we'd written to. Spotted by Joseph Qi <joseph.qi@huawei.com> back in January; unfortunately, I'd missed his mail back then ;-/ Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * ocfs2_file_write_iter: keep return value and current position update in syncAl Viro2015-04-081-1/+1
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * [regression] ocfs2: do *not* increment ->ki_pos twiceAl Viro2015-04-081-1/+0
| | | | | | | | | | | | | | generic_file_direct_write() already does that. Broken by "ocfs2: do not fallback to buffer I/O write if appending" Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * ioctx_alloc(): fix vma (and file) leak on failureAl Viro2015-04-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we fail past the aio_setup_ring(), we need to destroy the mapping. We don't need to care about anybody having found ctx, or added requests to it, since the last failure exit is exactly the failure to make ctx visible to lookups. Reproducer (based on one by Joe Mario <jmario@redhat.com>): void count(char *p) { char s[80]; printf("%s: ", p); fflush(stdout); sprintf(s, "/bin/cat /proc/%d/maps|/bin/fgrep -c '/[aio] (deleted)'", getpid()); system(s); } int main() { io_context_t *ctx; int created, limit, i, destroyed; FILE *f; count("before"); if ((f = fopen("/proc/sys/fs/aio-max-nr", "r")) == NULL) perror("opening aio-max-nr"); else if (fscanf(f, "%d", &limit) != 1) fprintf(stderr, "can't parse aio-max-nr\n"); else if ((ctx = calloc(limit, sizeof(io_context_t))) == NULL) perror("allocating aio_context_t array"); else { for (i = 0, created = 0; i < limit; i++) { if (io_setup(1000, ctx + created) == 0) created++; } for (i = 0, destroyed = 0; i < created; i++) if (io_destroy(ctx[i]) == 0) destroyed++; printf("created %d, failed %d, destroyed %d\n", created, limit - created, destroyed); count("after"); } } Found-by: Joe Mario <jmario@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fix mremap() vs. ioctx_kill() raceAl Viro2015-04-061-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | teach ->mremap() method to return an error and have it fail for aio mappings in process of being killed Note that in case of ->mremap() failure we need to undo move_page_tables() we'd already done; we could call ->mremap() first, but then the failure of move_page_tables() would require undoing whatever _successful_ ->mremap() has done, which would be a lot more headache in general. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | udf_file_write_iter: reorder and simplifyAl Viro2015-04-111-20/+14
| | | | | | | | | | | | it's easier to do generic_write_checks() first Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | fuse: ->direct_IO() doesn't need generic_write_checks()Al Viro2015-04-111-8/+3
| | | | | | | | | | | | | | | | | | already done by caller. We used to call __fuse_direct_write(), which called generic_write_checks(); now the former got expanded, bringing the latter to the surface. It used to be called all along and calling it from there had been wrong all along... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | ext4_file_write_iter: move generic_write_checks() upAl Viro2015-04-111-19/+20
| | | | | | | | | | | | simpler that way... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | xfs_file_aio_write_checks: switch to iocb/iov_iterAl Viro2015-04-111-15/+16
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | generic_write_checks(): drop isblk argumentAl Viro2015-04-1112-16/+15
| | | | | | | | | | | | all remaining callers are passing 0; some just obscure that fact. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | blkdev_write_iter: expand generic_file_checks() call in thereAl Viro2015-04-111-6/+9
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | lift generic_write_checks() into callers of __generic_file_write_iter()Al Viro2015-04-114-19/+54
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | cifs: fold cifs_iovec_write() into the only callerAl Viro2015-04-111-31/+16
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | ntfs: move iov_iter_truncate() closer to generic_write_checks()Al Viro2015-04-111-52/+29
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | new_sync_write(): discard ->ki_pos unless the return value is positiveAl Viro2015-04-111-1/+2
| | | | | | | | | | | | | | | | | | That allows ->write_iter() instances much more convenient life wrt iocb->ki_pos (and fixes several filesystems with borderline POSIX violations when zero-length write succeeds and changes the current position). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | direct_IO: remove rw from a_ops->direct_IO()Omar Sandoval2015-04-1124-48/+33
| | | | | | | | | | | | | | Now that no one is using rw, remove it completely. Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | direct_IO: use iov_iter_rw() instead of rw everywhereOmar Sandoval2015-04-1121-60/+60
| | | | | | | | | | | | | | | | | | | | | | The rw parameter to direct_IO is redundant with iov_iter->type, and treated slightly differently just about everywhere it's used: some users do rw & WRITE, and others do rw == WRITE where they should be doing a bitwise check. Simplify this with the new iov_iter_rw() helper, which always returns either READ or WRITE. Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | Remove rw from dax_{do_,}io()Omar Sandoval2015-04-114-19/+18
| | | | | | | | | | | | | | And use iov_iter_rw() instead. Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | Remove rw from {,__,do_}blockdev_direct_IO()Omar Sandoval2015-04-1119-64/+55
| | | | | | | | | | | | | | | | Most filesystems call through to these at some point, so we'll start here. Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | ->aio_read and ->aio_write removedAl Viro2015-04-114-44/+6
| | | | | | | | | | | | no remaining users Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | kill do_sync_read/do_sync_writeAl Viro2015-04-111-38/+0
| | | | | | | | | | | | | | | | all remaining instances of aio_{read,write} (all 4 of them) have explicit ->read and ->write resp.; do_sync_read/do_sync_write is never called by __vfs_read/__vfs_write anymore and no other users had been left. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | fuse: use iov_iter_get_pages() for non-splice pathAl Viro2015-04-111-24/+17
| | | | | | | | | | | | store reference to iter instead of that to iovec Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | fuse: switch to ->read_iter/->write_iterAl Viro2015-04-111-12/+14
| | | | | | | | | | | | we just change the calling conventions here; more work to follow. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | make new_sync_{read,write}() staticAl Viro2015-04-1147-127/+2
| | | | | | | | | | | | | | | | All places outside of core VFS that checked ->read and ->write for being NULL or called the methods directly are gone now, so NULL {read,write} with non-NULL {read,write}_iter will do the right thing in all cases. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | coredump: accept any write methodAl Viro2015-04-111-1/+1
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | export __vfs_read()Al Viro2015-04-111-8/+5
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | autofs: switch to __vfs_write()Al Viro2015-04-112-2/+2
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | new helper: __vfs_write()Al Viro2015-04-111-12/+16
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | Merge branch '9p-iov_iter' into for-nextAl Viro2015-04-115-366/+139
|\ \
| * | 9p: we are leaking glock.client_id in v9fs_file_getlock()Al Viro2015-04-111-0/+2
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | 9p: switch to ->read_iter/->write_iterAl Viro2015-04-111-44/+39
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | 9p: get rid of v9fs_direct_file_read()Al Viro2015-04-112-51/+12
| | | | | | | | | | | | | | | | | | do it in ->direct_IO()... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | 9p: switch p9_client_read() to passing struct iov_iter *Al Viro2015-04-115-118/+46
| | | | | | | | | | | | | | | | | | ... and make it loop Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | 9p: get rid of v9fs_direct_file_write()Al Viro2015-04-112-82/+17
| | | | | | | | | | | | | | | | | | just handle it in ->direct_IO() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | 9p: fold v9fs_file_write_internal() into the callerAl Viro2015-04-112-49/+30
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>