Skip to contentSkip to conversation

nilfs2: eliminate sparse warning - "context imbalance"

PATCH Superseded Jiro SEKIBA 2 participants 4 messages Oct 13, 2010 – Oct 14, 2010 3 messages not in the archive NILFS2 filesystem

lore
Share & tools
lore
#0 lore raw

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
index 172ad42..6494e9d 100644
@@ -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]

#2 lore raw
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 unlock

---
 fs/nilfs2/segment.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
fs/nilfs2/segment.c +0 -0
index 172ad42..6494e9d 100644

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

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
index 172ad42..d926af6 100644
@@ -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]

#6 lore raw
Quoted 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_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.

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
index 172ad42..d926af6 100644
@@ -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