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>
This commit is contained in:
parent
942d82646e
commit
dd503a5fcc
|
@ -289,7 +289,8 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr(
|
||||||
}
|
}
|
||||||
|
|
||||||
se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd,
|
se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd,
|
||||||
(void *)cmd->tmr_req, tcm_function);
|
(void *)cmd->tmr_req, tcm_function,
|
||||||
|
GFP_KERNEL);
|
||||||
if (!se_cmd->se_tmr_req)
|
if (!se_cmd->se_tmr_req)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
|
@ -366,7 +366,7 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc)
|
||||||
* Allocate the LUN_RESET TMR
|
* Allocate the LUN_RESET TMR
|
||||||
*/
|
*/
|
||||||
se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, tl_tmr,
|
se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, tl_tmr,
|
||||||
TMR_LUN_RESET);
|
TMR_LUN_RESET, GFP_KERNEL);
|
||||||
if (IS_ERR(se_cmd->se_tmr_req))
|
if (IS_ERR(se_cmd->se_tmr_req))
|
||||||
goto release;
|
goto release;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -43,12 +43,12 @@
|
||||||
struct se_tmr_req *core_tmr_alloc_req(
|
struct se_tmr_req *core_tmr_alloc_req(
|
||||||
struct se_cmd *se_cmd,
|
struct se_cmd *se_cmd,
|
||||||
void *fabric_tmr_ptr,
|
void *fabric_tmr_ptr,
|
||||||
u8 function)
|
u8 function,
|
||||||
|
gfp_t gfp_flags)
|
||||||
{
|
{
|
||||||
struct se_tmr_req *tmr;
|
struct se_tmr_req *tmr;
|
||||||
|
|
||||||
tmr = kmem_cache_zalloc(se_tmr_req_cache, (in_interrupt()) ?
|
tmr = kmem_cache_zalloc(se_tmr_req_cache, gfp_flags);
|
||||||
GFP_ATOMIC : GFP_KERNEL);
|
|
||||||
if (!tmr) {
|
if (!tmr) {
|
||||||
pr_err("Unable to allocate struct se_tmr_req\n");
|
pr_err("Unable to allocate struct se_tmr_req\n");
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
|
@ -396,7 +396,7 @@ static void ft_send_tm(struct ft_cmd *cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("alloc tm cmd fn %d\n", tm_func);
|
pr_debug("alloc tm cmd fn %d\n", tm_func);
|
||||||
tmr = core_tmr_alloc_req(&cmd->se_cmd, cmd, tm_func);
|
tmr = core_tmr_alloc_req(&cmd->se_cmd, cmd, tm_func, GFP_KERNEL);
|
||||||
if (!tmr) {
|
if (!tmr) {
|
||||||
pr_debug("alloc failed\n");
|
pr_debug("alloc failed\n");
|
||||||
ft_send_resp_code_and_free(cmd, FCP_TMF_FAILED);
|
ft_send_resp_code_and_free(cmd, FCP_TMF_FAILED);
|
||||||
|
|
|
@ -27,7 +27,7 @@ enum tcm_tmrsp_table {
|
||||||
|
|
||||||
extern struct kmem_cache *se_tmr_req_cache;
|
extern struct kmem_cache *se_tmr_req_cache;
|
||||||
|
|
||||||
extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8);
|
extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
|
||||||
extern void core_tmr_release_req(struct se_tmr_req *);
|
extern void core_tmr_release_req(struct se_tmr_req *);
|
||||||
extern int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *,
|
extern int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *,
|
||||||
struct list_head *, struct se_cmd *);
|
struct list_head *, struct se_cmd *);
|
||||||
|
|
Loading…
Reference in New Issue