mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: David Howells <dhowells@redhat.com>,
	Trond Myklebust <Trond.Myklebust@netapp.com>
Subject: [PATCH 1/3] nfs: add lock annotations to squelch sparse warnings
Date: Sat,  6 Jul 2013 17:41:24 +0530	[thread overview]
Message-ID: <1373112686-28501-2-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1373112686-28501-1-git-send-email-artagnon@gmail.com>

sparse, being a static analyzer, emits the following warnings:

  context imbalance in 'nfs_server_list_start' - wrong count at exit
  context imbalance in 'nfs_server_list_start' - unexpected unlock
  context imbalance in 'nfs_volume_list_start' - wrong count at exit
  context imbalance in 'nfs_volume_list_start' - unexpected unlock

Help it by annotating the pairs of functions with __acquires and
__releases.

Cc: David Howells <dhowells@redhat.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 fs/nfs/client.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index c513b0c..2a32ac8 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1253,6 +1253,7 @@ static int nfs_server_list_open(struct inode *inode, struct file *file)
  * set up the iterator to start reading from the server list and return the first item
  */
 static void *nfs_server_list_start(struct seq_file *m, loff_t *_pos)
+	__acquires(&nn->nfs_client_lock)
 {
 	struct nfs_net *nn = net_generic(m->private, nfs_net_id);
 
@@ -1275,6 +1276,7 @@ static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos)
  * clean up after reading from the transports list
  */
 static void nfs_server_list_stop(struct seq_file *p, void *v)
+	__releases(&nn->nfs_client_lock)
 {
 	struct nfs_net *nn = net_generic(p->private, nfs_net_id);
 
@@ -1338,6 +1340,7 @@ static int nfs_volume_list_open(struct inode *inode, struct file *file)
  * set up the iterator to start reading from the volume list and return the first item
  */
 static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos)
+	__acquires(&nn->nfs_client_lock)
 {
 	struct nfs_net *nn = net_generic(m->private, nfs_net_id);
 
@@ -1360,6 +1363,7 @@ static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos)
  * clean up after reading from the transports list
  */
 static void nfs_volume_list_stop(struct seq_file *p, void *v)
+	__releases(&nn->nfs_client_lock)
 {
 	struct nfs_net *nn = net_generic(p->private, nfs_net_id);
 
-- 
1.8.3.2.733.gf8abaeb


  reply	other threads:[~2013-07-06 12:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-06 12:11 [PATCH 0/3] Trivial sparse acquire/release annotations Ramkumar Ramachandra
2013-07-06 12:11 ` Ramkumar Ramachandra [this message]
2013-07-06 12:11 ` [PATCH 2/3] apic: add lock annotations to squelch sparse warnings Ramkumar Ramachandra
2013-07-06 12:11 ` [PATCH 3/3] irq: add lock annotation to squelch a sparse warning Ramkumar Ramachandra
2013-09-23 14:41 ` [PATCH 0/3] Trivial sparse acquire/release annotations Ramkumar Ramachandra

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=1373112686-28501-2-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®