Skip to content

Commit 00e0afb

Browse files
irengejankara
authored andcommitted
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. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jules Irenge <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent 8632e9b commit 00e0afb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/notify/mark.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,16 @@ static void fsnotify_put_mark_wake(struct fsnotify_mark *mark)
325325
}
326326

327327
bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info)
328+
__releases(&fsnotify_mark_srcu)
328329
{
329330
int type;
330331

331332
fsnotify_foreach_obj_type(type) {
332333
/* This can fail if mark is being removed */
333-
if (!fsnotify_get_mark_safe(iter_info->marks[type]))
334+
if (!fsnotify_get_mark_safe(iter_info->marks[type])) {
335+
__release(&fsnotify_mark_srcu);
334336
goto fail;
337+
}
335338
}
336339

337340
/*
@@ -350,6 +353,7 @@ bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info)
350353
}
351354

352355
void fsnotify_finish_user_wait(struct fsnotify_iter_info *iter_info)
356+
__acquires(&fsnotify_mark_srcu)
353357
{
354358
int type;
355359

0 commit comments

Comments
 (0)