* [PATCH 0/2] fuse: Flush io-uring bg requests @ 2025-07-22 22:15 Bernd Schubert 2025-07-22 22:15 ` [PATCH 1/2] fuse: Refactor io-uring bg queue flush and queue abort Bernd Schubert 2025-07-22 22:15 ` [PATCH 2/2] fuse: Flush the io-uring bg queue from fuse_uring_flush_bg Bernd Schubert 0 siblings, 2 replies; 6+ messages in thread From: Bernd Schubert @ 2025-07-22 22:15 UTC (permalink / raw) To: Miklos Szeredi; +Cc: linux-fsdevel, Darrick J. Wong, Bernd Schubert This is on top of Darricks iomap patches and allows to flush fuse-io-uring bg requests. We actually see busy mount points in some xfstests and these patches seem to solve that. https://lore.kernel.org/r/175279449501.710975.16858401145201411486.stgit@frogsfrogsfrogs Signed-off-by: Bernd Schubert <bschubert@ddn.com> --- Bernd Schubert (2): fuse: Refactor io-uring bg queue flush and queue abort fuse: Flush the io-uring bg queue from fuse_uring_flush_bg fs/fuse/dev.c | 2 ++ fs/fuse/dev_uring.c | 17 ++++++++++------- fs/fuse/dev_uring_i.h | 8 ++++++-- 3 files changed, 18 insertions(+), 9 deletions(-) --- base-commit: 5ef3da3900942680e3cded352be2dede505e2c26 change-id: 20250723-bg-flush-fa830835772e Best regards, -- Bernd Schubert <bschubert@ddn.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] fuse: Refactor io-uring bg queue flush and queue abort 2025-07-22 22:15 [PATCH 0/2] fuse: Flush io-uring bg requests Bernd Schubert @ 2025-07-22 22:15 ` Bernd Schubert 2025-07-24 0:17 ` Joanne Koong 2025-07-22 22:15 ` [PATCH 2/2] fuse: Flush the io-uring bg queue from fuse_uring_flush_bg Bernd Schubert 1 sibling, 1 reply; 6+ messages in thread From: Bernd Schubert @ 2025-07-22 22:15 UTC (permalink / raw) To: Miklos Szeredi; +Cc: linux-fsdevel, Darrick J. Wong, Bernd Schubert This is a preparation to allow fuse-io-uring bg queue flush from flush_bg_queue() This does two function renames: fuse_uring_flush_bg -> fuse_uring_flush_queue_bg fuse_uring_abort_end_requests -> fuse_uring_flush_bg And fuse_uring_abort_end_queue_requests() is moved to fuse_uring_stop_queues(). Signed-off-by: Bernd Schubert <bschubert@ddn.com> --- fs/fuse/dev_uring.c | 14 +++++++------- fs/fuse/dev_uring_i.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 249b210becb1cc2b40ae7b2fdf3a57dc57eaac42..eca457d1005e7ecb9d220d5092d00cf60961afea 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -47,7 +47,7 @@ static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd) return pdu->ent; } -static void fuse_uring_flush_bg(struct fuse_ring_queue *queue) +static void fuse_uring_flush_queue_bg(struct fuse_ring_queue *queue) { struct fuse_ring *ring = queue->ring; struct fuse_conn *fc = ring->fc; @@ -88,7 +88,7 @@ static void fuse_uring_req_end(struct fuse_ring_ent *ent, struct fuse_req *req, if (test_bit(FR_BACKGROUND, &req->flags)) { queue->active_background--; spin_lock(&fc->bg_lock); - fuse_uring_flush_bg(queue); + fuse_uring_flush_queue_bg(queue); spin_unlock(&fc->bg_lock); } @@ -117,11 +117,11 @@ static void fuse_uring_abort_end_queue_requests(struct fuse_ring_queue *queue) fuse_dev_end_requests(&req_list); } -void fuse_uring_abort_end_requests(struct fuse_ring *ring) +void fuse_uring_flush_bg(struct fuse_conn *fc) { int qid; struct fuse_ring_queue *queue; - struct fuse_conn *fc = ring->fc; + struct fuse_ring *ring = fc->ring; for (qid = 0; qid < ring->nr_queues; qid++) { queue = READ_ONCE(ring->queues[qid]); @@ -133,10 +133,9 @@ void fuse_uring_abort_end_requests(struct fuse_ring *ring) WARN_ON_ONCE(ring->fc->max_background != UINT_MAX); spin_lock(&queue->lock); spin_lock(&fc->bg_lock); - fuse_uring_flush_bg(queue); + fuse_uring_flush_queue_bg(queue); spin_unlock(&fc->bg_lock); spin_unlock(&queue->lock); - fuse_uring_abort_end_queue_requests(queue); } } @@ -475,6 +474,7 @@ void fuse_uring_stop_queues(struct fuse_ring *ring) if (!queue) continue; + fuse_uring_abort_end_queue_requests(queue); fuse_uring_teardown_entries(queue); } @@ -1326,7 +1326,7 @@ bool fuse_uring_queue_bq_req(struct fuse_req *req) fc->num_background++; if (fc->num_background == fc->max_background) fc->blocked = 1; - fuse_uring_flush_bg(queue); + fuse_uring_flush_queue_bg(queue); spin_unlock(&fc->bg_lock); /* diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 51a563922ce14158904a86c248c77767be4fe5ae..55f52508de3ced624ac17fba6da1b637b1697dff 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -138,7 +138,7 @@ struct fuse_ring { bool fuse_uring_enabled(void); void fuse_uring_destruct(struct fuse_conn *fc); void fuse_uring_stop_queues(struct fuse_ring *ring); -void fuse_uring_abort_end_requests(struct fuse_ring *ring); +void fuse_uring_flush_bg(struct fuse_conn *fc); int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req); bool fuse_uring_queue_bq_req(struct fuse_req *req); @@ -153,7 +153,7 @@ static inline void fuse_uring_abort(struct fuse_conn *fc) return; if (atomic_read(&ring->queue_refs) > 0) { - fuse_uring_abort_end_requests(ring); + fuse_uring_flush_bg(fc); fuse_uring_stop_queues(ring); } } -- 2.43.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] fuse: Refactor io-uring bg queue flush and queue abort 2025-07-22 22:15 ` [PATCH 1/2] fuse: Refactor io-uring bg queue flush and queue abort Bernd Schubert @ 2025-07-24 0:17 ` Joanne Koong 0 siblings, 0 replies; 6+ messages in thread From: Joanne Koong @ 2025-07-24 0:17 UTC (permalink / raw) To: Bernd Schubert; +Cc: Miklos Szeredi, linux-fsdevel, Darrick J. Wong On Tue, Jul 22, 2025 at 3:15 PM Bernd Schubert <bschubert@ddn.com> wrote: > > This is a preparation to allow fuse-io-uring bg queue > flush from flush_bg_queue() > > This does two function renames: > fuse_uring_flush_bg -> fuse_uring_flush_queue_bg > fuse_uring_abort_end_requests -> fuse_uring_flush_bg > > And fuse_uring_abort_end_queue_requests() is moved to > fuse_uring_stop_queues(). > > Signed-off-by: Bernd Schubert <bschubert@ddn.com> > --- > fs/fuse/dev_uring.c | 14 +++++++------- > fs/fuse/dev_uring_i.h | 4 ++-- > 2 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c > index 249b210becb1cc2b40ae7b2fdf3a57dc57eaac42..eca457d1005e7ecb9d220d5092d00cf60961afea 100644 > --- a/fs/fuse/dev_uring.c > +++ b/fs/fuse/dev_uring.c > @@ -47,7 +47,7 @@ static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd) > return pdu->ent; > } > > -static void fuse_uring_flush_bg(struct fuse_ring_queue *queue) > +static void fuse_uring_flush_queue_bg(struct fuse_ring_queue *queue) nit: i find the naming "fuse_uring_flush_bg_queue" easier to follow than "fuse_uring_flush_queue_bg" > { > struct fuse_ring *ring = queue->ring; > struct fuse_conn *fc = ring->fc; > @@ -88,7 +88,7 @@ static void fuse_uring_req_end(struct fuse_ring_ent *ent, struct fuse_req *req, > if (test_bit(FR_BACKGROUND, &req->flags)) { > queue->active_background--; > spin_lock(&fc->bg_lock); > - fuse_uring_flush_bg(queue); > + fuse_uring_flush_queue_bg(queue); > spin_unlock(&fc->bg_lock); > } > > @@ -117,11 +117,11 @@ static void fuse_uring_abort_end_queue_requests(struct fuse_ring_queue *queue) > fuse_dev_end_requests(&req_list); > } > > -void fuse_uring_abort_end_requests(struct fuse_ring *ring) > +void fuse_uring_flush_bg(struct fuse_conn *fc) > { > int qid; > struct fuse_ring_queue *queue; > - struct fuse_conn *fc = ring->fc; > + struct fuse_ring *ring = fc->ring; > > for (qid = 0; qid < ring->nr_queues; qid++) { > queue = READ_ONCE(ring->queues[qid]); Does the "queue->stopped = true;" line inside this function need to get moved? AFAICT, if we set queue->stopped to true here, then we're not able to send out the request (eg fuse_uring_commit_fetch() returns err if queue->stopped is true) Thanks, Joanne > @@ -133,10 +133,9 @@ void fuse_uring_abort_end_requests(struct fuse_ring *ring) > WARN_ON_ONCE(ring->fc->max_background != UINT_MAX); > spin_lock(&queue->lock); > spin_lock(&fc->bg_lock); > - fuse_uring_flush_bg(queue); > + fuse_uring_flush_queue_bg(queue); > spin_unlock(&fc->bg_lock); > spin_unlock(&queue->lock); > - fuse_uring_abort_end_queue_requests(queue); > } > } > > @@ -475,6 +474,7 @@ void fuse_uring_stop_queues(struct fuse_ring *ring) > if (!queue) > continue; > > + fuse_uring_abort_end_queue_requests(queue); > fuse_uring_teardown_entries(queue); > } > > @@ -1326,7 +1326,7 @@ bool fuse_uring_queue_bq_req(struct fuse_req *req) > fc->num_background++; > if (fc->num_background == fc->max_background) > fc->blocked = 1; > - fuse_uring_flush_bg(queue); > + fuse_uring_flush_queue_bg(queue); > spin_unlock(&fc->bg_lock); > > /* > diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h > index 51a563922ce14158904a86c248c77767be4fe5ae..55f52508de3ced624ac17fba6da1b637b1697dff 100644 > --- a/fs/fuse/dev_uring_i.h > +++ b/fs/fuse/dev_uring_i.h > @@ -138,7 +138,7 @@ struct fuse_ring { > bool fuse_uring_enabled(void); > void fuse_uring_destruct(struct fuse_conn *fc); > void fuse_uring_stop_queues(struct fuse_ring *ring); > -void fuse_uring_abort_end_requests(struct fuse_ring *ring); > +void fuse_uring_flush_bg(struct fuse_conn *fc); > int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); > void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req); > bool fuse_uring_queue_bq_req(struct fuse_req *req); > @@ -153,7 +153,7 @@ static inline void fuse_uring_abort(struct fuse_conn *fc) > return; > > if (atomic_read(&ring->queue_refs) > 0) { > - fuse_uring_abort_end_requests(ring); > + fuse_uring_flush_bg(fc); > fuse_uring_stop_queues(ring); > } > } > > -- > 2.43.0 > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] fuse: Flush the io-uring bg queue from fuse_uring_flush_bg 2025-07-22 22:15 [PATCH 0/2] fuse: Flush io-uring bg requests Bernd Schubert 2025-07-22 22:15 ` [PATCH 1/2] fuse: Refactor io-uring bg queue flush and queue abort Bernd Schubert @ 2025-07-22 22:15 ` Bernd Schubert 2025-07-23 23:51 ` Joanne Koong 1 sibling, 1 reply; 6+ messages in thread From: Bernd Schubert @ 2025-07-22 22:15 UTC (permalink / raw) To: Miklos Szeredi; +Cc: linux-fsdevel, Darrick J. Wong, Bernd Schubert This is useful to have a unique API to flush background requests. For example when the bg queue gets flushed before the remaining of fuse_conn_destroy(). Signed-off-by: Bernd Schubert <bschubert@ddn.com> --- fs/fuse/dev.c | 2 ++ fs/fuse/dev_uring.c | 3 +++ fs/fuse/dev_uring_i.h | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 5387e4239d6aa6f7a9780deaf581483cc28a5e68..d5f2fb82c04bf1ee7a35cb1d6d43e639270945af 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2408,6 +2408,8 @@ void fuse_flush_requests(struct fuse_conn *fc, unsigned long timeout) spin_unlock(&fc->bg_lock); spin_unlock(&fc->lock); + fuse_uring_flush_bg(fc); + /* * Wait 30s for all the events to complete or abort. Touch the * watchdog once per second so that we don't trip the hangcheck timer diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index eca457d1005e7ecb9d220d5092d00cf60961afea..acf11eadbf3b6d999b310b5d8a4a6018e83cb2a9 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -123,6 +123,9 @@ void fuse_uring_flush_bg(struct fuse_conn *fc) struct fuse_ring_queue *queue; struct fuse_ring *ring = fc->ring; + if (!ring) + return; + for (qid = 0; qid < ring->nr_queues; qid++) { queue = READ_ONCE(ring->queues[qid]); if (!queue) diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 55f52508de3ced624ac17fba6da1b637b1697dff..ae806dd578f26fbeac12f880cd7b6031a56aec00 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -206,6 +206,10 @@ static inline bool fuse_uring_request_expired(struct fuse_conn *fc) return false; } +static inline void fuse_uring_flush_bg(struct fuse_conn *fc) +{ +} + #endif /* CONFIG_FUSE_IO_URING */ #endif /* _FS_FUSE_DEV_URING_I_H */ -- 2.43.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] fuse: Flush the io-uring bg queue from fuse_uring_flush_bg 2025-07-22 22:15 ` [PATCH 2/2] fuse: Flush the io-uring bg queue from fuse_uring_flush_bg Bernd Schubert @ 2025-07-23 23:51 ` Joanne Koong 2025-07-24 0:08 ` Joanne Koong 0 siblings, 1 reply; 6+ messages in thread From: Joanne Koong @ 2025-07-23 23:51 UTC (permalink / raw) To: Bernd Schubert; +Cc: Miklos Szeredi, linux-fsdevel, Darrick J. Wong On Tue, Jul 22, 2025 at 3:42 PM Bernd Schubert <bschubert@ddn.com> wrote: > > This is useful to have a unique API to flush background requests. > For example when the bg queue gets flushed before > the remaining of fuse_conn_destroy(). > > Signed-off-by: Bernd Schubert <bschubert@ddn.com> > --- > fs/fuse/dev.c | 2 ++ > fs/fuse/dev_uring.c | 3 +++ > fs/fuse/dev_uring_i.h | 4 ++++ > 3 files changed, 9 insertions(+) > > diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c > index 5387e4239d6aa6f7a9780deaf581483cc28a5e68..d5f2fb82c04bf1ee7a35cb1d6d43e639270945af 100644 > --- a/fs/fuse/dev.c > +++ b/fs/fuse/dev.c > @@ -2408,6 +2408,8 @@ void fuse_flush_requests(struct fuse_conn *fc, unsigned long timeout) > spin_unlock(&fc->bg_lock); > spin_unlock(&fc->lock); > > + fuse_uring_flush_bg(fc); I think we'll need to get rid of the "WARN_ON_ONCE(ring->fc->max_background != UINT_MAX);" in fuse_uring_flush_bg() since fuse_flush_requests() sets fc->max_background to UINT_MAX a few lines above before making this call. Thanks, Joanne > + > /* > * Wait 30s for all the events to complete or abort. Touch the > * watchdog once per second so that we don't trip the hangcheck timer > diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c > index eca457d1005e7ecb9d220d5092d00cf60961afea..acf11eadbf3b6d999b310b5d8a4a6018e83cb2a9 100644 > --- a/fs/fuse/dev_uring.c > +++ b/fs/fuse/dev_uring.c > @@ -123,6 +123,9 @@ void fuse_uring_flush_bg(struct fuse_conn *fc) > struct fuse_ring_queue *queue; > struct fuse_ring *ring = fc->ring; > > + if (!ring) > + return; > + > for (qid = 0; qid < ring->nr_queues; qid++) { > queue = READ_ONCE(ring->queues[qid]); > if (!queue) > diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h > index 55f52508de3ced624ac17fba6da1b637b1697dff..ae806dd578f26fbeac12f880cd7b6031a56aec00 100644 > --- a/fs/fuse/dev_uring_i.h > +++ b/fs/fuse/dev_uring_i.h > @@ -206,6 +206,10 @@ static inline bool fuse_uring_request_expired(struct fuse_conn *fc) > return false; > } > > +static inline void fuse_uring_flush_bg(struct fuse_conn *fc) > +{ > +} > + > #endif /* CONFIG_FUSE_IO_URING */ > > #endif /* _FS_FUSE_DEV_URING_I_H */ > > -- > 2.43.0 > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] fuse: Flush the io-uring bg queue from fuse_uring_flush_bg 2025-07-23 23:51 ` Joanne Koong @ 2025-07-24 0:08 ` Joanne Koong 0 siblings, 0 replies; 6+ messages in thread From: Joanne Koong @ 2025-07-24 0:08 UTC (permalink / raw) To: Bernd Schubert; +Cc: Miklos Szeredi, linux-fsdevel, Darrick J. Wong On Wed, Jul 23, 2025 at 4:51 PM Joanne Koong <joannelkoong@gmail.com> wrote: > > On Tue, Jul 22, 2025 at 3:42 PM Bernd Schubert <bschubert@ddn.com> wrote: > > > > This is useful to have a unique API to flush background requests. > > For example when the bg queue gets flushed before > > the remaining of fuse_conn_destroy(). > > > > Signed-off-by: Bernd Schubert <bschubert@ddn.com> > > --- > > fs/fuse/dev.c | 2 ++ > > fs/fuse/dev_uring.c | 3 +++ > > fs/fuse/dev_uring_i.h | 4 ++++ > > 3 files changed, 9 insertions(+) > > > > diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c > > index 5387e4239d6aa6f7a9780deaf581483cc28a5e68..d5f2fb82c04bf1ee7a35cb1d6d43e639270945af 100644 > > --- a/fs/fuse/dev.c > > +++ b/fs/fuse/dev.c > > @@ -2408,6 +2408,8 @@ void fuse_flush_requests(struct fuse_conn *fc, unsigned long timeout) > > spin_unlock(&fc->bg_lock); > > spin_unlock(&fc->lock); > > > > + fuse_uring_flush_bg(fc); > > I think we'll need to get rid of the > "WARN_ON_ONCE(ring->fc->max_background != UINT_MAX);" in > fuse_uring_flush_bg() since fuse_flush_requests() sets > fc->max_background to UINT_MAX a few lines above before making this > call. > Ahh never mind, just realized I read this check in reverse. this looks fine to me. Reviewed-by: Joanne Koong <joannelkoong@gmail.com> > > Thanks, > Joanne > > > + > > /* > > * Wait 30s for all the events to complete or abort. Touch the > > * watchdog once per second so that we don't trip the hangcheck timer > > diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c > > index eca457d1005e7ecb9d220d5092d00cf60961afea..acf11eadbf3b6d999b310b5d8a4a6018e83cb2a9 100644 > > --- a/fs/fuse/dev_uring.c > > +++ b/fs/fuse/dev_uring.c > > @@ -123,6 +123,9 @@ void fuse_uring_flush_bg(struct fuse_conn *fc) > > struct fuse_ring_queue *queue; > > struct fuse_ring *ring = fc->ring; > > > > + if (!ring) > > + return; > > + > > for (qid = 0; qid < ring->nr_queues; qid++) { > > queue = READ_ONCE(ring->queues[qid]); > > if (!queue) > > diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h > > index 55f52508de3ced624ac17fba6da1b637b1697dff..ae806dd578f26fbeac12f880cd7b6031a56aec00 100644 > > --- a/fs/fuse/dev_uring_i.h > > +++ b/fs/fuse/dev_uring_i.h > > @@ -206,6 +206,10 @@ static inline bool fuse_uring_request_expired(struct fuse_conn *fc) > > return false; > > } > > > > +static inline void fuse_uring_flush_bg(struct fuse_conn *fc) > > +{ > > +} > > + > > #endif /* CONFIG_FUSE_IO_URING */ > > > > #endif /* _FS_FUSE_DEV_URING_I_H */ > > > > -- > > 2.43.0 > > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-07-24 0:17 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-07-22 22:15 [PATCH 0/2] fuse: Flush io-uring bg requests Bernd Schubert 2025-07-22 22:15 ` [PATCH 1/2] fuse: Refactor io-uring bg queue flush and queue abort Bernd Schubert 2025-07-24 0:17 ` Joanne Koong 2025-07-22 22:15 ` [PATCH 2/2] fuse: Flush the io-uring bg queue from fuse_uring_flush_bg Bernd Schubert 2025-07-23 23:51 ` Joanne Koong 2025-07-24 0:08 ` Joanne Koong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).