fsnotify: Add missing annotation for fsnotify_finish_user_wait() and for fsnotify_prepare_user_wait()
Subsystems (2)
PATCH v2 1/1 fsnotify: Add missing annotation for fsnotify_finish_user_wait() and for fsnotify_prepare_user_wait()
Sparse reports warnings at fsnotify_prepare_user_wait()
and at fsnotify_finish_user_wait()
warning: context imbalance in fsnotify_finish_user_wait()
- wrong count at exit
warning: context imbalance in fsnotify_prepare_user_wait()
- unexpected unlock
The root cause is the missing annotation at fsnotify_finish_user_wait()
and at fsnotify_prepare_user_wait()fsnotify_prepare_user_wait() has an extra annotation __release()
that only tell Sparse and not GCC to shutdown the warning
Add the missing __acquires(&fsnotify_mark_srcu) annotation Add the missing __releases(&fsnotify_mark_srcu) annotation Add the __release(&fsnotify_mark_srcu) annotation.
---
changes since v2
-include annotations for fsnotify_prepare_user_wait()
fs/notify/mark.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/notify/mark.c +5 -1
@@ -325,13 +325,16 @@ static void fsnotify_put_mark_wake(struct fsnotify_mark *mark) }bool fsnotify_prepare_user_wait (struct fsnotify_iter_info *iter_info) + __releases(&fsnotify_mark_srcu) {int type;fsnotify_foreach_obj_type (type) {/* This can fail if mark is being removed */ -if (!fsnotify_get_mark_safe (iter_info->marks[type])) +if (!fsnotify_get_mark_safe (iter_info->marks[type])) { +__release (&fsnotify_mark_srcu); goto fail; + } }/*
@@ -350,6 +353,7 @@ bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info) }void fsnotify_finish_user_wait (struct fsnotify_iter_info *iter_info) + __acquires(&fsnotify_mark_srcu) {int type;
Signature · 1 line
2.24.1
Jan Kara
maintainerQuoted 8 lines · Jules Irenge
Sparse reports warnings at
fsnotify_prepare_user_wait()
and atfsnotify_finish_user_wait()warning: context imbalance in
fsnotify_finish_user_wait()
- wrong count at exit
warning: context imbalance infsnotify_prepare_user_wait()
- unexpected unlock
Quoted 8 lines
The root cause is the missing annotation at
fsnotify_finish_user_wait()
and atfsnotify_prepare_user_wait()fsnotify_prepare_user_wait()has an extra annotation__release()
that only tell Sparse and not GCC to shutdown the warningAdd the missing
__acquires(&fsnotify_mark_srcu)annotation Add the missing__releases(&fsnotify_mark_srcu)annotation Add the__release(&fsnotify_mark_srcu)annotation.
Thanks for the patch. I've added it to my tree.
Honza
Quoted 42 lines
Signed-off-by Jules Irenge <[email protected]>---
changes since v2(quoted diff) +0
-1-include annotations for fsnotify_prepare_user_wait() fs/notify/mark.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)fs/notify/mark.c +5
-1@@ -325,13 +325,16 @@ static void fsnotify_put_mark_wake(struct fsnotify_mark *mark) }bool fsnotify_prepare_user_wait (struct fsnotify_iter_info *iter_info) + __releases(&fsnotify_mark_srcu) {int type;fsnotify_foreach_obj_type (type) {/* This can fail if mark is being removed */ -if (!fsnotify_get_mark_safe (iter_info->marks[type])) +if (!fsnotify_get_mark_safe (iter_info->marks[type])) { +__release (&fsnotify_mark_srcu); goto fail; + } }/* @@ -350,6 +353,7 @@ bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info) }void fsnotify_finish_user_wait (struct fsnotify_iter_info *iter_info) + __acquires(&fsnotify_mark_srcu) {int type;Signature · 1 line
2.24.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR