aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2011-10-06 12:56:16 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-10-23 23:20:53 -0400
commitdd503a5fcc0dfb8b5fd887bd967b6f431176864b (patch)
tree59d5bd7db7d4040ea91def8676cca5334f9926a6 /drivers/target
parent942d82646e16725ac366d44087b8c992f2cb2190 (diff)
target: Have core_tmr_alloc_req() take an explicit GFP_xxx flag
Testing in_interrupt() to know when sleeping is allowed is not really reliable (since eg it won't be true if the caller is holding a spinlock). Instead have the caller tell core_tmr_alloc_req() what GFP_xxx to use; every caller except tcm_qla2xxx can use GFP_KERNEL. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target_util.c3
-rw-r--r--drivers/target/loopback/tcm_loop.c2
-rw-r--r--drivers/target/target_core_tmr.c6
-rw-r--r--drivers/target/tcm_fc/tfc_cmd.c2
4 files changed, 7 insertions, 6 deletions
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index f00137f377b2..c4be6223b9cc 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -289,7 +289,8 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr(
289 } 289 }
290 290
291 se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, 291 se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd,
292 (void *)cmd->tmr_req, tcm_function); 292 (void *)cmd->tmr_req, tcm_function,
293 GFP_KERNEL);
293 if (!se_cmd->se_tmr_req) 294 if (!se_cmd->se_tmr_req)
294 goto out; 295 goto out;
295 296
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index f0e701d27bd1..5b870c316b9c 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -366,7 +366,7 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc)
366 * Allocate the LUN_RESET TMR 366 * Allocate the LUN_RESET TMR
367 */ 367 */
368 se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, tl_tmr, 368 se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, tl_tmr,
369 TMR_LUN_RESET); 369 TMR_LUN_RESET, GFP_KERNEL);
370 if (IS_ERR(se_cmd->se_tmr_req)) 370 if (IS_ERR(se_cmd->se_tmr_req))
371 goto release; 371 goto release;
372 /* 372 /*
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index d04cc1016ebf..efc5ec7da57c 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -43,12 +43,12 @@
43struct se_tmr_req *core_tmr_alloc_req( 43struct se_tmr_req *core_tmr_alloc_req(
44 struct se_cmd *se_cmd, 44 struct se_cmd *se_cmd,
45 void *fabric_tmr_ptr, 45 void *fabric_tmr_ptr,
46 u8 function) 46 u8 function,
47 gfp_t gfp_flags)
47{ 48{
48 struct se_tmr_req *tmr; 49 struct se_tmr_req *tmr;
49 50
50 tmr = kmem_cache_zalloc(se_tmr_req_cache, (in_interrupt()) ? 51 tmr = kmem_cache_zalloc(se_tmr_req_cache, gfp_flags);
51 GFP_ATOMIC : GFP_KERNEL);
52 if (!tmr) { 52 if (!tmr) {
53 pr_err("Unable to allocate struct se_tmr_req\n"); 53 pr_err("Unable to allocate struct se_tmr_req\n");
54 return ERR_PTR(-ENOMEM); 54 return ERR_PTR(-ENOMEM);
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c
index 7f2ee5a0ed79..55a278ed1111 100644
--- a/drivers/target/tcm_fc/tfc_cmd.c
+++ b/drivers/target/tcm_fc/tfc_cmd.c
@@ -396,7 +396,7 @@ static void ft_send_tm(struct ft_cmd *cmd)
396 } 396 }
397 397
398 pr_debug("alloc tm cmd fn %d\n", tm_func); 398 pr_debug("alloc tm cmd fn %d\n", tm_func);
399 tmr = core_tmr_alloc_req(&cmd->se_cmd, cmd, tm_func); 399 tmr = core_tmr_alloc_req(&cmd->se_cmd, cmd, tm_func, GFP_KERNEL);
400 if (!tmr) { 400 if (!tmr) {
401 pr_debug("alloc failed\n"); 401 pr_debug("alloc failed\n");
402 ft_send_resp_code_and_free(cmd, FCP_TMF_FAILED); 402 ft_send_resp_code_and_free(cmd, FCP_TMF_FAILED);