diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-06 22:54:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-06 22:54:26 -0400 |
commit | a0421da44fc8dcb94aad8889dae285f7ee923f80 (patch) | |
tree | 27151ae945fef45b29bb406f512c757847cc229c | |
parent | 4157368edbc3d69b05e9294a73c84fc9c96bdec4 (diff) | |
parent | 06383f10c49f507220594a455c6491ca6f8c94ab (diff) |
Merge branch '3.4-rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull target fixes from Nicholas Bellinger:
"Pull two tcm_fc fabric related fixes for -rc2:
Note that both have been CC'ed to stable, and patch #1 is the
important one that addresses a memory corruption bug related to FC
exchange timeouts + command abort.
Thanks again to MDR for tracking down this issue!"
* '3.4-rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
tcm_fc: Do not free tpg structure during wq allocation failure
tcm_fc: Add abort flag for gracefully handling exchange timeout
-rw-r--r-- | drivers/target/tcm_fc/tcm_fc.h | 1 | ||||
-rw-r--r-- | drivers/target/tcm_fc/tfc_cmd.c | 10 | ||||
-rw-r--r-- | drivers/target/tcm_fc/tfc_conf.c | 13 | ||||
-rw-r--r-- | drivers/target/tcm_fc/tfc_io.c | 2 |
4 files changed, 19 insertions, 7 deletions
diff --git a/drivers/target/tcm_fc/tcm_fc.h b/drivers/target/tcm_fc/tcm_fc.h index 830657908db8..c5eb3c33c3db 100644 --- a/drivers/target/tcm_fc/tcm_fc.h +++ b/drivers/target/tcm_fc/tcm_fc.h | |||
@@ -122,6 +122,7 @@ struct ft_cmd { | |||
122 | /* Local sense buffer */ | 122 | /* Local sense buffer */ |
123 | unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER]; | 123 | unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER]; |
124 | u32 was_ddp_setup:1; /* Set only if ddp is setup */ | 124 | u32 was_ddp_setup:1; /* Set only if ddp is setup */ |
125 | u32 aborted:1; /* Set if aborted by reset or timeout */ | ||
125 | struct scatterlist *sg; /* Set only if DDP is setup */ | 126 | struct scatterlist *sg; /* Set only if DDP is setup */ |
126 | u32 sg_cnt; /* No. of item in scatterlist */ | 127 | u32 sg_cnt; /* No. of item in scatterlist */ |
127 | }; | 128 | }; |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 62dec9715ce5..a375f257aabc 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -121,6 +121,8 @@ int ft_queue_status(struct se_cmd *se_cmd) | |||
121 | struct fc_exch *ep; | 121 | struct fc_exch *ep; |
122 | size_t len; | 122 | size_t len; |
123 | 123 | ||
124 | if (cmd->aborted) | ||
125 | return 0; | ||
124 | ft_dump_cmd(cmd, __func__); | 126 | ft_dump_cmd(cmd, __func__); |
125 | ep = fc_seq_exch(cmd->seq); | 127 | ep = fc_seq_exch(cmd->seq); |
126 | lport = ep->lp; | 128 | lport = ep->lp; |
@@ -187,6 +189,8 @@ int ft_write_pending(struct se_cmd *se_cmd) | |||
187 | 189 | ||
188 | ft_dump_cmd(cmd, __func__); | 190 | ft_dump_cmd(cmd, __func__); |
189 | 191 | ||
192 | if (cmd->aborted) | ||
193 | return 0; | ||
190 | ep = fc_seq_exch(cmd->seq); | 194 | ep = fc_seq_exch(cmd->seq); |
191 | lport = ep->lp; | 195 | lport = ep->lp; |
192 | fp = fc_frame_alloc(lport, sizeof(*txrdy)); | 196 | fp = fc_frame_alloc(lport, sizeof(*txrdy)); |
@@ -252,10 +256,10 @@ static void ft_recv_seq(struct fc_seq *sp, struct fc_frame *fp, void *arg) | |||
252 | struct ft_cmd *cmd = arg; | 256 | struct ft_cmd *cmd = arg; |
253 | struct fc_frame_header *fh; | 257 | struct fc_frame_header *fh; |
254 | 258 | ||
255 | if (IS_ERR(fp)) { | 259 | if (unlikely(IS_ERR(fp))) { |
256 | /* XXX need to find cmd if queued */ | 260 | /* XXX need to find cmd if queued */ |
257 | cmd->seq = NULL; | 261 | cmd->seq = NULL; |
258 | transport_generic_free_cmd(&cmd->se_cmd, 0); | 262 | cmd->aborted = true; |
259 | return; | 263 | return; |
260 | } | 264 | } |
261 | 265 | ||
@@ -399,6 +403,8 @@ int ft_queue_tm_resp(struct se_cmd *se_cmd) | |||
399 | struct se_tmr_req *tmr = se_cmd->se_tmr_req; | 403 | struct se_tmr_req *tmr = se_cmd->se_tmr_req; |
400 | enum fcp_resp_rsp_codes code; | 404 | enum fcp_resp_rsp_codes code; |
401 | 405 | ||
406 | if (cmd->aborted) | ||
407 | return 0; | ||
402 | switch (tmr->response) { | 408 | switch (tmr->response) { |
403 | case TMR_FUNCTION_COMPLETE: | 409 | case TMR_FUNCTION_COMPLETE: |
404 | code = FCP_TMF_CMPL; | 410 | code = FCP_TMF_CMPL; |
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index f357039349ba..2948dc944619 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c | |||
@@ -300,6 +300,7 @@ static struct se_portal_group *ft_add_tpg( | |||
300 | { | 300 | { |
301 | struct ft_lport_acl *lacl; | 301 | struct ft_lport_acl *lacl; |
302 | struct ft_tpg *tpg; | 302 | struct ft_tpg *tpg; |
303 | struct workqueue_struct *wq; | ||
303 | unsigned long index; | 304 | unsigned long index; |
304 | int ret; | 305 | int ret; |
305 | 306 | ||
@@ -321,18 +322,20 @@ static struct se_portal_group *ft_add_tpg( | |||
321 | tpg->lport_acl = lacl; | 322 | tpg->lport_acl = lacl; |
322 | INIT_LIST_HEAD(&tpg->lun_list); | 323 | INIT_LIST_HEAD(&tpg->lun_list); |
323 | 324 | ||
324 | ret = core_tpg_register(&ft_configfs->tf_ops, wwn, &tpg->se_tpg, | 325 | wq = alloc_workqueue("tcm_fc", 0, 1); |
325 | tpg, TRANSPORT_TPG_TYPE_NORMAL); | 326 | if (!wq) { |
326 | if (ret < 0) { | ||
327 | kfree(tpg); | 327 | kfree(tpg); |
328 | return NULL; | 328 | return NULL; |
329 | } | 329 | } |
330 | 330 | ||
331 | tpg->workqueue = alloc_workqueue("tcm_fc", 0, 1); | 331 | ret = core_tpg_register(&ft_configfs->tf_ops, wwn, &tpg->se_tpg, |
332 | if (!tpg->workqueue) { | 332 | tpg, TRANSPORT_TPG_TYPE_NORMAL); |
333 | if (ret < 0) { | ||
334 | destroy_workqueue(wq); | ||
333 | kfree(tpg); | 335 | kfree(tpg); |
334 | return NULL; | 336 | return NULL; |
335 | } | 337 | } |
338 | tpg->workqueue = wq; | ||
336 | 339 | ||
337 | mutex_lock(&ft_lport_lock); | 340 | mutex_lock(&ft_lport_lock); |
338 | list_add_tail(&tpg->list, &lacl->tpg_list); | 341 | list_add_tail(&tpg->list, &lacl->tpg_list); |
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c index 2b693eefac55..dc7c0db26e20 100644 --- a/drivers/target/tcm_fc/tfc_io.c +++ b/drivers/target/tcm_fc/tfc_io.c | |||
@@ -81,6 +81,8 @@ int ft_queue_data_in(struct se_cmd *se_cmd) | |||
81 | void *from; | 81 | void *from; |
82 | void *to = NULL; | 82 | void *to = NULL; |
83 | 83 | ||
84 | if (cmd->aborted) | ||
85 | return 0; | ||
84 | ep = fc_seq_exch(cmd->seq); | 86 | ep = fc_seq_exch(cmd->seq); |
85 | lport = ep->lp; | 87 | lport = ep->lp; |
86 | cmd->seq = lport->tt.seq_start_next(cmd->seq); | 88 | cmd->seq = lport->tt.seq_start_next(cmd->seq); |