Skip to contentSkip to conversation

ocfs2: Add missing annotations for ocfs2_refcount_cache_lock() and ocfs2_refcount_cache_unlock()

PATCH Applied Jules Irenge 2 participants 2 messages Feb 24, 2020 – Feb 25, 2020 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: Add missing annotations for ocfs2_refcount_cache_lock() and ocfs2_refcount_cache_unlock()

Sparse reports warnings at ocfs2_refcount_cache_lock()
and ocfs2_refcount_cache_unlock()

warning: context imbalance in ocfs2_refcount_cache_lock()
- wrong count at exit
warning: context imbalance in ocfs2_refcount_cache_unlock()
- unexpected unlock

The root cause is the missing annotation at ocfs2_refcount_cache_lock()
and at ocfs2_refcount_cache_unlock()

Add the missing __acquires(&rf->rf_lock) annotation
to ocfs2_refcount_cache_lock()
Add the missing __releases(&rf->rf_lock) annotation
to ocfs2_refcount_cache_unlock()

---
 fs/ocfs2/refcounttree.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/refcounttree.c +2 -0
index ee43e51188be..da99c80f49da 100644
@@ -154,6 +154,7 @@ ocfs2_refcount_cache_get_super(struct ocfs2_caching_info *ci)
 }
 
 static void ocfs2_refcount_cache_lock(struct ocfs2_caching_info *ci)
+	__acquires(&rf->rf_lock)
 {
 	struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci);
 
@@ -161,6 +162,7 @@ static void ocfs2_refcount_cache_lock(struct ocfs2_caching_info *ci)
 }
 
 static void ocfs2_refcount_cache_unlock(struct ocfs2_caching_info *ci)
+	__releases(&rf->rf_lock)
 {
 	struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci);
 
Signature · 1 line
2.24.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jules Irenge

Sparse reports warnings at ocfs2_refcount_cache_lock()
and ocfs2_refcount_cache_unlock()

warning: context imbalance in ocfs2_refcount_cache_lock()
- wrong count at exit
warning: context imbalance in ocfs2_refcount_cache_unlock()
- unexpected unlock

The root cause is the missing annotation at ocfs2_refcount_cache_lock()
and at ocfs2_refcount_cache_unlock()

Quoted 6 lines

Add the missing __acquires(&rf->rf_lock) annotation
to ocfs2_refcount_cache_lock()
Add the missing __releases(&rf->rf_lock) annotation
to ocfs2_refcount_cache_unlock()

Quoted 25 lines
---
 fs/ocfs2/refcounttree.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/refcounttree.c +2 -0
index ee43e51188be..da99c80f49da 100644
@@ -154,6 +154,7 @@ ocfs2_refcount_cache_get_super(struct ocfs2_caching_info *ci)
 }
 
 static void ocfs2_refcount_cache_lock(struct ocfs2_caching_info *ci)
+	__acquires(&rf->rf_lock)
 {
 	struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci);
 
@@ -161,6 +162,7 @@ static void ocfs2_refcount_cache_lock(struct ocfs2_caching_info *ci)
 }
 
 static void ocfs2_refcount_cache_unlock(struct ocfs2_caching_info *ci)
+	__releases(&rf->rf_lock)
 {
 	struct ocfs2_refcount_tree *rf = cache_info_to_refcount(ci);