All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] nilfs2: eliminate sparse warning - "context imbalance"
@ 2010-10-13  3:41 Jiro SEKIBA
       [not found] ` <87r5fug3op.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jiro SEKIBA @ 2010-10-13  3:41 UTC (permalink / raw)
  To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA
  Cc: Ryusuke Konishi, konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg


insert sparse annotations to fix following sparse warning.

fs/nilfs2/segment.c:2681:3: warning: context imbalance in 'nilfs_segctor_kill_thread' - unexpected unlock

Signed-off-by: Jiro SEKIBA <jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org>
---
 fs/nilfs2/segment.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 172ad42..6494e9d 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2673,7 +2673,14 @@ static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci)
 	return 0;
 }
 
+/*
+ * nilfs_segctor_kill_thread is only called inside sc_state_lock lock.
+ * sparse doesn't detect the context and warn "unexpected unlock".
+ * __acquires/__releases pretend to lock/unlockk the sc_state_lock for sparse.
+ */
 static void nilfs_segctor_kill_thread(struct nilfs_sc_info *sci)
+	__acquires(&sci->sc_state_lock)
+	__releases(&sci->sc_state_lock)
 {
 	sci->sc_state |= NILFS_SEGCTOR_QUIT;
 
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHv2] nilfs2: eliminate sparse warning - "context imbalance"
       [not found] ` <87r5fug3op.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
@ 2010-10-13 16:29   ` Ryusuke Konishi
       [not found]     ` <20101014.012944.163237161.ryusuke-sG5X7nlA6pw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Ryusuke Konishi @ 2010-10-13 16:29 UTC (permalink / raw)
  To: jir-hfpbi5WX9J54Eiagz67IpQ
  Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg

On Wed, 13 Oct 2010 12:41:10 +0900, Jiro SEKIBA wrote:
> 
> insert sparse annotations to fix following sparse warning.
> 
> fs/nilfs2/segment.c:2681:3: warning: context imbalance in 'nilfs_segctor_kill_thread' - unexpected unlock
> 
> Signed-off-by: Jiro SEKIBA <jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org>
> ---
>  fs/nilfs2/segment.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
> index 172ad42..6494e9d 100644
> --- a/fs/nilfs2/segment.c
> +++ b/fs/nilfs2/segment.c
> @@ -2673,7 +2673,14 @@ static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci)
>  	return 0;
>  }
>  
> +/*
> + * nilfs_segctor_kill_thread is only called inside sc_state_lock lock.
> + * sparse doesn't detect the context and warn "unexpected unlock".
> + * __acquires/__releases pretend to lock/unlockk the sc_state_lock for sparse.
> + */

s/unlockk/unlock/

Well, I think this comment should be included in the changelog.  It's
a common manner in kernel, and the comment adds a note on the sparse
tool.  Describing it in the implementation seems verbose.

Ryusuke Konishi

>  static void nilfs_segctor_kill_thread(struct nilfs_sc_info *sci)
> +	__acquires(&sci->sc_state_lock)
> +	__releases(&sci->sc_state_lock)
>  {
>  	sci->sc_state |= NILFS_SEGCTOR_QUIT;
>  
> -- 
> 1.5.6.5
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCHv3] nilfs2: eliminate sparse warning - "context imbalance"
       [not found]     ` <20101014.012944.163237161.ryusuke-sG5X7nlA6pw@public.gmane.org>
@ 2010-10-14  4:52       ` Jiro SEKIBA
       [not found]         ` <87tykpfkb3.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jiro SEKIBA @ 2010-10-14  4:52 UTC (permalink / raw)
  To: Ryusuke Konishi
  Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg


insert sparse annotations to fix following sparse warning.

fs/nilfs2/segment.c:2681:3: warning: context imbalance in 'nilfs_segctor_kill_thread' - unexpected unlock

nilfs_segctor_kill_thread is only called inside sc_state_lock lock.
sparse doesn't detect the context and warn "unexpected unlock".
__acquires/__releases pretend to lock/unlock the sc_state_lock for sparse.

Signed-off-by: Jiro SEKIBA <jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org>
---
 fs/nilfs2/segment.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 172ad42..d926af6 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2674,6 +2674,8 @@ static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci)
 }
 
 static void nilfs_segctor_kill_thread(struct nilfs_sc_info *sci)
+	__acquires(&sci->sc_state_lock)
+	__releases(&sci->sc_state_lock)
 {
 	sci->sc_state |= NILFS_SEGCTOR_QUIT;
 
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHv3] nilfs2: eliminate sparse warning - "context imbalance"
       [not found]         ` <87tykpfkb3.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
@ 2010-10-14  5:58           ` Ryusuke Konishi
  0 siblings, 0 replies; 4+ messages in thread
From: Ryusuke Konishi @ 2010-10-14  5:58 UTC (permalink / raw)
  To: jir-hfpbi5WX9J54Eiagz67IpQ
  Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg

On Thu, 14 Oct 2010 13:52:00 +0900, Jiro SEKIBA wrote:
> 
> insert sparse annotations to fix following sparse warning.
> 
> fs/nilfs2/segment.c:2681:3: warning: context imbalance in 'nilfs_segctor_kill_thread' - unexpected unlock
> 
> nilfs_segctor_kill_thread is only called inside sc_state_lock lock.
> sparse doesn't detect the context and warn "unexpected unlock".
> __acquires/__releases pretend to lock/unlock the sc_state_lock for sparse.
> 
> Signed-off-by: Jiro SEKIBA <jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org>

Applied.

Thanks for your cooperation.

Ryusuke Konishi

> ---
>  fs/nilfs2/segment.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
> index 172ad42..d926af6 100644
> --- a/fs/nilfs2/segment.c
> +++ b/fs/nilfs2/segment.c
> @@ -2674,6 +2674,8 @@ static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci)
>  }
>  
>  static void nilfs_segctor_kill_thread(struct nilfs_sc_info *sci)
> +	__acquires(&sci->sc_state_lock)
> +	__releases(&sci->sc_state_lock)
>  {
>  	sci->sc_state |= NILFS_SEGCTOR_QUIT;
>  
> -- 
> 1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-14  5:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-13  3:41 [PATCHv2] nilfs2: eliminate sparse warning - "context imbalance" Jiro SEKIBA
     [not found] ` <87r5fug3op.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
2010-10-13 16:29   ` Ryusuke Konishi
     [not found]     ` <20101014.012944.163237161.ryusuke-sG5X7nlA6pw@public.gmane.org>
2010-10-14  4:52       ` [PATCHv3] " Jiro SEKIBA
     [not found]         ` <87tykpfkb3.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
2010-10-14  5:58           ` Ryusuke Konishi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.