- Fixes wrong IRQ-safe/IRQ-unsafe locking dependancy spotted by lockdep: scst_check_local_events() must not be called with IRQs disabled

- Cosmetics 


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@196 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2007-09-25 09:36:27 +00:00
parent d941e7f77a
commit 55ae59599b
3 changed files with 19 additions and 17 deletions
+10 -4
View File
@@ -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) {
+8 -13
View File
@@ -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;
+1
View File
@@ -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;