Hello Kent Overstreet,
Commit 7ede8fc514bb ("bcachefs: convert clock.c to CLASS/guards")
from Jul 14, 2025 (linux-next), leads to the following Smatch static
checker warning:
fs/bcachefs/clock.c:24 bch2_io_timer_add()
warn: double unlock '&clock->timer_lock' (orig line 27)
fs/bcachefs/clock.c
22 void bch2_io_timer_add(struct io_clock *clock, struct io_timer *timer)
23 {
--> 24 guard(spinlock)(&clock->timer_lock);
^^^^^^^^^^^^^^^^^
25
26 if (time_after_eq64((u64) atomic64_read(&clock->now),
timer->expire)) {
27 spin_unlock(&clock->timer_lock);
^^^^^^^^^^^^^^^^^
This spin_unlock() was accidentally left over when we converted to guard
locks. It leads to a double unlock.
28 timer->fn(timer);
29 return;
30 }
31
32 for (size_t i = 0; i < clock->timers.nr; i++)
33 if (clock->timers.data[i] == timer)
34 return;
35
36 BUG_ON(!min_heap_push(&clock->timers, &timer, &callbacks, NULL));
37 }
regards,
dan carpenter