public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Keith Busch <kbusch@meta.com>,
	linux-block@vger.kernel.org, axboe@kernel.org,
	Nilay Shroff <nilay@linux.ibm.com>,
	Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	Conrad Meyer <conradmeyer@meta.com>
Subject: Re: [PATCHv2] blk-lib: check for kill signal
Date: Wed, 21 Feb 2024 21:18:34 -0700	[thread overview]
Message-ID: <ZdbLGqP8o0q9v1g5@kbusch-mbp> (raw)
In-Reply-To: <ZdbHXDCquO23rbJk@fedora>

On Thu, Feb 22, 2024 at 12:02:36PM +0800, Ming Lei wrote:
> On Wed, Feb 21, 2024 at 02:20:13PM -0800, Keith Busch wrote:
> >   After the kill signal is observered, instead of submitting and waiting
> >   for the current parent bio in the chain, abort it by ending it
> >   immediately and do the final bio_put() after every previously submitted
> >   chained bio completes.
> 
> I feel this way is fragile:
> 
> 1) user sends KILL signal
> 
> 2) discard API returns
> 
> 3) submitted discard requests are still run in background, and there
> can be thousands of such bios
> 
> 4) what if application or FS code(such as meta) starts to write data to
> the discard range?

Right, there's no IO order guarantee there, and sounds reasonable to
expect no potential conflicts after the function returns. We could add a
similiar completion that submit_bio_wait() uses to ensure the previous
bio's are all done before returning. At least that looks safe to do for
any case where fatal signal would apply.
 
> > +		if (fatal_signal_pending(current)) {
> > +			abort_bio(bio);
> > +			ret = -EINTR;
> > +			bio = NULL;
> > +		}
> 
> The handling for blkdev_issue_secure_erase is different with others, and
> actually it doesn't return immediately, care to add comment?

Ha, I actually prepared a patch to make secure_erase look like everyone
else. I chose the smaller diff, but it does look weird. I'll reconsider
that for the next version.

  reply	other threads:[~2024-02-22  4:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 22:20 [PATCHv2] blk-lib: check for kill signal Keith Busch
2024-02-22  4:02 ` Ming Lei
2024-02-22  4:18   ` Keith Busch [this message]
2024-02-22 10:22     ` Chaitanya Kulkarni
  -- strict thread matches above, loose matches on Subject: below --
2024-02-22 19:18 Keith Busch
2024-02-22 19:20 ` Keith Busch

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=ZdbLGqP8o0q9v1g5@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.org \
    --cc=chaitanyak@nvidia.com \
    --cc=conradmeyer@meta.com \
    --cc=kbusch@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=nilay@linux.ibm.com \
    /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