Linux filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: brauner@kernel.org, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] iomap: add a separate bio_set for iomap_split_ioend
Date: Mon, 29 Jun 2026 15:58:31 -0700	[thread overview]
Message-ID: <20260629225831.GG6095@frogsfrogsfrogs> (raw)
In-Reply-To: <20260629125229.3400726-1-hch@lst.de>

On Mon, Jun 29, 2026 at 02:52:29PM +0200, Christoph Hellwig wrote:
> iomap_split_ioend can split bios that already come from
> iomap_ioend_bioset and thus deadlock when the bioset is exhausted.
> 
> Add a separate bio_set to avoid this deadlock.

What happens if &iomap_ioend_split_bioset is exhausted?  Won't that also
stall the ioend submission?

<confused>

--D

> Fixes: 5fcbd555d483 ("iomap: split bios to zone append limits in the submission handlers")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/iomap/ioend.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/iomap/ioend.c b/fs/iomap/ioend.c
> index 01287f1ae021..2fbcb06f6938 100644
> --- a/fs/iomap/ioend.c
> +++ b/fs/iomap/ioend.c
> @@ -13,6 +13,7 @@
>  
>  struct bio_set iomap_ioend_bioset;
>  EXPORT_SYMBOL_GPL(iomap_ioend_bioset);
> +struct bio_set iomap_ioend_split_bioset;
>  
>  struct iomap_ioend *iomap_init_ioend(struct inode *inode,
>  		struct bio *bio, loff_t file_offset, u16 ioend_flags)
> @@ -483,7 +484,8 @@ struct iomap_ioend *iomap_split_ioend(struct iomap_ioend *ioend,
>  	sector_offset = ALIGN_DOWN(sector_offset << SECTOR_SHIFT,
>  			i_blocksize(ioend->io_inode)) >> SECTOR_SHIFT;
>  
> -	split = bio_split(bio, sector_offset, GFP_NOFS, &iomap_ioend_bioset);
> +	split = bio_split(bio, sector_offset, GFP_NOFS,
> +			&iomap_ioend_split_bioset);
>  	if (IS_ERR(split))
>  		return ERR_CAST(split);
>  	split->bi_private = bio->bi_private;
> @@ -506,8 +508,23 @@ EXPORT_SYMBOL_GPL(iomap_split_ioend);
>  
>  static int __init iomap_ioend_init(void)
>  {
> -	return bioset_init(&iomap_ioend_bioset, 4 * (PAGE_SIZE / SECTOR_SIZE),
> +	const unsigned int nr_mempool_entries = 4 * (PAGE_SIZE / SECTOR_SIZE);
> +	int error;
> +
> +	error = bioset_init(&iomap_ioend_bioset, nr_mempool_entries,
>  			   offsetof(struct iomap_ioend, io_bio),
>  			   BIOSET_NEED_BVECS);
> +	if (error)
> +		return error;
> +	error = bioset_init(&iomap_ioend_split_bioset, nr_mempool_entries,
> +			   offsetof(struct iomap_ioend, io_bio),
> +			   BIOSET_NEED_BVECS);
> +	if (error)
> +		goto out_exit_ioend_bioset;
> +	return 0;
> +
> +out_exit_ioend_bioset:
> +	bioset_exit(&iomap_ioend_bioset);
> +	return error;
>  }
>  fs_initcall(iomap_ioend_init);
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-06-29 22:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 12:52 [PATCH] iomap: add a separate bio_set for iomap_split_ioend Christoph Hellwig
2026-06-29 22:58 ` Darrick J. Wong [this message]
2026-06-30  5:17   ` Christoph Hellwig
2026-06-30 10:59 ` Christian Brauner
2026-07-07  5:04   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260629225831.GG6095@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=brauner@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox