summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Revert "ovl: don't allow writing ioctl on lower layer"Miklos Szeredi2018-07-184-70/+9Star
| | | | | | | | This reverts commit 7c6893e3c9abf6a9676e060a1e35e5caca673d57. Overlayfs no longer relies on the vfs for checking writability of files. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* Revert "ovl: fix may_write_real() for overlayfs directories"Miklos Szeredi2018-07-181-3/+1Star
| | | | | | | | This reverts commit 954c736f865d6c0c68ae4263a2f3502ee7c447a3. Overlayfs no longer relies on the vfs for checking writability of files. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* vfs: don't open realMiklos Szeredi2018-07-181-6/+1Star
| | | | | | | | | | | | Let overlayfs do its thing when opening a file. This enables stacking and fixes the corner case when a file is opened for read, modified through a writable open, and data is read from the read-only file. After this patch the read-only open will not return stale data even in this case. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* ovl: add reflink/copyfile/dedup supportMiklos Szeredi2018-07-181-0/+87
| | | | | | Since set of arguments are so similar, handle in a common helper. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: add O_DIRECT supportMiklos Szeredi2018-07-181-0/+3
| | | | Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: add ovl_fiemap()Miklos Szeredi2018-07-181-1/+28
| | | | | | | | | Implement stacked fiemap(). Need to split inode operations for regular file (which has fiemap) and special file (which doesn't have fiemap). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: add lsattr/chattr supportMiklos Szeredi2018-07-181-0/+79
| | | | | | Implement FS_IOC_GETFLAGS and FS_IOC_SETFLAGS. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: add ovl_fallocate()Miklos Szeredi2018-07-181-0/+24
| | | | | | Implement stacked fallocate. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: add ovl_mmap()Miklos Szeredi2018-07-181-0/+32
| | | | | | Implement stacked mmap. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: add ovl_fsync()Miklos Szeredi2018-07-181-0/+23
| | | | | | | | Implement stacked fsync(). Don't sync if lower (noticed by Amir Goldstein). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: add ovl_write_iter()Miklos Szeredi2018-07-181-0/+39
| | | | | | Implement stacked writes. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: add ovl_read_iter()Miklos Szeredi2018-07-181-0/+67
| | | | | | Implement stacked reading. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: add helper to return real fileMiklos Szeredi2018-07-181-0/+60
| | | | | | | | | | | | | | | | In the common case we can just use the real file cached in file->private_data. There are two exceptions: 1) File has been copied up since open: in this unlikely corner case just use a throwaway real file for the operation. If ever this becomes a perfomance problem (very unlikely, since overlayfs has been doing most fine without correctly handling this case at all), then we can deal with that by updating the cached real file. 2) File's f_flags have changed since open: no need to reopen the cached real file, we can just change the flags there as well. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: stack file opsMiklos Szeredi2018-07-184-2/+82
| | | | | | | | | | | | | | | | | | | | | | Implement file operations on a regular overlay file. The underlying file is opened separately and cached in ->private_data. It might be worth making an exception for such files when accounting in nr_file to confirm to userspace expectations. We are only adding a small overhead (248bytes for the struct file) since the real inode and dentry are pinned by overlayfs anyway. This patch doesn't have any effect, since the vfs will use d_real() to find the real underlying file to open. The patch at the end of the series will actually enable this functionality. AV: make it use open_with_fake_path(), don't mess with override_creds SzM: still need to mess with override_creds() until no fs uses current_cred() in their open method. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* ovl: deal with overlay files in ovl_d_real()Miklos Szeredi2018-07-181-0/+4
| | | | Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: copy up file size as wellMiklos Szeredi2018-07-182-9/+2Star
| | | | | | | | | | | | Copy i_size of the underlying inode to the overlay inode in ovl_copyattr(). This is in preparation for stacking I/O operations on overlay files. This patch shouldn't have any observable effect. Remove stale comment from ovl_setattr() [spotted by Vivek Goyal]. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* Revert "Revert "ovl: get_write_access() in truncate""Miklos Szeredi2018-07-181-0/+21
| | | | | | | | | | | | This reverts commit 31c3a7069593b072bd57192b63b62f9a7e994e9a. Re-add functionality dealing with i_writecount on truncate to overlayfs. This patch shouldn't have any observable effects, since we just re-assert the writecout that vfs_truncate() already got for us. This is in preparation for moving overlay functionality out of the VFS. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: copy up inode flagsMiklos Szeredi2018-07-182-0/+8
| | | | | | | | | On inode creation copy certain inode flags from the underlying real inode to the overlay inode. This is in preparation for moving overlay functionality out of the VFS. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* ovl: copy up timesMiklos Szeredi2018-07-184-9/+37
| | | | | | | | | | | Copy up mtime and ctime to overlay inode after times in real object are modified. Be careful not to dirty cachelines when not necessary. This is in preparation for moving overlay functionality out of the VFS. This patch shouldn't have any observable effect. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* vfs: export vfs_dedupe_file_range_one() to modulesMiklos Szeredi2018-07-182-3/+7
| | | | | | This is needed by the stacked dedupe implementation in overlayfs. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* vfs: export vfs_ioctl() to modulesMiklos Szeredi2018-07-183-1/+3
| | | | | | This is needed by the stacked ioctl implementation in overlayfs. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* vfs: make open_with_fake_path() not contribute to nr_filesMiklos Szeredi2018-07-184-22/+53
| | | | | | | | | | | | | Stacking file operations in overlay will store an extra open file for each overlay file opened. The overhead is just that of "struct file" which is about 256bytes, because overlay already pins an extra dentry and inode when the file is open, which add up to a much larger overhead. For fear of breaking working setups, don't start accounting the extra file. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* Merge branch 'dedupe-cleanup' into overlayfs-nextMiklos Szeredi2018-07-186-84/+74Star
|\ | | | | | | Following series for stacking overlay files depends on this mini series.
| * vfs: dedupe: extract helper for a single dedupMiklos Szeredi2018-07-061-40/+49
| | | | | | | | | | | | | | | | Extract vfs_dedupe_file_range_one() helper to deal with a single dedup request. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
| * vfs: dedupe: rationalize argsMiklos Szeredi2018-07-066-20/+22
| | | | | | | | | | | | | | | | | | | | Clean up f_op->dedupe_file_range() interface. 1) Use loff_t for offsets and length instead of u64 2) Order the arguments the same way as {copy|clone}_file_range(). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * vfs: dedupe: return intMiklos Szeredi2018-07-066-40/+16Star
| | | | | | | | Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * vfs: limit size of dedupeMiklos Szeredi2018-07-061-0/+3
| | | | | | | | | | Suggested-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* | Merge branch 'for-ovl' of ↵Miklos Szeredi2018-07-1826-183/+137Star
|\ \ | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs into overlayfs-next This gives us the open_with_fake_path() helper that is needed for stacked open files in overlay and mmap in particular.
| * | new helper: open_with_fake_path()Al Viro2018-07-122-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | open a file by given inode, faking ->f_path. Use with shitloads of caution - at the very least you'd damn better make sure that some dentry alias of that inode is pinned down by the path in question. Again, this is no general-purpose interface and I hope it will eventually go away. Right now overlayfs wants something like that, but nothing else should. Any out-of-tree code with bright idea of using this one *will* eventually get hurt, with zero notice and great delight on my part. I refuse to use EXPORT_SYMBOL_GPL(), especially in situations when it's really EXPORT_SYMBOL_DONT_USE_IT(), but don't take that export as "you are welcome to use it". Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | now we can fold open_check_o_direct() into do_dentry_open()Al Viro2018-07-123-19/+6Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These checks are better off in do_dentry_open(); the reason we couldn't put them there used to be that callers couldn't tell what kind of cleanup would do_dentry_open() failure call for. Now that we have FMODE_OPENED, cleanup is the same in all cases - it's simply fput(). So let's fold that into do_dentry_open(), as Christoph's patch tried to. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | lift fput() on late failures into path_openat()Al Viro2018-07-121-16/+12Star
| | | | | | | | | | | | | | | Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | fold put_filp() into fput()Al Viro2018-07-124-21/+10Star
| | | | | | | | | | | | | | | | | | | | | Just check FMODE_OPENED in __fput() and be done with that... Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | introduce FMODE_OPENEDAl Viro2018-07-123-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | basically, "is that instance set up enough for regular fput(), or do we want put_filp() for that one". NOTE: the only alloc_file() caller that could be followed by put_filp() is in arch/ia64/kernel/perfmon.c, which is (Kconfig-level) broken. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | ->file_open(): lose cred argumentAl Viro2018-07-126-10/+10
| | | | | | | | | | | | | | | Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | security_file_open(): lose cred argumentAl Viro2018-07-123-6/+5Star
| | | | | | | | | | | | | | | Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | get rid of cred argument of vfs_open() and do_dentry_open()Al Viro2018-07-123-12/+9Star
| | | | | | | | | | | | | | | | | | | | | always equal to ->f_cred Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | pass ->f_flags value to alloc_empty_file()Al Viro2018-07-124-13/+9Star
| | | | | | | | | | | | | | | | | | ... and have it set the f_flags-derived part of ->f_mode. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | pass creds to get_empty_filp(), make sure dentry_open() passes the right credsAl Viro2018-07-124-6/+5Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and rename get_empty_filp() to alloc_empty_file(). dentry_open() gets creds as argument, but the only thing that sees those is security_file_open() - file->f_cred still ends up with current_cred(). For almost all callers it's the same thing, but there are several broken cases. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | alloc_file(): switch to passing O_... flags instead of FMODE_... modeAl Viro2018-07-1212-36/+27Star
| | | | | | | | | | | | | | | | | | | | | ... so that it could set both ->f_flags and ->f_mode, without callers having to set ->f_flags manually. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | make sure do_dentry_open() won't return positive as an errorAl Viro2018-07-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | An ->open() instances really, really should not be doing that. There's a lot of places e.g. around atomic_open() that could be confused by that, so let's catch that early. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | create_pipe_files(): use fput() if allocation of the second file failsAl Viro2018-07-111-4/+3Star
| | | | | | | | | | | | | | | | | | | | | | | | ... just use put_pipe_info() to get the pipe->files down to 1 and let fput()-called pipe_release() do freeing. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | turn filp_clone_open() into inline wrapper for dentry_open()Al Viro2018-07-114-23/+6Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it's exactly the same thing as dentry_open(&file->f_path, file->f_flags, file->f_cred) ... and rename it to file_clone_open(), while we are at it. 'filp' naming convention is bogus; sure, it's "file pointer", but we generally don't do that kind of Hungarian notation. Some of the instances have too many callers to touch, but this one has only two, so let's sanitize it while we can... Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | fold security_file_free() into file_free()Al Viro2018-07-111-6/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | .. and the call of file_free() in case of security_file_alloc() failure in get_empty_filp() should be simply file_free_rcu() - no point in rcu-delays there, anyway. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | ocxlflash_getfile(): fix double-iput() on alloc_file() failuresAl Viro2018-07-111-3/+2Star
| | | | | | | | | | | | | | | | | | Cc: stable@vger.kernel.org Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | cxl_getfile(): fix double-iput() on alloc_file() failuresAl Viro2018-07-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Doing iput() after path_put() is wrong. Cc: stable@vger.kernel.org Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | drm_mode_create_lease_ioctl(): fix open-coded filp_clone_open()Al Viro2018-07-113-16/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | Failure of ->open() should *not* be followed by fput(). Fixed by using filp_clone_open(), which gets the cleanups right. Cc: stable@vger.kernel.org Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | proc: add proc_seq_releaseChunyu Hu2018-06-281-1/+10
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kmemleak reported some memory leak on reading proc files. After adding some debug lines, find that proc_seq_fops is using seq_release as release handler, which won't handle the free of 'private' field of seq_file, while in fact the open handler proc_seq_open could create the private data with __seq_open_private when state_size is greater than zero. So after reading files created with proc_create_seq_private, such as /proc/timer_list and /proc/vmallocinfo, the private mem of a seq_file is not freed. Fix it by adding the paired proc_seq_release as the default release handler of proc_seq_ops instead of seq_release. Fixes: 44414d82cfe0 ("proc: introduce proc_create_seq_private") Reviewed-by: Christoph Hellwig <hch@lst.de> CC: Christoph Hellwig <hch@lst.de> Signed-off-by: Chunyu Hu <chuhu@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* / ovl: fix wrong use of impure dir cache in ovl_iterate()Amir Goldstein2018-07-171-2/+17
|/ | | | | | | | | | | | | | | | | | | | | Only upper dir can be impure, but if we are in the middle of iterating a lower real dir, dir could be copied up and marked impure. We only want the impure cache if we started iterating a real upper dir to begin with. Aditya Kali reported that the following reproducer hits the WARN_ON(!cache->refcount) in ovl_get_cache(): docker run --rm drupal:8.5.4-fpm-alpine \ sh -c 'cd /var/www/html/vendor/symfony && \ chown -R www-data:www-data . && ls -l .' Reported-by: Aditya Kali <adityakali@google.com> Tested-by: Aditya Kali <adityakali@google.com> Fixes: 4edb83bb1041 ('ovl: constant d_ino for non-merge dirs') Cc: <stable@vger.kernel.org> # v4.14 Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* Linux 4.18-rc1Linus Torvalds2018-06-171-2/+2
|
* Merge tag 'for-linus-20180616' of git://git.kernel.dk/linux-blockLinus Torvalds2018-06-1616-275/+174Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull block fixes from Jens Axboe: "A collection of fixes that should go into -rc1. This contains: - bsg_open vs bsg_unregister race fix (Anatoliy) - NVMe pull request from Christoph, with fixes for regressions in this window, FC connect/reconnect path code unification, and a trace point addition. - timeout fix (Christoph) - remove a few unused functions (Christoph) - blk-mq tag_set reinit fix (Roman)" * tag 'for-linus-20180616' of git://git.kernel.dk/linux-block: bsg: fix race of bsg_open and bsg_unregister block: remov blk_queue_invalidate_tags nvme-fabrics: fix and refine state checks in __nvmf_check_ready nvme-fabrics: handle the admin-only case properly in nvmf_check_ready nvme-fabrics: refactor queue ready check blk-mq: remove blk_mq_tagset_iter nvme: remove nvme_reinit_tagset nvme-fc: fix nulling of queue data on reconnect nvme-fc: remove reinit_request routine blk-mq: don't time out requests again that are in the timeout handler nvme-fc: change controllers first connect to use reconnect path nvme: don't rely on the changed namespace list log nvmet: free smart-log buffer after use nvme-rdma: fix error flow during mapping request data nvme: add bio remapping tracepoint nvme: fix NULL pointer dereference in nvme_init_subsystem blk-mq: reinit q->tag_set_list entry only after grace period