staging: lustre: lustre/ldlm: Fixed sparse warnings
authorNayeemahmed Badebade <itachi.opsrc@gmail.com>
Sun, 18 Sep 2016 21:18:19 +0000 (02:48 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Sep 2016 11:23:40 +0000 (13:23 +0200)
Added __acquires / __releases sparse locking annotations
to lock_res_and_lock() and unlock_res_and_lock() functions
in l_lock.c, to fix below sparse warnings:

l_lock.c:47:22: warning: context imbalance in 'lock_res_and_lock' - wrong count at exit
l_lock.c:61:6: warning: context imbalance in 'unlock_res_and_lock' - unexpected unlock

Signed-off-by: Nayeemahmed Badebade <itachi.opsrc@gmail.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ldlm/l_lock.c

index ea8840cb90562bc7d8240167c9db90c43bb89273..3845f386f1db804396f31f5cc66435c9bdb2e915 100644 (file)
@@ -45,6 +45,8 @@
  * being an atomic operation.
  */
 struct ldlm_resource *lock_res_and_lock(struct ldlm_lock *lock)
+                               __acquires(&lock->l_lock)
+                               __acquires(&lock->l_resource->lr_lock)
 {
        spin_lock(&lock->l_lock);
 
@@ -59,6 +61,8 @@ EXPORT_SYMBOL(lock_res_and_lock);
  * Unlock a lock and its resource previously locked with lock_res_and_lock
  */
 void unlock_res_and_lock(struct ldlm_lock *lock)
+               __releases(&lock->l_resource->lr_lock)
+               __releases(&lock->l_lock)
 {
        /* on server-side resource of lock doesn't change */
        ldlm_clear_res_locked(lock);