diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index e8283af0c..bac1509bd 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -1446,6 +1446,7 @@ static int dev_user_process_scst_commands(struct scst_user_dev *dev) return res; } +/* Called under cmd_lists.cmd_list_lock and IRQ off */ struct dev_user_cmd *__dev_user_get_next_cmd(struct list_head *cmd_list) { struct dev_user_cmd *u; @@ -1459,11 +1460,11 @@ again: EXTRACHECKS_BUG_ON(u->state & UCMD_STATE_JAMMED_MASK); if (u->cmd != NULL) { if (u->state == UCMD_STATE_EXECING) { - int rc = scst_check_local_events(u->cmd); + struct scst_user_dev *dev = u->dev; + int rc; + spin_unlock_irq(&dev->cmd_lists.cmd_list_lock); + rc = scst_check_local_events(u->cmd); if (unlikely(rc != 0)) { - struct scst_user_dev *dev = u->dev; - spin_unlock_irq( - &dev->cmd_lists.cmd_list_lock); u->cmd->scst_cmd_done(u->cmd, SCST_CMD_STATE_DEFAULT); /* @@ -1474,6 +1475,11 @@ again: &dev->cmd_lists.cmd_list_lock); goto again; } + /* + * There is no real need to lock again here, but + * let's do it for simplicity. + */ + spin_lock_irq(&dev->cmd_lists.cmd_list_lock); } else if (unlikely(test_bit(SCST_CMD_ABORTED, &u->cmd->cmd_flags))) { switch(u->state) { diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index f5df889de..3c1afacbf 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -471,19 +471,14 @@ static int sgv_pool_hiwmk_check(int pages_to_alloc, int no_fail) pages = sgv_pool_oom_free_objs(pages); if (pages > 0) { - static int q; - if (q < 100) { - q++; - TRACE(TRACE_OUT_OF_MEM, "Requested amount of " - "memory for being executed commands " - "exceeds allowed maximum %dMB, " - "should you increase scst_max_cmd_mem " - "(requested %d pages)? (This warning " - "will be shown only %d more times)", - sgv_pools_mgr.mgr.thr.hi_wmk >> - (20-PAGE_SHIFT), pages_to_alloc, - 100-q); - } + TRACE(TRACE_OUT_OF_MEM, "Requested amount of " + "memory (%d pages) for being executed " + "commands together with the already " + "allocated memory exceeds the allowed " + "maximum %dMB. Should you increase " + "scst_max_cmd_mem?", pages_to_alloc, + sgv_pools_mgr.mgr.thr.hi_wmk >> + (20-PAGE_SHIFT)); sgv_pools_mgr.mgr.thr.releases_failed++; res = -ENOMEM; goto out_unlock; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 0413adc8f..a6e3381a3 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -1449,6 +1449,7 @@ out_done: goto out; } +/* No locks, no IRQ or IRQ-safe context allowed */ int scst_check_local_events(struct scst_cmd *cmd) { int res, rc;