Re: [PATCH] block_dev: fix crash on chained bios with O_DIRECT

2019-03-21 Thread Johannes Thumshirn
On 20/03/2019 20:57, Jens Axboe wrote: > Yeah, you're going to overlap and crash... We really should have a build > bug on for that. > > We don't have any free ones. I've got a patch in io_uring-next that > uses the last one. Damn it, I have updated the patch to use 0 as well. > That said, I do

Re: [PATCH] block_dev: fix crash on chained bios with O_DIRECT

2019-03-20 Thread Jens Axboe
On 3/20/19 7:19 AM, Johannes Thumshirn wrote: > On 20/03/2019 12:47, Jan Kara wrote: >> On Wed 20-03-19 09:53:10, Johannes Thumshirn wrote: >>> On 20/03/2019 09:51, Hannes Reinecke wrote: Yeah, should work, too. But we should be calling bio_uninit() for all bios. >>> >>> Yup, probably. >>

Re: [PATCH] block_dev: fix crash on chained bios with O_DIRECT

2019-03-20 Thread Johannes Thumshirn
On 20/03/2019 12:47, Jan Kara wrote: > On Wed 20-03-19 09:53:10, Johannes Thumshirn wrote: >> On 20/03/2019 09:51, Hannes Reinecke wrote: >>> Yeah, should work, too. >>> But we should be calling bio_uninit() for all bios. >> >> Yup, probably. >> >>> Will you be sending an updated patch? >> >> Let's

Re: [PATCH] block_dev: fix crash on chained bios with O_DIRECT

2019-03-20 Thread Jan Kara
On Wed 20-03-19 09:53:10, Johannes Thumshirn wrote: > On 20/03/2019 09:51, Hannes Reinecke wrote: > > Yeah, should work, too. > > But we should be calling bio_uninit() for all bios. > > Yup, probably. > > > Will you be sending an updated patch? > > Let's wait what other's thing first. FWIW I'm

Re: [PATCH] block_dev: fix crash on chained bios with O_DIRECT

2019-03-20 Thread Johannes Thumshirn
On 20/03/2019 09:51, Hannes Reinecke wrote: > Yeah, should work, too. > But we should be calling bio_uninit() for all bios. Yup, probably. > Will you be sending an updated patch? Let's wait what other's thing first. -- Johannes ThumshirnSUSE Labs Filesystems jthumsh

Re: [PATCH] block_dev: fix crash on chained bios with O_DIRECT

2019-03-20 Thread Hannes Reinecke
On 3/20/19 9:45 AM, Johannes Thumshirn wrote: On 20/03/2019 09:12, Hannes Reinecke wrote: __blkdev_direct_IO_simple() is allocating a bio on the stack. When that bio needs to be split bio_chain_endio() invokes bio_put() on this bio, causing the kernel to crash in mempool_free() as the bio was ne

Re: [PATCH] block_dev: fix crash on chained bios with O_DIRECT

2019-03-20 Thread Johannes Thumshirn
On 20/03/2019 09:12, Hannes Reinecke wrote: > __blkdev_direct_IO_simple() is allocating a bio on the stack. > When that bio needs to be split bio_chain_endio() invokes bio_put() > on this bio, causing the kernel to crash in mempool_free() as the > bio was never allocated from a mempool in the first

[PATCH] block_dev: fix crash on chained bios with O_DIRECT

2019-03-20 Thread Hannes Reinecke
__blkdev_direct_IO_simple() is allocating a bio on the stack. When that bio needs to be split bio_chain_endio() invokes bio_put() on this bio, causing the kernel to crash in mempool_free() as the bio was never allocated from a mempool in the first place. So call bio_get() before submitting to avoid