]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fuse: move 'devices' member from fuse_conn to fuse_chan
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 17 Mar 2026 12:09:20 +0000 (13:09 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 15 Jun 2026 12:06:15 +0000 (14:06 +0200)
This belongs in the transport layer.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dev.c
fs/fuse/fuse_dev_i.h
fs/fuse/fuse_i.h
fs/fuse/inode.c
fs/fuse/req_timeout.c

index 7339959fa8d3c0539feb3e0600c1ae291827e151..41834108bcc1eec6fd332b747890322c77b82de3 100644 (file)
@@ -343,13 +343,20 @@ void fuse_chan_release(struct fuse_chan *fch)
 
 void fuse_chan_free(struct fuse_chan *fch)
 {
+       WARN_ON(!list_empty(&fch->devices));
        kfree(fch);
 }
 EXPORT_SYMBOL_GPL(fuse_chan_free);
 
 struct fuse_chan *fuse_chan_new(void)
 {
-       return kzalloc_obj(struct fuse_chan);
+       struct fuse_chan *fch = kzalloc_obj(struct fuse_chan);
+       if (!fch)
+               return NULL;
+
+       INIT_LIST_HEAD(&fch->devices);
+
+       return fch;
 }
 EXPORT_SYMBOL_GPL(fuse_chan_new);
 
@@ -418,7 +425,7 @@ void fuse_dev_install(struct fuse_dev *fud, struct fuse_conn *fc)
                 */
                fc->connected = 0;
        } else {
-               list_add_tail(&fud->entry, &fc->devices);
+               list_add_tail(&fud->entry, &fc->chan->devices);
                fuse_conn_get(fc);
        }
        spin_unlock(&fc->lock);
@@ -2051,7 +2058,7 @@ static void fuse_resend(struct fuse_conn *fc)
                return;
        }
 
-       list_for_each_entry(fud, &fc->devices, entry) {
+       list_for_each_entry(fud, &fc->chan->devices, entry) {
                struct fuse_pqueue *fpq = &fud->pq;
 
                spin_lock(&fpq->lock);
@@ -2532,7 +2539,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
                spin_unlock(&fc->bg_lock);
 
                fuse_set_initialized(fc);
-               list_for_each_entry(fud, &fc->devices, entry) {
+               list_for_each_entry(fud, &fc->chan->devices, entry) {
                        struct fuse_pqueue *fpq = &fud->pq;
 
                        spin_lock(&fpq->lock);
@@ -2618,7 +2625,7 @@ int fuse_dev_release(struct inode *inode, struct file *file)
                spin_lock(&fc->lock);
                list_del(&fud->entry);
                /* Are we the last open device? */
-               last = list_empty(&fc->devices);
+               last = list_empty(&fc->chan->devices);
                spin_unlock(&fc->lock);
 
                if (last) {
index 6afc9bb608a9142710908c9b7439ae9027422277..1949a07d78335dcc25ec175dad2345751129e8c5 100644 (file)
@@ -90,6 +90,9 @@ struct fuse_iqueue {
 struct fuse_chan {
        /** Input queue */
        struct fuse_iqueue iq;
+
+       /** List of device instances belonging to this connection */
+       struct list_head devices;
 };
 
 #define FUSE_PQ_HASH_BITS 8
@@ -125,7 +128,7 @@ struct fuse_dev {
        /** Processing queue */
        struct fuse_pqueue pq;
 
-       /** list entry on fc->devices */
+       /** list entry on fch->devices */
        struct list_head entry;
 };
 
index fd5f741693ca0b1e7ca7bc7eb82213cc90e7201f..6185b97df106dd6ea7959897443d0faa76b60e77 100644 (file)
@@ -835,9 +835,6 @@ struct fuse_conn {
         */
        struct rw_semaphore killsb;
 
-       /** List of device instances belonging to this connection */
-       struct list_head devices;
-
 #ifdef CONFIG_FUSE_DAX
        /* Dax mode */
        enum fuse_dax_mode dax_mode;
index 48a836b1ccd3ed6e45cff5c1639a63bb742606b4..e7271879e7e21f45de37276b5cf303a6a9a3a41c 100644 (file)
@@ -982,7 +982,6 @@ void fuse_conn_init(struct fuse_conn *fc, struct fuse_mount *fm,
        init_waitqueue_head(&fc->blocked_waitq);
        INIT_LIST_HEAD(&fc->bg_queue);
        INIT_LIST_HEAD(&fc->entry);
-       INIT_LIST_HEAD(&fc->devices);
        atomic_set(&fc->num_waiting, 0);
        fc->max_background = FUSE_DEFAULT_MAX_BACKGROUND;
        fc->congestion_threshold = FUSE_DEFAULT_CONGESTION_THRESHOLD;
@@ -1543,7 +1542,6 @@ EXPORT_SYMBOL_GPL(fuse_send_init);
 
 void fuse_free_conn(struct fuse_conn *fc)
 {
-       WARN_ON(!list_empty(&fc->devices));
        kfree(fc);
 }
 EXPORT_SYMBOL_GPL(fuse_free_conn);
index 5357a2d63b3f012d4cf24be0223c81e5ef8d57b2..ca44a7940174aabba98bba32ec979dc21c2a8574 100644 (file)
@@ -94,7 +94,7 @@ static void fuse_check_timeout(struct work_struct *work)
                spin_unlock(&fc->lock);
                return;
        }
-       list_for_each_entry(fud, &fc->devices, entry) {
+       list_for_each_entry(fud, &fc->chan->devices, entry) {
                fpq = &fud->pq;
                spin_lock(&fpq->lock);
                if (fuse_request_expired(fc, &fpq->io) ||