The most recent version of the sparse static source code checking tool does
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Mon, 27 Jul 2009 17:52:19 +0000 (17:52 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Mon, 27 Jul 2009 17:52:19 +0000 (17:52 +0000)
now report functions that are called with a lock held but that are missing
__acquires() and __releases() annotations. The patch below adds such
annotations and makes the following sparse warnings disappear:

drivers/scst/iscsi-scst/iscsi.c:2861:9: warning: context imbalance in 'iscsi_check_send_delayed_tm_resp' - unexpected unlock
drivers/scst/iscsi-scst/nthread.c:1614:17: warning: context imbalance in 'scst_do_job_wr' - unexpected unlock
drivers/scst/iscsi-scst/iscsi.c:2861:9: warning: context imbalance in 'iscsi_check_send_delayed_tm_resp' - unexpected unlock
drivers/scst/iscsi-scst/nthread.c:1614:17: warning: context imbalance in 'scst_do_job_wr' - unexpected unlock
drivers/scst/scst_local/scst_local.c:554:30: warning: context imbalance in 'scst_local_queuecommand' - unexpected unlock

The patch below has been tested by comparing the output of
"scripts/run-regression-tests 2.6.30.3" before and after the patch was applied.

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@982 d57e44dd-8a1f-0410-8b47-8ef2f437770f

iscsi-scst/kernel/iscsi.c
iscsi-scst/kernel/nthread.c
scst_local/scst_local.c

index 974dadc..26d2f5c 100644 (file)
@@ -2850,6 +2850,8 @@ static bool iscsi_is_delay_tm_resp(struct iscsi_cmnd *rsp)
 
 /* Called under sn_lock, but might drop it inside, then reaquire */
 static void iscsi_check_send_delayed_tm_resp(struct iscsi_session *sess)
+       __acquires(&sn_lock)
+       __releases(&sn_lock)
 {
        struct iscsi_cmnd *tm_rsp = sess->tm_rsp;
 
index ce4e410..c4d587a 100644 (file)
@@ -910,6 +910,8 @@ static int process_read_io(struct iscsi_conn *conn, int *closed)
  * then reaquire.
  */
 static void scst_do_job_rd(void)
+       __acquires(&iscsi_rd_lock)
+       __releases(&iscsi_rd_lock)
 {
        TRACE_ENTRY();
 
@@ -1591,6 +1593,8 @@ static int process_write_queue(struct iscsi_conn *conn)
  * then reaquire.
  */
 static void scst_do_job_wr(void)
+       __acquires(&iscsi_wr_lock)
+       __releases(&iscsi_wr_lock)
 {
        TRACE_ENTRY();
 
index 4e93917..62ff7d3 100644 (file)
@@ -455,6 +455,8 @@ static int scst_local_send_resp(struct scsi_cmnd *cmnd,
  */
 static int scst_local_queuecommand(struct scsi_cmnd *SCpnt,
                                   void (*done)(struct scsi_cmnd *))
+       __acquires(&h->host_lock)
+       __releases(&h->host_lock)
 {
        struct scst_local_tgt_specific *tgt_specific = NULL;
        struct scst_local_host_info *scst_lcl_host;