Fix for missing core file in the ApplicationCored type BMC dump

During application core, Systemd-coredump creates a temporary core
file first, compresses the file and renames it to systemd-coredump
name format.

dreport relies on inotify notifications to initiate the core dump
collection.

Usually inotify generates IN_MOVED_TO events followed
by IN_CLOSE_WRITE event on creation of system-coredump file.

In UBI filesystem, inotify notification events behave
differently as summarized below:

--------------------------------------------------------------------
   Inotifiy Event   :         UBI FS       :             COW
--------------------------------------------------------------------
- IN_MOVED_TO       :          _NA_        :  notification event
                    :                      :  structure provides the
                    :                      :  name of the core file.
                    :                      :
- IN_CREATE         : notification event   :           _NA_
                    : structure provides   :
                    : the name of the core :
                    : file.                :
                    :                      :
- IN_CLOSE_NOWRITE  : notification triggers:           _NA_
                    : directory  level and :
                    : size of name field   :
                    : shows zero.          :
                    :                      :
                    :                      :
- IN_CLOSE_WRITE    : notification event   : notification event
                    : structure provides   : structure provides the
                    : the INODE number     : name of the core file.
                    : instead of name of   :
                    : the core file.       :
----------------------------------------------------------------------

Current implementation relies on inotify IN_CLOSE_WRITE event with the
name of the core file to trigger the dump collection.

However, in UBI FS, the inode number is sent in the inotify instead of
the name of the core file.

Hence the copying of the core file during the dump collection process
fails due to lack of the file name information.

While IN_CLOSE_WRITE is the appropriate event, IN_CREATE is the
closest match for UBI FS.

Hence the *workaround* published by this patch watches for IN_CREATE
event for the UBI FS based systems.

One possible side effect is premature handling of large systemd-core
file resulting in an incomplete file. However, this was _not_ observed
during testing due to the time interval between the inotify and
dreport consuming the file.

A more generic fix may be explored for issue #2287.

Resolves openbmc/openbmc#2240

Change-Id: Id88181c62a34c05646eed4ac7e67d9b37a523733
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
3 files changed
tree: 0a40c26a5ee9ea7b8a1ca3d2022ef8c3a835778c
  1. tools/
  2. xyz/
  3. bootstrap.sh
  4. configure.ac
  5. core_manager.cpp
  6. core_manager.hpp
  7. core_manager_main.cpp
  8. dump_entry.cpp
  9. dump_entry.hpp
  10. dump_internal.hpp
  11. dump_manager.cpp
  12. dump_manager.hpp
  13. dump_manager_main.cpp
  14. dump_serialize.cpp
  15. dump_serialize.hpp
  16. dump_utils.hpp
  17. elog_watch.cpp
  18. elog_watch.hpp
  19. ffdc
  20. LICENSE
  21. Makefile.am
  22. README.md
  23. watch.cpp
  24. watch.hpp
README.md

phosphor-debug-collector

Phosphor Debug Collector provides mechanisms to collect various log files and system parameters. Used to troubleshoot problems in OpenBMC based systems.

To Build

To build this package, do the following steps:

    1. ./bootstrap.sh
    2. ./configure ${CONFIGURE_FLAGS}
    3. make

To clean the repository run `./bootstrap.sh clean`.