Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31b14076 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "fs:fuse: Disable shortcircuit when mmap is called on a file"

parents 9d02f47b c93b8af0
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc)
		return NULL;

	ff->rw_lower_file = NULL;
	ff->shortcircuit_enabled = 0;
	if (fc->shortcircuit_io)
		ff->shortcircuit_enabled = 1;
	ff->fc = fc;
	ff->reserved_req = fuse_request_alloc(0);
	if (unlikely(!ff->reserved_req)) {
@@ -1001,7 +1004,7 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
			return err;
	}

	if (ff && ff->rw_lower_file)
	if (ff && ff->shortcircuit_enabled && ff->rw_lower_file)
		ret_val = fuse_shortcircuit_read_iter(iocb, to);
	else
		ret_val = generic_file_read_iter(iocb, to);
@@ -1278,7 +1281,7 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
	if (err)
		goto out;

	if (ff && ff->rw_lower_file) {
	if (ff && ff->shortcircuit_enabled && ff->rw_lower_file) {
		written = fuse_shortcircuit_write_iter(iocb, from);
		goto out;
	}
@@ -2173,6 +2176,9 @@ static const struct vm_operations_struct fuse_file_vm_ops = {

static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)
{
	struct fuse_file *ff = file->private_data;

	ff->shortcircuit_enabled = 0;
	if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE))
		fuse_link_write_file(file);

@@ -2183,6 +2189,10 @@ static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)

static int fuse_direct_mmap(struct file *file, struct vm_area_struct *vma)
{
	struct fuse_file *ff = file->private_data;

	ff->shortcircuit_enabled = 0;

	/* Can't provide the coherency needed for MAP_SHARED */
	if (vma->vm_flags & VM_MAYSHARE)
		return -ENODEV;
+1 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ struct fuse_file {

	/* the read write file */
	struct file *rw_lower_file;
	bool shortcircuit_enabled;
};

/** One input argument of a request */