On Mon, Jul 1, 2024 at 8:50 PM Christoph Hellwig <hch@xxxxxx> wrote: > > On Mon, Jul 01, 2024 at 06:30:34PM +0530, Kanchan Joshi wrote: > > The patch will cause regression for nvme-passthrough. For that > > completion order is: > > (a) bio_endio() > > (b) req->end_io > > (c) blk_rq_unmap_user. > > > > And current code ensures that integrity is freed explicitly only after > > (a) and (b). > > With the patch, integrity will get freed during (a) itself. > > It is supposed to be freed from (c), specifically from > blk_mq_map_bio_put. > > > > There are two places in bio_endio() that can free the integrity. > > It first calls bio_integrity_endio() - which is handled fine above. > > But it also calls bio_uninit() - which will free the integrity. We don't > > want that to happen before passthrough gets the chance to unpin/copy-back. > > But yes, that messed it up. I'm kinda curious why it didn't trip up > during my testing of the passthrough metadata code. Yeah, it didn't trigger any errors in my tests either. It's just that integrity vecs were not unpinned during completion.