summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayanth Othayoth <ojayanth@in.ibm.com>2017-09-22 11:22:25 -0500
committerJayanth Othayoth <ojayanth@in.ibm.com>2017-10-12 06:14:17 -0500
commit7f2f8027b013c39e28da6b3e1e10f6ddc7d3d042 (patch)
tree0a40c26a5ee9ea7b8a1ca3d2022ef8c3a835778c
parent3108597441bf178bca34c9bf93fb061c56e26068 (diff)
downloadphosphor-debug-collector-7f2f8027b013c39e28da6b3e1e10f6ddc7d3d042.tar.gz
phosphor-debug-collector-7f2f8027b013c39e28da6b3e1e10f6ddc7d3d042.zip
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>
-rw-r--r--configure.ac9
-rw-r--r--core_manager.cpp6
-rw-r--r--core_manager.hpp12
3 files changed, 20 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index d2565d7..776c440 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,5 +87,14 @@ AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal])
AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1])
AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal])
+AC_ARG_ENABLE([ubifs-workaround],
+ AS_HELP_STRING([--enable-ubifs-workaround],
+ [Turn on ubi workaround for core file])
+)
+AS_IF([test "x$enable_ubifs_workaround" != "xno"],
+ [AC_DEFINE([UBI_CORE_FILE_WORKAROUND], [],
+ [Turn on ubi workaround for core file])]
+)
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/core_manager.cpp b/core_manager.cpp
index beddd89..dfa1aeb 100644
--- a/core_manager.cpp
+++ b/core_manager.cpp
@@ -22,12 +22,6 @@ void Manager::watchCallback(const UserMap& fileInfo)
for (const auto& i : fileInfo)
{
- // Get list of debug files.
- if (IN_CLOSE_WRITE != i.second)
- {
- continue;
- }
-
namespace fs = std::experimental::filesystem;
fs::path file(i.first);
std::string name = file.filename();
diff --git a/core_manager.hpp b/core_manager.hpp
index 6187486..1a79982 100644
--- a/core_manager.hpp
+++ b/core_manager.hpp
@@ -15,6 +15,16 @@ namespace core
using Watch = phosphor::dump::inotify::Watch;
using UserMap = phosphor::dump::inotify::UserMap;
+/** workaround: Watches for IN_CREATE event for the
+ * ubi filesystem based systemd-coredump core path
+ * Refer openbmc/issues/#2287 for more details.
+ */
+#ifdef UBI_CORE_FILE_WORKAROUND
+ static constexpr auto coreFileEvent = IN_CREATE;
+#else
+ static constexpr auto coreFileEvent = IN_CLOSE_WRITE;
+#endif
+
/** @class Manager
* @brief OpenBMC Core manager implementation.
*/
@@ -35,7 +45,7 @@ class Manager
eventLoop(event.get()),
coreWatch(eventLoop,
IN_NONBLOCK,
- IN_CLOSE_WRITE,
+ coreFileEvent,
EPOLLIN,
CORE_FILE_DIR,
std::bind(
OpenPOWER on IntegriCloud