nilfs2: eliminate sparse warning - "context imbalance"
PATCH v2 1/1 nilfs2: eliminate sparse warning - "context imbalance"
insert sparse annotations to fix following sparse warning.
fs/nilfs2/segment.c:2681:3: warning: context imbalance in 'nilfs_segctor_kill_thread' - unexpected unlock
--- fs/nilfs2/segment.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
fs/nilfs2/segment.c +7 -0
@@ -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 ;
Signature · 6 lines
1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 87r5fug3op.wl%[email protected]
Quoted 15 lines · Jiro SEKIBA
insert sparse annotations to fix following sparse warning.
fs/nilfs2/segment.c:2681:3: warning: context imbalance in 'nilfs_segctor_kill_thread' - unexpected unlockSigned-off-by Jiro SEKIBA <[email protected]>--- fs/nilfs2/segment.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)fs/nilfs2/segment.c +0
-0
fs/nilfs2/segment.c static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci) · line 2680
Quoted 8 lines
fs/nilfs2/segment.c +5
-0@@ -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
Quoted 9 lines
fs/nilfs2/segment.c +2
-0static 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 ;Signature · 1 line
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/1 nilfs2: eliminate sparse warning - "context imbalance"
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.
--- fs/nilfs2/segment.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/nilfs2/segment.c +2 -0
@@ -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 ;
Signature · 6 lines
1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 87tykpfkb3.wl%[email protected]
Ryusuke Konishi
AppliedQuoted 10 lines · Jiro SEKIBA
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_threadis only called insidesc_state_locklock. sparse doesn't detect the context and warn "unexpected unlock". __acquires/__releases pretend to lock/unlock thesc_state_lockfor sparse.Signed-off-by Jiro SEKIBA <[email protected]>
Applied.
Thanks for your cooperation.
Ryusuke Konishi
Quoted 19 lines
--- fs/nilfs2/segment.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)fs/nilfs2/segment.c +2
-0@@ -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 ;Signature · 1 line
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html