summaryrefslogtreecommitdiff
path: root/fs/fuse/dev.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2026-03-31 15:50:29 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2026-06-15 14:06:17 +0200
commitff572265f29e4ad6d2fe5f625d9bbd741a187266 (patch)
tree2b1d8fee3e8a11b5d8b20fd67ad112e230b265a8 /fs/fuse/dev.c
parentca46a4aca6f703c53e59b6fd1a88d49c3eb5c186 (diff)
downloadlinux-next-ff572265f29e4ad6d2fe5f625d9bbd741a187266.tar.gz
linux-next-ff572265f29e4ad6d2fe5f625d9bbd741a187266.zip
fuse: set params in fuse_chan_set_initialized()
Set minor, max_write and max_pages in the fuse_chan. These match the same fields in fuse_conn but are needed in both layers. [Dongyang Jin: Pointers should use NULL instead of explicit '0'] Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/dev.c')
-rw-r--r--fs/fuse/dev.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 41f6a1b9397f..ec2f53b3d2c8 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -72,8 +72,14 @@ static void __fuse_put_request(struct fuse_req *req)
refcount_dec(&req->count);
}
-void fuse_chan_set_initialized(struct fuse_chan *fch)
+void fuse_chan_set_initialized(struct fuse_chan *fch, struct fuse_chan_param *param)
{
+ if (param) {
+ fch->minor = param->minor;
+ fch->max_write = param->max_write;
+ fch->max_pages = param->max_pages;
+ }
+
/* Make sure stores before this are seen on another CPU */
smp_wmb();
fch->initialized = 1;
@@ -719,12 +725,12 @@ static void __fuse_request_send(struct fuse_req *req)
smp_rmb();
}
-static void fuse_adjust_compat(struct fuse_conn *fc, struct fuse_args *args)
+static void fuse_adjust_compat(struct fuse_chan *fch, struct fuse_args *args)
{
- if (fc->minor < 4 && args->opcode == FUSE_STATFS)
+ if (fch->minor < 4 && args->opcode == FUSE_STATFS)
args->out_args[0].size = FUSE_COMPAT_STATFS_SIZE;
- if (fc->minor < 9) {
+ if (fch->minor < 9) {
switch (args->opcode) {
case FUSE_LOOKUP:
case FUSE_CREATE:
@@ -740,7 +746,7 @@ static void fuse_adjust_compat(struct fuse_conn *fc, struct fuse_args *args)
break;
}
}
- if (fc->minor < 12) {
+ if (fch->minor < 12) {
switch (args->opcode) {
case FUSE_CREATE:
args->in_args[0].size = sizeof(struct fuse_open_in);
@@ -784,8 +790,8 @@ ssize_t fuse_chan_send(struct fuse_chan *fch, struct fuse_args *args)
return PTR_ERR(req);
}
- /* Needs to be done after fuse_get_req() so that fc->minor is valid */
- fuse_adjust_compat(fch->conn, args);
+ /* Needs to be done after fuse_get_req() so that fch->minor is valid */
+ fuse_adjust_compat(fch, args);
fuse_args_to_req(req, args);
if (!args->noreply)
@@ -1466,12 +1472,12 @@ __releases(fiq->lock)
return ih.len;
}
-static int fuse_read_forget(struct fuse_conn *fc, struct fuse_iqueue *fiq,
+static int fuse_read_forget(struct fuse_chan *fch, struct fuse_iqueue *fiq,
struct fuse_copy_state *cs,
size_t nbytes)
__releases(fiq->lock)
{
- if (fc->minor < 16 || fiq->forget_list_head.next->next == NULL)
+ if (fch->minor < 16 || fiq->forget_list_head.next->next == NULL)
return fuse_read_single_forget(fiq, cs, nbytes);
else
return fuse_read_batch_forget(fiq, cs, nbytes);
@@ -1513,7 +1519,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
if (nbytes < max_t(size_t, FUSE_MIN_READ_BUFFER,
sizeof(struct fuse_in_header) +
sizeof(struct fuse_write_in) +
- fch->conn->max_write))
+ fch->max_write))
return -EINVAL;
restart:
@@ -1544,7 +1550,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
if (forget_pending(fiq)) {
if (list_empty(&fiq->pending) || fiq->forget_batch-- > 0)
- return fuse_read_forget(fch->conn, fiq, cs, nbytes);
+ return fuse_read_forget(fch, fiq, cs, nbytes);
if (fiq->forget_batch <= -8)
fiq->forget_batch = 16;
@@ -2123,7 +2129,7 @@ void fuse_chan_abort(struct fuse_chan *fch, bool abort_with_err)
fch->connected = 0;
spin_unlock(&fch->bg_lock);
- fuse_chan_set_initialized(fch);
+ fuse_chan_set_initialized(fch, NULL);
list_for_each_entry(fud, &fch->devices, entry) {
struct fuse_pqueue *fpq = &fud->pq;