From 7bdc38faf282b146c0daeb3674a110b716f04b9c Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 27 Jul 2009 17:52:19 +0000 Subject: [PATCH] The most recent version of the sparse static source code checking tool does 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 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@982 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/iscsi.c | 2 ++ iscsi-scst/kernel/nthread.c | 4 ++++ scst_local/scst_local.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 974dadc97..26d2f5ce2 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -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; diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index ce4e41044..c4d587a50 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -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(); diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 4e9391708..62ff7d352 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -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;