diff options
author | Andreas Herrmann <aherrman@de.ibm.com> | 2005-11-30 20:50:36 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-12-01 16:59:47 -0500 |
commit | 2448c45965870ca9cfdb66388b4fcc93f1e12bb7 (patch) | |
tree | b028c8ad8dbb8353f7299ce5c88b54ff7cfc6433 /drivers/s390/scsi/zfcp_fsf.c | |
parent | c48a29d065cfa18c3e8699f5e3a84a59ad35e062 (diff) |
[SCSI] zfcp: fix adapter initialization
Fixed various problems in opening sequence of adapters which was previously
changed with NPIV support:
o corrected handling when exchange port data function is not supported,
otherwise adapters on z900 cannot be opened anymore
o corrected setup of timer for exchange port data if called from error
recovery
o corrected check of return code of exchange config data
Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_fsf.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 3b0fc1163f5f..fbc81b012919 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -2191,13 +2191,10 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action, | |||
2191 | return -EOPNOTSUPP; | 2191 | return -EOPNOTSUPP; |
2192 | } | 2192 | } |
2193 | 2193 | ||
2194 | timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL); | ||
2195 | if (!timer) | ||
2196 | return -ENOMEM; | ||
2197 | |||
2198 | /* setup new FSF request */ | 2194 | /* setup new FSF request */ |
2199 | retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, | 2195 | retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, |
2200 | 0, 0, &lock_flags, &fsf_req); | 2196 | erp_action ? ZFCP_REQ_AUTO_CLEANUP : 0, |
2197 | 0, &lock_flags, &fsf_req); | ||
2201 | if (retval < 0) { | 2198 | if (retval < 0) { |
2202 | ZFCP_LOG_INFO("error: Out of resources. Could not create an " | 2199 | ZFCP_LOG_INFO("error: Out of resources. Could not create an " |
2203 | "exchange port data request for" | 2200 | "exchange port data request for" |
@@ -2205,25 +2202,33 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action, | |||
2205 | zfcp_get_busid_by_adapter(adapter)); | 2202 | zfcp_get_busid_by_adapter(adapter)); |
2206 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, | 2203 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, |
2207 | lock_flags); | 2204 | lock_flags); |
2208 | goto out; | 2205 | return retval; |
2209 | } | ||
2210 | |||
2211 | if (erp_action) { | ||
2212 | erp_action->fsf_req = fsf_req; | ||
2213 | fsf_req->erp_action = erp_action; | ||
2214 | } | 2206 | } |
2215 | 2207 | ||
2216 | if (data) | 2208 | if (data) |
2217 | fsf_req->data = (unsigned long) data; | 2209 | fsf_req->data = (unsigned long) data; |
2218 | 2210 | ||
2219 | sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0); | 2211 | sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0); |
2220 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 2212 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
2221 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 2213 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
2222 | 2214 | ||
2223 | init_timer(timer); | 2215 | if (erp_action) { |
2224 | timer->function = zfcp_fsf_request_timeout_handler; | 2216 | erp_action->fsf_req = fsf_req; |
2225 | timer->data = (unsigned long) adapter; | 2217 | fsf_req->erp_action = erp_action; |
2226 | timer->expires = ZFCP_FSF_REQUEST_TIMEOUT; | 2218 | timer = &erp_action->timer; |
2219 | } else { | ||
2220 | timer = kmalloc(sizeof(struct timer_list), GFP_ATOMIC); | ||
2221 | if (!timer) { | ||
2222 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, | ||
2223 | lock_flags); | ||
2224 | zfcp_fsf_req_free(fsf_req); | ||
2225 | return -ENOMEM; | ||
2226 | } | ||
2227 | init_timer(timer); | ||
2228 | timer->function = zfcp_fsf_request_timeout_handler; | ||
2229 | timer->data = (unsigned long) adapter; | ||
2230 | timer->expires = ZFCP_FSF_REQUEST_TIMEOUT; | ||
2231 | } | ||
2227 | 2232 | ||
2228 | retval = zfcp_fsf_req_send(fsf_req, timer); | 2233 | retval = zfcp_fsf_req_send(fsf_req, timer); |
2229 | if (retval) { | 2234 | if (retval) { |
@@ -2233,23 +2238,22 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action, | |||
2233 | zfcp_fsf_req_free(fsf_req); | 2238 | zfcp_fsf_req_free(fsf_req); |
2234 | if (erp_action) | 2239 | if (erp_action) |
2235 | erp_action->fsf_req = NULL; | 2240 | erp_action->fsf_req = NULL; |
2241 | else | ||
2242 | kfree(timer); | ||
2236 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, | 2243 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, |
2237 | lock_flags); | 2244 | lock_flags); |
2238 | goto out; | 2245 | return retval; |
2239 | } | 2246 | } |
2240 | 2247 | ||
2241 | ZFCP_LOG_DEBUG("Exchange Port Data request initiated (adapter %s)\n", | 2248 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, lock_flags); |
2242 | zfcp_get_busid_by_adapter(adapter)); | ||
2243 | |||
2244 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, | ||
2245 | lock_flags); | ||
2246 | 2249 | ||
2247 | wait_event(fsf_req->completion_wq, | 2250 | if (!erp_action) { |
2248 | fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); | 2251 | wait_event(fsf_req->completion_wq, |
2249 | del_timer_sync(timer); | 2252 | fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); |
2250 | zfcp_fsf_req_free(fsf_req); | 2253 | del_timer_sync(timer); |
2251 | out: | 2254 | zfcp_fsf_req_free(fsf_req); |
2252 | kfree(timer); | 2255 | kfree(timer); |
2256 | } | ||
2253 | return retval; | 2257 | return retval; |
2254 | } | 2258 | } |
2255 | 2259 | ||