Re: drivers/md/dm-vdo/data-vio.c:976 vdo_launch_bio() warn: inconsistent returns '&pool->lock'.

From: Matthew Sakai
Date: Tue Oct 29 2024 - 13:03:55 EST


Okay. Just to restate, what I took away from this thread is
1) The current code provokes a warning.
2) When bisecting, the bot found a (different) warning from the patch introducing this code, and so the mail points out that warning instead of the warning in newer code.
3) The warning is showing up now because new checking allows the bot to notice problems it didn't notice before.

The commit I cited fixed warning from sparse, but I don't think we looked at smatch. This particular code does not have a locking problem, but the way it's spelled makes it difficult for static tools to understand that there is not a problem. I'll take a look and see if there's anything further I can do address the actual current warning.

Thanks for your explanation. I think I have a much better understanding of what this bot it doing now, I'll keep it in mind when we get warning in the future.

Matt

On 10/29/24 4:19 AM, Dan Carpenter wrote:
On Tue, Oct 29, 2024 at 11:07:07AM +0300, Dan Carpenter wrote:
3) The kbuild bot detected the bug, but unfortunately the cross function DB
doesn't scale well enough for the kbuild bot to use so it didn't detect the
fix.

Aw crud. It does still print a warning on linux-next actually.
Smatch says that we lock "&pool->lock" and unlocked
"&pool->discard_limiter->pool->lock".

Anyway. Points 1 and 4 that we were running new checks on old code and that
the code in the email did have a bug are correct.

regards,
dan carpenter