diff mbox series

[02/30] dax: Add missing annotations ofr dax_read_lock() and dax_read_unlock()

Message ID 20200223231711.157699-3-jbi.octave@gmail.com
State New, archived
Headers show
Series None | expand

Commit Message

Jules Irenge Feb. 23, 2020, 11:16 p.m. UTC
Sparse reports warning at dax_read_lock() and at dax_read_unlock()

warning: context imbalance in dax_read_lock() - wrong count at exit
 warning: context imbalance in dax_read_unlock() - unexpected unlock

The root cause is the mnissing annotations at dax_read_lock()
	and dax_read_unlock()

Add the missing __acquires(&dax_srcu) notations to dax_read_lock()
Add the missing __releases(&dax_srcu) annotation to dax_read_unlock()

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 drivers/dax/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Yi Zhang Feb. 24, 2020, 1:23 a.m. UTC | #1
On 2/24/20 7:16 AM, Jules Irenge wrote:
> Sparse reports warning at dax_read_lock() and at dax_read_unlock()
>
> warning: context imbalance in dax_read_lock() - wrong count at exit
>   warning: context imbalance in dax_read_unlock() - unexpected unlock
>
> The root cause is the mnissing annotations at dax_read_lock()
> 	and dax_read_unlock()
s/mnissing/missing
> Add the missing __acquires(&dax_srcu) notations to dax_read_lock()
> Add the missing __releases(&dax_srcu) annotation to dax_read_unlock()
>
> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> ---
>   drivers/dax/super.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 26a654dbc69a..f872a2fb98d4 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -28,13 +28,13 @@ static struct super_block *dax_superblock __read_mostly;
>   static struct hlist_head dax_host_list[DAX_HASH_SIZE];
>   static DEFINE_SPINLOCK(dax_host_lock);
>   
> -int dax_read_lock(void)
> +int dax_read_lock(void) __acquires(&dax_srcu)
>   {
>   	return srcu_read_lock(&dax_srcu);
>   }
>   EXPORT_SYMBOL_GPL(dax_read_lock);
>   
> -void dax_read_unlock(int id)
> +void dax_read_unlock(int id) __releases(&dax_srcu)
>   {
>   	srcu_read_unlock(&dax_srcu, id);
>   }
diff mbox series

Patch

diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 26a654dbc69a..f872a2fb98d4 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -28,13 +28,13 @@  static struct super_block *dax_superblock __read_mostly;
 static struct hlist_head dax_host_list[DAX_HASH_SIZE];
 static DEFINE_SPINLOCK(dax_host_lock);
 
-int dax_read_lock(void)
+int dax_read_lock(void) __acquires(&dax_srcu)
 {
 	return srcu_read_lock(&dax_srcu);
 }
 EXPORT_SYMBOL_GPL(dax_read_lock);
 
-void dax_read_unlock(int id)
+void dax_read_unlock(int id) __releases(&dax_srcu)
 {
 	srcu_read_unlock(&dax_srcu, id);
 }