[PATCH V2 1/2] blk-mq: add callback of .cleanup_rq

2019-07-19 Thread Ming Lei
dm-rq needs to free request which has been dispatched and not completed by underlying queue. However, the underlying queue may have allocated private data for this request in .queue_rq(), so the request private part is leaked. Add one new callback of .cleanup_rq() to free the request private data.

[PATCH V2 2/2] scsi: implement .cleanup_rq callback

2019-07-19 Thread Ming Lei
Implement .cleanup_rq() callback for freeing driver private part of the request. Then we can avoid to leak request private data if the request isn't completed by SCSI, and freed by blk-mq or upper layer(such as dm-rq) finally. Cc: Ewan D. Milne Cc: Bart Van Assche Cc: Hannes Reinecke Cc: Christ

[PATCH V2 0/2] block/scsi/dm-rq: fix leak of request private data in dm-mpath

2019-07-19 Thread Ming Lei
Hi, When one request is dispatched to LLD via dm-rq, if the result is BLK_STS_*RESOURCE, dm-rq will free the request. However, LLD may allocate private data for this request, so this way will cause memory leak. Add .cleanup_rq() callback and implement it in SCSI for fixing the issue, since SCSI i

Re: [PATCH 1/2] blk-mq: add callback of .cleanup_rq

2019-07-19 Thread Mike Snitzer
On Thu, Jul 18 2019 at 9:35pm -0400, Ming Lei wrote: > On Thu, Jul 18, 2019 at 10:52:01AM -0400, Mike Snitzer wrote: > > On Wed, Jul 17 2019 at 11:25pm -0400, > > Ming Lei wrote: > > > > > dm-rq needs to free request which has been dispatched and not completed > > > by underlying queue. Howeve