linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Nayeemahmed Badebade <itachi.opsrc@gmail.com>
Cc: andreas.dilger@intel.com, gregkh@linuxfoundation.org,
	oleg.drokin@intel.com, bruce.korb@gmail.com,
	lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: lustre: lustre/ldlm: Fixed sparse warnings
Date: Mon, 19 Sep 2016 21:43:36 +0100 (BST)	[thread overview]
Message-ID: <alpine.LFD.2.20.1609192143150.21894@casper.infradead.org> (raw)
In-Reply-To: <1474233499-11369-1-git-send-email-itachi.opsrc@gmail.com>


> 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>

> ---
> 
> Changes in v2:
>  * Corrected sparse annotations for the lock
>    lock->l_resource->lr_lock
> 
>  drivers/staging/lustre/lustre/ldlm/l_lock.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/staging/lustre/lustre/ldlm/l_lock.c b/drivers/staging/lustre/lustre/ldlm/l_lock.c
> index ea8840c..3845f38 100644
> --- a/drivers/staging/lustre/lustre/ldlm/l_lock.c
> +++ b/drivers/staging/lustre/lustre/ldlm/l_lock.c
> @@ -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 @@ struct ldlm_resource *lock_res_and_lock(struct ldlm_lock *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);
> --
> 1.9.1
> 
> 

      parent reply	other threads:[~2016-09-19 20:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 15:20 [PATCH] staging: lustre: lustre/ldlm: Fixed sparse warnings Nayeemahmed Badebade
2016-09-12 10:27 ` Greg KH
2016-09-14  5:14   ` Dilger, Andreas
2016-09-15 18:33     ` nayeem
2016-09-16  8:00       ` Dilger, Andreas
2016-09-18 20:21         ` nayeem
2016-09-18 20:29           ` Dilger, Andreas
2016-09-18 21:18             ` [PATCH v2] " Nayeemahmed Badebade
2016-09-18 21:27               ` Dilger, Andreas
2016-09-19 20:43               ` James Simmons [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.20.1609192143150.21894@casper.infradead.org \
    --to=jsimmons@infradead.org \
    --cc=andreas.dilger@intel.com \
    --cc=bruce.korb@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=itachi.opsrc@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).