]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mds/Locker: use ceph_abort_msg() instead of ceph_assert() 62941/head
authorMax Kellermann <max.kellermann@ionos.com>
Thu, 24 Apr 2025 05:17:48 +0000 (07:17 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Thu, 24 Apr 2025 05:22:05 +0000 (07:22 +0200)
commit82349c48f4819408e1230a104f9c7b10aba25c5c
tree88842bac42df9a2c4852df39124233efb59ae3b0
parente3b2df67836230d60f2a073b85537d0f3dfa08da
mds/Locker: use ceph_abort_msg() instead of ceph_assert()

This ceph_assert() always fails, but depending on the configuration
value `ceph_assert_supresssions`, execution may continue, but the
`dir` variable is left uninitialized.  This leads to a compiler
warning:

 /home/jenkins-build/build/workspace/ceph-api/src/mds/Locker.cc:451:22: error: variable 'dir' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]

clang then suggests to nullptr-initialize the variable:

 /home/jenkins-build/build/workspace/ceph-api/src/mds/Locker.cc:447:11: note: initialize the variable 'dir' to silence this warning
   447 |         CDir *dir;
       |                  ^
       |                   = nullptr

This, however, is a very bad idea because all this does is suppress
the warning; it still crashes the process.

Since there's no recovery from this problem, let's switch to
ceph_abort_msg() which is [[noreturn]] and the compiler can deduce
that `dir` is always initialized when it's used.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/mds/Locker.cc