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@xxxxxxx/ 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