linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/6] bio_split() error handling rework
@ 2024-09-19  9:22 John Garry
  2024-09-19  9:22 ` [PATCH RFC 1/6] block: Rework bio_split() return value John Garry
                   ` (6 more replies)
  0 siblings, 7 replies; 37+ messages in thread
From: John Garry @ 2024-09-19  9:22 UTC (permalink / raw)
  To: axboe, hch
  Cc: linux-block, linux-kernel, linux-raid, martin.petersen,
	John Garry

bio_split() error handling could be improved as follows:
- Instead of returning NULL for an error - which is vague - return a
  PTR_ERR, which may hint what went wrong.
- Remove BUG_ON() calls - which are generally not preferred - and instead
  WARN and pass an error code back to the caller. Many callers of
  bio_split() don't check the return code. As such, for an error we would
  be getting a crash still from an invalid pointer dereference.

Most bio_split() callers don't check the return value. However, it could
be argued the bio_split() calls should not fail. So far I have just
fixed up the md RAID code to handle these errors, as that is my interest
now.

Sending as an RFC as unsure if this is the right direction.

The motivator for this series was initial md RAID atomic write support in
https://lore.kernel.org/linux-block/21f19b4b-4b83-4ca2-a93b-0a433741fd26@oracle.com/

There I wanted to ensure that we don't split an atomic write bio, and it
made more sense to handle this in bio_split() (instead of the bio_split()
caller).

John Garry (6):
  block: Rework bio_split() return value
  block: Error an attempt to split an atomic write in bio_split()
  block: Handle bio_split() errors in bio_submit_split()
  md/raid0: Handle bio_split() errors
  md/raid1: Handle bio_split() errors
  md/raid10: Handle bio_split() errors

 block/bio.c                 | 14 ++++++++++----
 block/blk-crypto-fallback.c |  2 +-
 block/blk-merge.c           |  5 +++++
 drivers/md/raid0.c          | 10 ++++++++++
 drivers/md/raid1.c          |  8 ++++++++
 drivers/md/raid10.c         | 18 ++++++++++++++++++
 6 files changed, 52 insertions(+), 5 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2024-10-25  1:39 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-19  9:22 [PATCH RFC 0/6] bio_split() error handling rework John Garry
2024-09-19  9:22 ` [PATCH RFC 1/6] block: Rework bio_split() return value John Garry
2024-09-19 15:50   ` Johannes Thumshirn
2024-09-23  7:27     ` John Garry
2024-09-20 14:07   ` Christoph Hellwig
2024-09-19  9:22 ` [PATCH RFC 2/6] block: Error an attempt to split an atomic write in bio_split() John Garry
2024-09-19  9:22 ` [PATCH RFC 3/6] block: Handle bio_split() errors in bio_submit_split() John Garry
2024-09-20 14:09   ` Christoph Hellwig
2024-09-23 10:33     ` John Garry
2024-09-19  9:23 ` [PATCH RFC 4/6] md/raid0: Handle bio_split() errors John Garry
2024-09-20 14:10   ` Christoph Hellwig
2024-09-19  9:23 ` [PATCH RFC 5/6] md/raid1: " John Garry
2024-09-20  6:58   ` Yu Kuai
2024-09-20 10:04     ` John Garry
2024-09-23  6:15       ` Yu Kuai
2024-09-23  7:44         ` John Garry
2024-09-23  8:18           ` Yu Kuai
2024-09-23  9:21             ` John Garry
2024-09-23  9:38               ` Yu Kuai
2024-09-23 10:40                 ` John Garry
2024-10-23 11:16                 ` John Garry
2024-10-23 11:46                   ` Geoff Back
2024-10-23 12:11                     ` John Garry
2024-10-24  2:10                       ` Yu Kuai
2024-10-24  8:57                         ` John Garry
2024-10-24  9:12                           ` Yu Kuai
2024-10-24  9:56                             ` John Garry
2024-10-25  1:39                               ` Yu Kuai
2024-10-23 11:21         ` John Garry
2024-10-24  3:08           ` Yu Kuai
2024-10-24 13:51             ` John Garry
2024-10-25  1:24               ` Yu Kuai
2024-09-19  9:23 ` [PATCH RFC 6/6] md/raid10: " John Garry
2024-09-23  5:53 ` [PATCH RFC 0/6] bio_split() error handling rework Hannes Reinecke
2024-09-23  7:19   ` John Garry
2024-09-23  9:43     ` Hannes Reinecke
2024-09-23 10:21       ` John Garry

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).