Re: [PATCH] [RFC] block: Don't let blk_put_request leak BIOs

From: Boaz Harrosh
Date: Thu Feb 12 2009 - 08:49:38 EST


Boaz Harrosh wrote:
> If a block ULD had allocated a request and mapped some memory into it,
> using one of blk_rq_map_xxx routines, but then for some reason failed to
> execute the request through one of the blk_execute_request routines.
> Then the associated BIO would leak, unless ULD resorts to low-level loops
> intimate of block internals.
>
> [RFC]
> This code will also catch situations where LLD failed to complete
> the request before aborting it. Such situations are a BUG. Should we
> use WARN_ON_ONCE() in that case. The situation above is possible and
> can happen normally in memory pressure situations so maybe we should
> devise a bit-flag that ULD denotes that the request was aborted and
> only WARN_ON if flag was not set.
>
> I'm sending this before any-tests so people can comment on possible
> pitfalls.
>
> Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
> ---

I've booted a Linux PC with lots of sata disks, connected an iscsi
target, ran OSD tests. It looks like it's working which means
request->bio is set to NULL after it is used in the regular path.

This needs to sit in Linux next and be tested for a long while.

Jens I'll be waiting for your comment and will send a proper
patch for the block bits. We will have to time this with James
to see when the OSD bits can be submitted after that, then TOMO's
patch for un-exporting blk_req_append_bio can be merged. Or maybe
it can all go in one patch through scsi?

Thanks
Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/