diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 32937c767..8885da4d2 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -3413,6 +3413,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; @@ -3446,7 +3447,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++) { @@ -3519,8 +3525,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 e6ce16345..91def4fd3 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -1448,7 +1448,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]; @@ -1510,7 +1513,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]; @@ -1537,7 +1543,6 @@ out_compl: spin_unlock_bh(&tgt_dev->tgt_dev_lock); } } - mutex_unlock(&scst_mutex); out_done: /* Report the result */ @@ -1702,7 +1707,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;