Skip to contentSkip to conversation

dlm: remove BUG() before panic()

PATCH In review Arnd Bergmann 2 participants 2 messages May 7, 2020 – May 8, 2020 Distributed lock manager (DLM)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dlm: remove BUG() before panic()

Building a kernel with clang sometimes fails with an objtool error in dlm:

fs/dlm/lock.o: warning: objtool: revert_lock_pc()+0xbd: can't find jump dest instruction at .text+0xd7fc

The problem is that BUG() never returns and the compiler knows that anything after it is unreachable, however the panic still emits some code that does not get fully eliminated.

Having both BUG() and panic() is really pointless as the BUG() kills the current process and the subsequent panic() never hits. In most cases, we probably don't really want either and should replace the DLM_ASSERT() statements with WARN_ON(), as has been done for some of them.

Remove the BUG() here so the user at least sees the panic message and we can reliably build randconfig kernels.

Fixes e7fd41792fc0 ("[DLM] The core of the DLM for GFS2/CLVM")
Cc Josh Poimboeuf <[email protected]>
Cc clang-built-linux at googlegroups.com
---
 fs/dlm/dlm_internal.h | 1 -
 1 file changed, 1 deletion(-)
fs/dlm/dlm_internal.h +0 -1
index 416d9de35679..4311d01b02a8 100644
@@ -97,7 +97,6 @@ do { \
                __LINE__, __FILE__, #x, jiffies); \
     {do} \
     printk("\n"); \
-    BUG(); \
     panic("DLM:  Record message above and reboot.\n"); \
   } \
 }
Signature · 1 line
2.26.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Arnd Bergmann

Building a kernel with clang sometimes fails with an objtool error in dlm:

fs/dlm/lock.o: warning: objtool: revert_lock_pc()+0xbd: can't find jump dest instruction at .text+0xd7fc

The problem is that BUG() never returns and the compiler knows that anything after it is unreachable, however the panic still emits some code that does not get fully eliminated.

Having both BUG() and panic() is really pointless as the BUG() kills the current process and the subsequent panic() never hits. In most cases, we probably don't really want either and should replace the DLM_ASSERT() statements with WARN_ON(), as has been done for some of them.

Quoted 7 lines

Remove the BUG() here so the user at least sees the panic message and we can reliably build randconfig kernels.

Fixes e7fd41792fc0 ("[DLM] The core of the DLM for GFS2/CLVM")
Cc Josh Poimboeuf <[email protected]>
Cc clang-built-linux at googlegroups.com

Thanks for the patch.

Quoted 18 lines
---
 fs/dlm/dlm_internal.h | 1 -
 1 file changed, 1 deletion(-)
fs/dlm/dlm_internal.h +0 -2
index 416d9de35679..4311d01b02a8 100644
@@ -97,7 +97,6 @@ do { \
                __LINE__, __FILE__, #x, jiffies); \
     {do} \
     printk("\n"); \
-    BUG(); \
     panic("DLM:  Record message above and reboot.\n"); \
   } \
 }
--

2.26.0

Signature · 2 lines
Thanks,
~Nick Desaulniers