Skip to content

RFC avoid clobbering registers with J_ASSERT macro

Chris Snook linux-fsdevel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2jbd: avoid clobbering registers with J_ASSERT macroinclude/linux/jbd.h+4 -10 replies
2/2jbd2: avoid clobbering registers with J_ASSERT macroinclude/linux/jbd2.h+4 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] avoid clobbering registers with J_ASSERT macro

The J_ASSERT() macro in jbd and jbd2 calls printk() prior to BUG(). While this makes it more convenient to read the assertion failure, it also clobbers registers, which can sometimes make debugging harder, which is clearly not the intended purpose. I recently banged my head on this myself.

The following patches to jbd and jbd2 enable the printk only if CONFIG_JBD[2]_DEBUG is set. Otherwise, it will simply BUG if the condition is violated. This way test kernels still get the benefit of the J_ASSERT printk, while production kernels, which come from a more stable source base where it's easier to trace line numbers back to specific lines of code, simply get the BUG, with all registers preserved.

This is, of course, not the only way of fixing this problem, but it seems to be the least invasive way, which is why I'm proposing these patches.

-- Chris