linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] add flag for tracking bio allocation
@ 2019-03-22 13:13 Johannes Thumshirn
  2019-03-22 13:13 ` [PATCH v2 1/3] block: bio: kill BIO_SEG_VALID flag Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Johannes Thumshirn @ 2019-03-22 13:13 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Hannes Reinecke, Bart Van Assche, Christoph Hellwig, Jan Kara,
	Linux Block Layer Mailinglist, Linux FSDEVEL Mailinglist,
	Johannes Thumshirn

Hannes recently sent a patch in [1] to fix an Oops caused by
__blkdev_direct_IO_simple() doing bio submissions from the stack and which
ended up being freed bio bio_free(). As bio_free() expected a bio which was
allocated by bio_alloc_bioset() it crashed.

I've sent out a different aproach to tackling this problem and both Jens and
Jan leaned to my solution, namely adding another bio flag tracking the
allocation.

As we start to run out of flags, Jens has killed the BIO_SEG_VALID flag in a
preparation patch and I added a compile time check as a safety net, so we're
not accidentially overriding the high 3 bits of bi_flags, which are used for
the BVEC_POOL_IDX().

This set has passed a full xfstests run on both BTRFS and XFS (against zram
disks) and a full blktests run without introducing any regressions.

[1] https://lore.kernel.org/linux-block/20190320081253.129688-1-hare@suse.de/

Jens Axboe (1):
  block: bio: kill BIO_SEG_VALID flag

Johannes Thumshirn (2):
  block: bio: ensure newly added bio flags don't override BVEC_POOL_IDX
  block: bio: introduce BIO_ALLOCED flag and check it in bio_free

 block/bio.c               | 17 ++++++++++++-----
 block/blk-merge.c         | 11 ++++-------
 drivers/md/raid5.c        |  2 +-
 include/linux/blk_types.h | 27 +++++++++++++++------------
 4 files changed, 32 insertions(+), 25 deletions(-)

-- 
2.16.4


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

end of thread, other threads:[~2019-03-25 13:32 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 13:13 [PATCH v2 0/3] add flag for tracking bio allocation Johannes Thumshirn
2019-03-22 13:13 ` [PATCH v2 1/3] block: bio: kill BIO_SEG_VALID flag Johannes Thumshirn
2019-03-22 14:01   ` Christoph Hellwig
2019-03-25  8:02     ` Johannes Thumshirn
2019-03-22 14:06   ` Hannes Reinecke
2019-03-22 22:00   ` Jens Axboe
2019-03-23 19:31     ` Jens Axboe
2019-03-25 13:32       ` Johannes Thumshirn
2019-03-22 22:40   ` Ming Lei
2019-03-22 13:13 ` [PATCH v2 2/3] block: bio: ensure newly added bio flags don't override BVEC_POOL_IDX Johannes Thumshirn
2019-03-22 14:01   ` Christoph Hellwig
2019-03-22 14:07   ` Hannes Reinecke
2019-03-22 13:13 ` [PATCH v2 3/3] block: bio: introduce BIO_ALLOCED flag and check it in bio_free Johannes Thumshirn
2019-03-22 14:02   ` Christoph Hellwig
2019-03-22 14:05     ` Hannes Reinecke
2019-03-22 21:30       ` Keith Busch
2019-03-22 23:04         ` Ming Lei
2019-03-22 14:10   ` Hannes Reinecke

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