public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>
Cc: Carlos Maiolino <cem@kernel.org>,
	Damien Le Moal <dlemoal@kernel.org>,
	linux-block@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/5] block: add a bio_submit_or_kill helper
Date: Tue, 7 Apr 2026 11:37:50 -0700	[thread overview]
Message-ID: <b2e8e413-39bf-4255-8aad-a30d7fd676ea@acm.org> (raw)
In-Reply-To: <20260407140538.633364-5-hch@lst.de>


On 4/7/26 7:05 AM, Christoph Hellwig wrote:
> diff --git a/block/ioctl.c b/block/ioctl.c
> index 0b04661ac809..fc3be0549aa7 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -153,13 +153,7 @@ static int blk_ioctl_discard(struct block_device *bdev, blk_mode_t mode,
>   	nr_sects = len >> SECTOR_SHIFT;
>   
>   	blk_start_plug(&plug);
> -	while (1) {
> -		if (fatal_signal_pending(current)) {
> -			if (prev)
> -				bio_await_chain(prev);
> -			err = -EINTR;
> -			goto out_unplug;
> -		}
> +	while (!fatal_signal_pending(current)) {
>   		bio = blk_alloc_discard_bio(bdev, &sector, &nr_sects,
>   				GFP_KERNEL);
>   		if (!bio)
> @@ -167,12 +161,11 @@ static int blk_ioctl_discard(struct block_device *bdev, blk_mode_t mode,
>   		prev = bio_chain_and_submit(prev, bio);
>   	}
>   	if (prev) {
> -		err = submit_bio_wait(prev);
> +		err = bio_submit_or_kill(prev, BLKDEV_ZERO_KILLABLE);
>   		if (err == -EOPNOTSUPP)
>   			err = 0;
>   		bio_put(prev);
>   	}
> -out_unplug:
>   	blk_finish_plug(&plug);
>   fail:
>   	filemap_invalidate_unlock(bdev->bd_mapping);

Without this change, if a fatal signal is pending before the loop 
starts, -EINTR is returned. With this patch applied, 0 is returned,
isn't it?

Thanks,

Bart.

  parent reply	other threads:[~2026-04-07 18:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 14:05 refactor submit_bio_wait and bio await helpers v3 Christoph Hellwig
2026-04-07 14:05 ` [PATCH 1/5] xfs: fix number of GC bvecs Christoph Hellwig
2026-04-07 14:05 ` [PATCH 2/5] block: unify the synchronous bi_end_io callbacks Christoph Hellwig
2026-04-08  7:56   ` Chaitanya Kulkarni
2026-04-07 14:05 ` [PATCH 3/5] block: factor out a bio_await helper Christoph Hellwig
2026-04-07 14:59   ` Bart Van Assche
2026-04-08  5:11     ` Christoph Hellwig
2026-04-07 14:05 ` [PATCH 4/5] block: add a bio_submit_or_kill helper Christoph Hellwig
2026-04-07 15:04   ` Bart Van Assche
2026-04-07 18:37   ` Bart Van Assche [this message]
2026-04-08  5:16     ` Christoph Hellwig
2026-04-07 14:05 ` [PATCH 5/5] xfs: use bio_await in xfs_zone_gc_reset_sync Christoph Hellwig
2026-04-08  7:57   ` Chaitanya Kulkarni
2026-04-07 14:22 ` refactor submit_bio_wait and bio await helpers v3 Jens Axboe

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=b2e8e413-39bf-4255-8aad-a30d7fd676ea@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=cem@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-block@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