linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET  0/2] Don't let blk_put_request leak BIOs
@ 2009-03-19 10:20 Boaz Harrosh
  2009-03-19 10:24 ` [PATCH 1/2] TESTING: " Boaz Harrosh
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Boaz Harrosh @ 2009-03-19 10:20 UTC (permalink / raw)
  To: Jens Axboe, FUJITA Tomonori, linux-scsi, James Bottomley
  Cc: Tejun Heo, open-osd mailing-list

Hi Jens

You never commented on these patches. Please have a look?

The issue is that if we map some memory into a request but then
do not execute it. Then calling blk_put_request() will leak the bio(s)
unless one does an ugly code like:
-	struct bio *bio;
-
-	while ((bio = rq->bio) != NULL) {
-		rq->bio = bio->bi_next;
-		bio_endio(bio, 0);
-	}

This problem arise in OSD when we can fail to setup the write
or the read side and then we must cleanup the other half.
Same problem exist in bsg, on bidi commands. But there the bio
is just leaked on the error path, it does not do the ugly loop above.

My proposed solution is that blk_put_request() should see if
there is a left-over bio and do the deallocation of the bio's

A side effect of this is if before, do to some bugs, drivers failed
to complete the request fully, the bio would leak. Now it will not
any more.

All above is the theory, in practice some code was abusing the use
of request->bio and it needed fixing. I tried to audit all code path
that call blk_put_request() and fix them.

But it is still dangerous and we should run with this patch in
linux-next and the block tree and see if the WARN_ON at patch [PATCH 1/2]
does not trigger. I have marked this patch as TESTING. The final patch
submitted to Linus should be Minus this WARN_ON.

James
I'm also sending the osd patch through Jens's tree. So there will not
be ordering dependency problems from two trees. Is that OK? do I need
your ACK-BY?

The patches are:
[PATCH 1/2] TESTING: Don't let blk_put_request leak BIOs
    This is for linux-next. Before final submission to Linus a patch
    minus the WARN_ON (and TESTING:) should be submitted.

[PATCH 2/2] libosd: Don't let osd abuse block internals, now that it's fixed
    This can go through Jens tree, I will make sure it will not conflict
    with any scsi-misc patches.

Thank you in advance
Boaz

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-03-22  8:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-19 10:20 [PATCHSET 0/2] Don't let blk_put_request leak BIOs Boaz Harrosh
2009-03-19 10:24 ` [PATCH 1/2] TESTING: " Boaz Harrosh
2009-03-19 10:26 ` [PATCH 2/2] libosd: Don't let osd abuse block internals, now that it's fixed Boaz Harrosh
2009-03-19 11:33 ` [PATCHSET 0/2] Don't let blk_put_request leak BIOs Jens Axboe
2009-03-19 13:40   ` Boaz Harrosh
2009-03-19 13:45     ` Jens Axboe
2009-03-19 13:48       ` Boaz Harrosh
2009-03-19 13:56         ` Jens Axboe
2009-03-19 14:18           ` Boaz Harrosh
2009-03-19 14:24             ` Jens Axboe
2009-03-19 14:50               ` Boaz Harrosh
2009-03-19 16:29   ` [PATCH] WARN_ON if blk_put_request leaks BIOs Boaz Harrosh
2009-03-20 20:45     ` Jens Axboe
2009-03-22  8:51       ` Boaz Harrosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).