diff options
| author | Miklos Szeredi <mszeredi@redhat.com> | 2026-03-17 16:32:37 +0100 |
|---|---|---|
| committer | Miklos Szeredi <mszeredi@redhat.com> | 2026-06-15 14:06:16 +0200 |
| commit | bf9932623d20e8b7b695077f531d1fa43ddaaaf3 (patch) | |
| tree | 6680aad9c743d9200bfaac25e1d0b54b36e42dbc /fs/fuse/dev.c | |
| parent | 36b6a1e5edd2ac23b64645c25a6b62c2d37a41f4 (diff) | |
| download | linux-next-bf9932623d20e8b7b695077f531d1fa43ddaaaf3.tar.gz linux-next-bf9932623d20e8b7b695077f531d1fa43ddaaaf3.zip | |
fuse: split off fch->lock from fc->lock
And document which members they protect.
end_polls() is called with both, outer fch->lock is probably unnecessary,
but doesn't hurt for now.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/dev.c')
| -rw-r--r-- | fs/fuse/dev.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 27357ee01fe5..52f46efd85ba 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -354,6 +354,7 @@ struct fuse_chan *fuse_chan_new(void) if (!fch) return NULL; + spin_lock_init(&fch->lock); INIT_LIST_HEAD(&fch->devices); spin_lock_init(&fch->bg_lock); INIT_LIST_HEAD(&fch->bg_queue); @@ -418,7 +419,7 @@ void fuse_dev_install(struct fuse_dev *fud, struct fuse_conn *fc) { struct fuse_conn *old_fc; - spin_lock(&fc->lock); + spin_lock(&fc->chan->lock); /* * Pairs with: * - xchg() in fuse_dev_release() @@ -436,7 +437,7 @@ void fuse_dev_install(struct fuse_dev *fud, struct fuse_conn *fc) list_add_tail(&fud->entry, &fc->chan->devices); fuse_conn_get(fc); } - spin_unlock(&fc->lock); + spin_unlock(&fc->chan->lock); } EXPORT_SYMBOL_GPL(fuse_dev_install); @@ -463,9 +464,9 @@ void fuse_dev_put(struct fuse_dev *fud) fc = fuse_dev_fc_get(fud); if (fc && fc != FUSE_DEV_FC_DISCONNECTED) { /* This is the virtiofs case (fuse_dev_release() not called) */ - spin_lock(&fc->lock); + spin_lock(&fc->chan->lock); list_del(&fud->entry); - spin_unlock(&fc->lock); + spin_unlock(&fc->chan->lock); fuse_conn_put(fc); } @@ -2060,9 +2061,9 @@ static void fuse_resend(struct fuse_conn *fc) LIST_HEAD(to_queue); unsigned int i; - spin_lock(&fc->lock); + spin_lock(&fc->chan->lock); if (!fc->chan->connected) { - spin_unlock(&fc->lock); + spin_unlock(&fc->chan->lock); return; } @@ -2074,7 +2075,7 @@ static void fuse_resend(struct fuse_conn *fc) list_splice_tail_init(&fpq->processing[i], &to_queue); spin_unlock(&fpq->lock); } - spin_unlock(&fc->lock); + spin_unlock(&fc->chan->lock); list_for_each_entry_safe(req, next, &to_queue, list) { set_bit(FR_PENDING, &req->flags); @@ -2498,6 +2499,7 @@ static void end_polls(struct fuse_conn *fc) { struct rb_node *p; + spin_lock(&fc->lock); p = rb_first(&fc->polled_files); while (p) { @@ -2507,6 +2509,7 @@ static void end_polls(struct fuse_conn *fc) p = rb_next(p); } + spin_unlock(&fc->lock); } /* @@ -2531,7 +2534,7 @@ void fuse_abort_conn(struct fuse_conn *fc) { struct fuse_iqueue *fiq = &fc->chan->iq; - spin_lock(&fc->lock); + spin_lock(&fc->chan->lock); if (fc->chan->connected) { struct fuse_dev *fud; struct fuse_req *req, *next; @@ -2586,17 +2589,17 @@ void fuse_abort_conn(struct fuse_conn *fc) kill_fasync(&fiq->fasync, SIGIO, POLL_IN); end_polls(fc); wake_up_all(&fc->chan->blocked_waitq); - spin_unlock(&fc->lock); + spin_unlock(&fc->chan->lock); fuse_dev_end_requests(&to_end); /* - * fc->lock must not be taken to avoid conflicts with io-uring + * fc->chan->lock must not be taken to avoid conflicts with io-uring * locks */ fuse_uring_abort(fc); } else { - spin_unlock(&fc->lock); + spin_unlock(&fc->chan->lock); } } EXPORT_SYMBOL_GPL(fuse_abort_conn); @@ -2630,11 +2633,11 @@ int fuse_dev_release(struct inode *inode, struct file *file) fuse_dev_end_requests(&to_end); - spin_lock(&fc->lock); + spin_lock(&fc->chan->lock); list_del(&fud->entry); /* Are we the last open device? */ last = list_empty(&fc->chan->devices); - spin_unlock(&fc->lock); + spin_unlock(&fc->chan->lock); if (last) { WARN_ON(fc->chan->iq.fasync != NULL); |
