From 87f2720490e597c7d6e453f943ead4988f743fe7 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 10 Jul 2009 11:56:51 +0000 Subject: [PATCH] Removes unneeded mutex_lock(&scst_mutex), which can't be done on atomic or SIRQ context git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@946 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 10 +++++++--- scst/src/scst_targ.c | 13 +++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index ddc6f059e..951fcccc9 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -3532,6 +3532,7 @@ void scst_process_reset(struct scst_device *dev, return; } +/* No locks, no IRQ or IRQ-disabled context allowed */ int scst_set_pending_UA(struct scst_cmd *cmd) { int res = 0, i; @@ -3565,7 +3566,12 @@ again: spin_unlock_bh(&cmd->tgt_dev->tgt_dev_lock); - mutex_lock(&scst_mutex); + /* + * cmd won't allow to suspend activities, so we can access + * sess->sess_tgt_dev_list_hash without any additional + * protection. + */ + local_bh_disable(); for (i = 0; i < TGT_DEV_HASH_SIZE; i++) { @@ -3638,8 +3644,6 @@ out_unlock: } local_bh_enable(); - mutex_unlock(&scst_mutex); - spin_lock_bh(&cmd->tgt_dev->tgt_dev_lock); } diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 63c5fd560..56e14e759 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -1450,7 +1450,10 @@ static int scst_report_luns_local(struct scst_cmd *cmd) memset(buffer, 0, buffer_size); offs = 8; - /* sess->sess_tgt_dev_list_hash is protected by suspended activity */ + /* + * cmd won't allow to suspend activities, so we can access + * sess->sess_tgt_dev_list_hash without any additional protection. + */ for (i = 0; i < TGT_DEV_HASH_SIZE; i++) { struct list_head *sess_tgt_dev_list_head = &cmd->sess->sess_tgt_dev_list_hash[i]; @@ -1512,7 +1515,10 @@ out_compl: /* Clear left sense_reported_luns_data_changed UA, if any. */ - mutex_lock(&scst_mutex); /* protect sess_tgt_dev_list_hash */ + /* + * cmd won't allow to suspend activities, so we can access + * sess->sess_tgt_dev_list_hash without any additional protection. + */ for (i = 0; i < TGT_DEV_HASH_SIZE; i++) { struct list_head *sess_tgt_dev_list_head = &cmd->sess->sess_tgt_dev_list_hash[i]; @@ -1539,7 +1545,6 @@ out_compl: spin_unlock_bh(&tgt_dev->tgt_dev_lock); } } - mutex_unlock(&scst_mutex); out_done: /* Report the result */ @@ -1802,7 +1807,7 @@ out_done: goto out; } -/* No locks, no IRQ or IRQ-safe context allowed */ +/* No locks, no IRQ or IRQ-disabled context allowed */ int scst_check_local_events(struct scst_cmd *cmd) { int res, rc;