summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* hostfs: switch to ->iterate_shared()Al Viro2016-05-121-1/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hpfs: switch to ->iterate_shared()Al Viro2016-05-121-1/+1
| | | | | | | | NOTE: the only reason we can do that without ->i_rdir_offs races is that hpfs_lock() serializes everything in there anyway. It's not that hard to get rid of, but not as part of this series... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* hpfs: handle allocation failures in hpfs_add_pos()Al Viro2016-05-123-6/+14
| | | | | | | | | pr_err() is nice, but we'd better propagate the error to caller and not proceed to violate the invariants (namely, "every file with f_pos tied to directory block should have its address visible in per-inode array"). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* gfs2: switch to ->iterate_shared()Al Viro2016-05-121-2/+2
| | | | | | | protected by glock and already used without locking the directory by gfs2_get_name() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* f2fs: switch to ->iterate_shared()Al Viro2016-05-101-1/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* afs: switch to ->iterate_shared()Al Viro2016-05-101-1/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* befs: switch to ->iterate_shared()Al Viro2016-05-101-1/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* befs: constify stuff a bitAl Viro2016-05-106-31/+34
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* isofs: switch to ->iterate_shared()Al Viro2016-05-091-1/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* get_acorn_filename(): deobfuscate a bitAl Viro2016-05-091-1/+1
| | | | | | | | Lots of Idiotic Silly Parentheses is -> that way... What that condition checks is that there's exactly 32 bytes between the end of name and the end of entire drectory record. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* btrfs: switch to ->iterate_shared()Al Viro2016-05-091-1/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* logfs: no need to lock directory in lseekAl Viro2016-05-091-1/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* switch ecryptfs to ->iterate_sharedAl Viro2016-05-091-1/+1
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* Merge branch 'for-linus' into work.lookupsAl Viro2016-05-092-19/+65
|\
| * get_rock_ridge_filename(): handle malformed NM entriesAl Viro2016-05-071-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Payloads of NM entries are not supposed to contain NUL. When we run into such, only the part prior to the first NUL goes into the concatenation (i.e. the directory entry name being encoded by a bunch of NM entries). We do stop when the amount collected so far + the claimed amount in the current NM entry exceed 254. So far, so good, but what we return as the total length is the sum of *claimed* sizes, not the actual amount collected. And that can grow pretty large - not unlimited, since you'd need to put CE entries in between to be able to get more than the maximum that could be contained in one isofs directory entry / continuation chunk and we are stop once we'd encountered 32 CEs, but you can get about 8Kb easily. And that's what will be passed to readdir callback as the name length. 8Kb __copy_to_user() from a buffer allocated by __get_free_page() Cc: stable@vger.kernel.org # 0.98pl6+ (yes, really) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * ecryptfs: fix handling of directory openingAl Viro2016-05-041-16/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all, trying to open them r/w is idiocy; it's guaranteed to fail. Moreover, assigning ->f_pos and assuming that everything will work is blatantly broken - try that with e.g. tmpfs as underlying layer and watch the fireworks. There may be a non-trivial amount of state associated with current IO position, well beyond the numeric offset. Using the single struct file associated with underlying inode is really not a good idea; we ought to open one for each ecryptfs directory struct file. Additionally, file_operations both for directories and non-directories are full of pointless methods; non-directories should *not* have ->iterate(), directories should not have ->flush(), ->fasync() and ->splice_read(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | 9p: switch to ->iterate_shared()Al Viro2016-05-091-2/+2
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | fat: switch to ->iterate_shared()Al Viro2016-05-091-3/+3
| | | | | | | | | | | | ... and make that weird ioctl lock directory only shared. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | romfs, squashfs: switch to ->iterate_shared()Al Viro2016-05-092-4/+4
| | | | | | | | | | | | don't need to lock directory in ->llseek(), either Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | more trivial ->iterate_shared conversionsAl Viro2016-05-0916-17/+16
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | kernfs: no point locking directory around that generic_file_llseek()Al Viro2016-05-091-15/+2
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | configfs_readdir(): make safe under shared lockAl Viro2016-05-091-13/+7
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | nfs: per-name sillyunlink exclusionAl Viro2016-05-095-154/+56
| | | | | | | | | | | | | | | | | | | | | | use d_alloc_parallel() for sillyunlink/lookup exclusion and explicit rwsem (nfs_rmdir() being a writer and nfs_call_unlink() - a reader) for rmdir/sillyunlink one. That ought to make lookup/readdir/!O_CREAT atomic_open really parallel on NFS. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | nfs: switch to ->iterate_shared()Al Viro2016-05-021-28/+43
| | | | | | | | | | | | | | aside of the usual care about seeding dcache from readdir, we need to be careful about the pagecache evictions here. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | lookup_open(): lock the parent shared unless O_CREAT is givenAl Viro2016-05-021-3/+9
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | lookup_open(): put the dentry fed to ->lookup() or ->atomic_open() into ↵Al Viro2016-05-021-11/+26
| | | | | | | | | | | | in-lookup hash Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | lookup_open(): expand the call of real_lookup()Al Viro2016-05-021-3/+10
| | | | | | | | | | | | ... and lose the duplicate IS_DEADDIR() - we'd already checked that. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | atomic_open(): reorder and clean up a bitAl Viro2016-05-021-34/+27
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | lookup_open(): lift the "fallback to !O_CREAT" logics from atomic_open()Al Viro2016-05-021-89/+55
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | atomic_open(): be paranoid about may_open() return valueAl Viro2016-05-021-0/+2
| | | | | | | | | | | | | | It should never return positives; however, with Linux S&M crowd involved, no bogosity is impossible. Results would be unpleasant... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | atomic_open(): delay open_to_namei_flags() until the method callAl Viro2016-05-021-3/+4
| | | | | | | | | | | | nobody else needs that transformation. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | do_last(): take fput() on error after opening to out:Al Viro2016-05-021-17/+5
| | | | | | | | | | | | | | | | make it conditional on *opened & FILE_OPENED; in addition to getting rid of exit_fput: thing, it simplifies atomic_open() cleanup on may_open() failure. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | do_last(): get rid of duplicate ELOOP checkAl Viro2016-05-021-4/+0
| | | | | | | | | | | | may_open() will catch it Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | atomic_open(): massage the create_error logics a bitAl Viro2016-05-021-23/+20
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | atomic_open(): consolidate "overridden ENOENT" in open-yourself casesAl Viro2016-05-021-8/+1
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | atomic_open(): don't bother with EEXIST check - it's done in do_last()Al Viro2016-05-021-5/+0
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | Merge branch 'for-linus' into work.lookupsAl Viro2016-05-022-16/+7
|\ \ | |/
| * atomic_open(): fix the handling of create_errorAl Viro2016-04-301-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * if we have a hashed negative dentry and either CREAT|EXCL on r/o filesystem, or CREAT|TRUNC on r/o filesystem, or CREAT|EXCL with failing may_o_create(), we should fail with EROFS or the error may_o_create() has returned, but not ENOENT. Which is what the current code ends up returning. * if we have CREAT|TRUNC hitting a regular file on a read-only filesystem, we can't fail with EROFS here. At the very least, not until we'd done follow_managed() - we might have a writable file (or a device, for that matter) bound on top of that one. Moreover, the code downstream will see that O_TRUNC and attempt to grab the write access (*after* following possible mount), so if we really should fail with EROFS, it will happen. No need to do that inside atomic_open(). The real logics is much simpler than what the current code is trying to do - if we decided to go for simple lookup, ended up with a negative dentry *and* had create_error set, fail with create_error. No matter whether we'd got that negative dentry from lookup_real() or had found it in dcache. Cc: stable@vger.kernel.org # v3.6+ Acked-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * do_splice_to(): cap the size before passing to ->splice_read()Al Viro2016-04-031-0/+3
| | | | | | | | | | | | pipe capacity won't exceed 2G anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | lookup_open(): expand the call of vfs_create()Al Viro2016-05-021-9/+12
| | | | | | | | | | | | | | | | Lift IS_DEADDIR handling up into the part common with atomic_open(), remove it from the latter. Collapse permission checks into the call of may_o_create(), getting it closer to atomic_open() case. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | path_openat(): take O_PATH handling out of do_last()Al Viro2016-05-021-7/+24
| | | | | | | | | | | | | | | | | | do_last() and lookup_open() simpler that way and so does O_PATH itself. As it bloody well should: we find what the pathname resolves to, same way as in stat() et.al. and associate it with FMODE_PATH struct file. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | simple local filesystems: switch to ->iterate_shared()Al Viro2016-05-026-6/+6
| | | | | | | | | | | | | | no changes needed (XFS isn't simple, but it has the same parallelism in the interesting parts exercised from CXFS). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | dcache_{readdir,dir_lseek}() users: switch to ->iterate_sharedAl Viro2016-05-022-6/+3
| | | | | | | | | | | | | | no need to lock directory in dcache_dir_lseek(), while we are at it - per-struct file exclusion is enough. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | cifs: switch to ->iterate_shared()Al Viro2016-05-022-27/+30
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | fuse: switch to ->iterate_shared()Al Viro2016-05-021-49/+45
| | | | | | | | | | | | | | Switch dcache pre-seeding on readdir to d_alloc_parallel(); nothing else is needed. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | switch all procfs directories ->iterate_shared()Al Viro2016-05-027-20/+21
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | proc_sys_fill_cache(): switch to d_alloc_parallel()Al Viro2016-05-021-7/+8
| | | | | | | | | | | | make it usable with directory locked shared Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | proc_fill_cache(): switch to d_alloc_parallel()Al Viro2016-05-021-5/+10
| | | | | | | | | | | | ... making it usable with directory locked shared Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | introduce a parallel variant of ->iterate()Al Viro2016-05-023-11/+29
| | | | | | | | | | | | | | | | New method: ->iterate_shared(). Same arguments as in ->iterate(), called with the directory locked only shared. Once all filesystems switch, the old one will be gone. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | give readdir(2)/getdents(2)/etc. uniform exclusion with lseek()Al Viro2016-05-025-25/+18
| | | | | | | | | | | | same as read() on regular files has, and for the same reason. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
OpenPOWER on IntegriCloud