aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2009-12-01 10:36:21 -0500
committerJames Bottomley <James.Bottomley@suse.de>2009-12-10 09:54:17 -0500
commit5d0961fd1f25e117f907f3af3aaa870637049252 (patch)
tree1eb877e773c511b3da68cab9da4ae0d0e0ee7369 /include
parentaeab3fd7b865bc4086a80a83cfdd67dded3b41a0 (diff)
[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>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/osd_initiator.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index 39d6d1097153..a8f370126632 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -142,6 +142,7 @@ struct osd_request {
142 struct _osd_io_info { 142 struct _osd_io_info {
143 struct bio *bio; 143 struct bio *bio;
144 u64 total_bytes; 144 u64 total_bytes;
145 u64 residual;
145 struct request *req; 146 struct request *req;
146 struct _osd_req_data_segment *last_seg; 147 struct _osd_req_data_segment *last_seg;
147 u8 *pad_buff; 148 u8 *pad_buff;
@@ -150,12 +151,14 @@ struct osd_request {
150 gfp_t alloc_flags; 151 gfp_t alloc_flags;
151 unsigned timeout; 152 unsigned timeout;
152 unsigned retries; 153 unsigned retries;
154 unsigned sense_len;
153 u8 sense[OSD_MAX_SENSE_LEN]; 155 u8 sense[OSD_MAX_SENSE_LEN];
154 enum osd_attributes_mode attributes_mode; 156 enum osd_attributes_mode attributes_mode;
155 157
156 osd_req_done_fn *async_done; 158 osd_req_done_fn *async_done;
157 void *async_private; 159 void *async_private;
158 int async_error; 160 int async_error;
161 int req_errors;
159}; 162};
160 163
161static inline bool osd_req_is_ver1(struct osd_request *or) 164static inline bool osd_req_is_ver1(struct osd_request *or)
@@ -297,8 +300,6 @@ enum osd_err_priority {
297}; 300};
298 301
299struct osd_sense_info { 302struct osd_sense_info {
300 u64 out_resid; /* Zero on success otherwise out residual */
301 u64 in_resid; /* Zero on success otherwise in residual */
302 enum osd_err_priority osd_err_pri; 303 enum osd_err_priority osd_err_pri;
303 304
304 int key; /* one of enum scsi_sense_keys */ 305 int key; /* one of enum scsi_sense_keys */