summaryrefslogtreecommitdiff
path: root/include/linux/timerqueue.h
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2026-11-05 18:21:55 +0100
committerChristian Brauner <brauner@kernel.org>2026-11-05 18:21:55 +0100
commit1d91141f6722822c8ba6a1c7dda791b006eb129d (patch)
tree8033cc480e69def8bb1fedd483201a5e6374e7a1 /include/linux/timerqueue.h
parentafa735786a89bde4959db52f20e3579de54ec740 (diff)
parent36ac3a0dedf784cddb9f5161a64e6a50cf4cd0ad (diff)
Merge patch series "errseq: fix lost writeback errors in errseq_check_and_advance()"
Shashank Mohan Jain <jain.sm@gmail.com> says: errseq_check_and_advance() advances the caller's cursor to the value it tried to store even when its cmpxchg() failed. If errseq_set() stored a different errno in the meantime, the cursor holds a value that was never in the errseq_t. errseq_set() does not bump the counter while the current error is unseen, so recording the first errno again recreates exactly that value, and once another subscriber has marked it seen, the cursor's next check returns 0. For fsync() (file->f_wb_err) and syncfs() (sb->s_wb_err) this means that a writeback error recorded after the previous call returned is not reported. The race is rare: it needs two different errnos, an error recorded while the check runs, and a second subscriber consuming the value. There is no user report; it was found with a model checker. Patch 1 retries with the value found when the cmpxchg() fails, so the cursor is only ever advanced to a value that was stored with ERRSEQ_SEEN set. Patch 2 adds a KUnit case that races errseq_set() against errseq_check_and_advance() on two CPUs. Two behaviour changes are visible to callers, both intended. When a writer wins the race, the call now returns the newer errno (still "the latest error", as documented). And when two threads race on the same unserialised cursor (syncfs() does not lock f_sb_err), the loser may now return 0 where both used to return the error, so each open file description gets one report. Dependencies: patch 1 applies to mainline (fd179f8a05be) on its own and carries Cc: stable. Patch 2 extends the errseq KUnit suite from commit b52f5c1605f2 ("lib/tests: add KUnit tests for errseq"), which is only in mm-nonmm-unstable, so the series is based on mm-nonmm-unstable (e8d6475e77a7). Patch 1 could go through mm-hotfixes and patch 2 through mm-nonmm-unstable. The bug was found with a TLA+ model of lib/errseq.c checked with TLC. The patches were prepared with Claude Code (Anthropic), model Claude Opus 5.5 (claude-opus-5-5). * patches from https://patch.msgid.link/20260927051726.71337-1-jain.sm@gmail.com: lib/tests: errseq: add a concurrent check_and_advance test errseq: don't let errseq_check_and_advance() hide later errors Link: https://patch.msgid.link/20260927051726.71337-1-jain.sm@gmail.com Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions