linux/drivers/scsi/osd
Boaz Harrosh 5d0961fd1f [SCSI] libosd: Fix blk_put_request locking again
So libosd has decided to sacrifice some code simplicity for the sake of
a clean API. One of these things is the possibility for users to call
osd_end_request, in any condition at any state. This opens up some
problems with calling blk_put_request when out-side of the completion
callback but calling __blk_put_request when detecting a from-completion
state.

The current hack was working just fine until exofs decided to operate on
all devices in parallel and wait for the sum of the requests, before
deallocating all osd-requests at once. There are two new possible cases
1. All request in a group are deallocated as part of the last request's
   async-done, request_queue is locked.
2. All request in a group where executed asynchronously, but
   de-allocation was delayed to after the async-done, in the context of
   another thread. Async execution but request_queue is not locked.

The solution I chose was to separate the deallocation of the osd_request
which has the information users need, from the deallocation of the
internal(2) requests which impose the locking problem. The internal
block-requests are freed unconditionally inside the async-done-callback,
when we know the queue is always locked. If at osd_end_request time we
still have a bock-request, then we know it did not come from within an
async-done-callback and we can call the regular blk_put_request.

The internal requests were used for carrying error information after
execution. This information is now copied to osd_request members for
later analysis by user code.

The external API and behaviour was unchanged, except now it really
supports what was previously advertised.

Reported-by: Vineet Agarwal <checkout.vineet@gmail.com>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2009-12-10 08:54:17 -06:00
..
Kbuild [SCSI] osd: Remove out-of-tree left overs 2009-06-10 09:00:41 -05:00
Kconfig [SCSI] osd: Kconfig file for in-tree builds 2009-03-12 12:58:09 -05:00
osd_debug.h [SCSI] libosd: OSDv1 preliminary implementation 2009-03-12 12:58:06 -05:00
osd_initiator.c [SCSI] libosd: Fix blk_put_request locking again 2009-12-10 08:54:17 -06:00
osd_uld.c [SCSI] libosd: osd_dev_info: Unique Identification of an OSD device 2009-12-04 12:01:46 -06:00