Removes unneeded mutex_lock(&scst_mutex), which can't be done on atomic or SIRQ context
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Fri, 10 Jul 2009 11:56:51 +0000 (11:56 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Fri, 10 Jul 2009 11:56:51 +0000 (11:56 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@946 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/scst_lib.c
scst/src/scst_targ.c

index ddc6f05..951fccc 100644 (file)
@@ -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);
        }
 
index 63c5fd5..56e14e7 100644 (file)
@@ -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;