Skip to content

Commit

Permalink
bsg: setting rq->bio to NULL
Browse files Browse the repository at this point in the history
Due to commit 1cd96c2 ("block: WARN
in __blk_put_request() for potential bio leak"), BSG SMP requests get
the false warnings:

WARNING: at block/blk-core.c:1068 __blk_put_request+0x52/0xc0()

This sets rq->bio to NULL to avoid that false warnings.

Signed-off-by: FUJITA Tomonori <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
fujita authored and Jens Axboe committed Jun 9, 2009
1 parent 3af968e commit c1d4c41
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions block/bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
blk_put_request(rq);
if (next_rq) {
blk_rq_unmap_user(next_rq->bio);
next_rq->bio = NULL;
blk_put_request(next_rq);
}
return ERR_PTR(ret);
Expand Down Expand Up @@ -448,6 +449,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
hdr->dout_resid = rq->data_len;
hdr->din_resid = rq->next_rq->data_len;
blk_rq_unmap_user(bidi_bio);
rq->next_rq->bio = NULL;
blk_put_request(rq->next_rq);
} else if (rq_data_dir(rq) == READ)
hdr->din_resid = rq->data_len;
Expand All @@ -466,6 +468,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
blk_rq_unmap_user(bio);
if (rq->cmd != rq->__cmd)
kfree(rq->cmd);
rq->bio = NULL;
blk_put_request(rq);

return ret;
Expand Down

0 comments on commit c1d4c41

Please sign in to comment.