]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: lustre: add sparse locking annotations
authorfrank zago <fzago@cray.com>
Wed, 23 Dec 2015 17:32:11 +0000 (12:32 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2016 22:16:48 +0000 (14:16 -0800)
Adds __acquires / __releases / __must_hold sparse locking annotations to
several functions.

Fixes sparse warnings such as:

libcfs/libcfs/hash.c:127:1: warning: context imbalance in 'cfs_hash_spin_lock'
        - wrong count at exit
libcfs/libcfs/hash.c:133:1: warning: context imbalance in 'cfs_hash_spin_unlock'
        - unexpected unlock
libcfs/libcfs/hash.c:141:9: warning: context imbalance in 'cfs_hash_rw_lock'
        - wrong count at exit
include/linux/rwlock_api_smp.h:221:9: warning: context imbalance in
        'cfs_hash_rw_unlock' - unexpected unlock

Signed-off-by: frank zago <fzago@cray.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5396
Reviewed-on: http://review.whamcloud.com/11295
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
drivers/staging/lustre/lustre/libcfs/libcfs_lock.c
drivers/staging/lustre/lustre/osc/osc_cache.c
drivers/staging/lustre/lustre/ptlrpc/client.c

index c7b9ccb13f1c737aaa9690f96a52fb4002871008..176c79b9569230e150e6706f111097092b3893b2 100644 (file)
@@ -750,8 +750,7 @@ kiblnd_setup_rd_kiov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd,
 
 static int
 kiblnd_post_tx_locked(kib_conn_t *conn, kib_tx_t *tx, int credit)
-       __releases(conn->ibc_lock)
-       __acquires(conn->ibc_lock)
+       __must_hold(&conn->ibc_lock)
 {
        kib_msg_t *msg = tx->tx_msg;
        kib_peer_t *peer = conn->ibc_peer;
index 477b385f15e058a642d278ab500f2d78263287a9..a0955d21fec2d456345482d50a7591ff3c68af8f 100644 (file)
@@ -2336,6 +2336,7 @@ ksocknal_flush_stale_txs(ksock_peer_t *peer)
 
 static int
 ksocknal_send_keepalive_locked(ksock_peer_t *peer)
+       __must_hold(&ksocknal_data.ksnd_global_lock)
 {
        ksock_sched_t *sched;
        ksock_conn_t *conn;
index 15782d9e6aa961842d3aeead96521c1f1d481fdc..32db78803d467d452ca28a1eeccc6414960796ef 100644 (file)
@@ -90,6 +90,7 @@ EXPORT_SYMBOL(cfs_percpt_lock_alloc);
  */
 void
 cfs_percpt_lock(struct cfs_percpt_lock *pcl, int index)
+       __acquires(pcl->pcl_locks)
 {
        int     ncpt = cfs_cpt_number(pcl->pcl_cptab);
        int     i;
@@ -124,6 +125,7 @@ EXPORT_SYMBOL(cfs_percpt_lock);
 /** unlock a CPU partition */
 void
 cfs_percpt_unlock(struct cfs_percpt_lock *pcl, int index)
+       __releases(pcl->pcl_locks)
 {
        int     ncpt = cfs_cpt_number(pcl->pcl_cptab);
        int     i;
index 2229419b718453417dea3934e2bc1792ba97713f..6b5f8d0d53dff899ace98582bdf4ca4ad5b6dfe7 100644 (file)
@@ -1938,6 +1938,7 @@ static int get_write_extents(struct osc_object *obj, struct list_head *rpclist)
 static int
 osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli,
                   struct osc_object *osc)
+       __must_hold(osc)
 {
        LIST_HEAD(rpclist);
        struct osc_extent *ext;
@@ -2010,6 +2011,7 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli,
 static int
 osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli,
                  struct osc_object *osc)
+       __must_hold(osc)
 {
        struct osc_extent *ext;
        struct osc_extent *next;
@@ -2083,6 +2085,7 @@ static struct osc_object *osc_next_obj(struct client_obd *cli)
 
 /* called with the loi list lock held */
 static void osc_check_rpcs(const struct lu_env *env, struct client_obd *cli)
+       __must_hold(&cli->cl_loi_list_lock)
 {
        struct osc_object *osc;
        int rc = 0;
index efdda09507bf122f01aa2c4a51cbd7b6b15331c0..8f3c26f1398f219b2af9243c7c2b344296858e98 100644 (file)
@@ -353,6 +353,7 @@ static int unpack_reply(struct ptlrpc_request *req)
  * If anything goes wrong just ignore it - same as if it never happened
  */
 static int ptlrpc_at_recv_early_reply(struct ptlrpc_request *req)
+       __must_hold(&req->rq_lock)
 {
        struct ptlrpc_request *early_req;
        time64_t olddl;