Skip to content

Instantly share code, notes, and snippets.

Created September 13, 2012 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3717397 to your computer and use it in GitHub Desktop.
Save anonymous/3717397 to your computer and use it in GitHub Desktop.
From 4f1abfb33cc4685c52b24a7ac15896ea04703655 Mon Sep 17 00:00:00 2001
From: Josh Durgin <josh.durgin@inktank.com>
Date: Thu, 13 Sep 2012 13:01:11 -0700
Subject: [PATCH] librbd: catch sigpfe and print debug info
---
src/librbd.cc | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/librbd.cc b/src/librbd.cc
index e7e0932..11f01c3 100644
--- a/src/librbd.cc
+++ b/src/librbd.cc
@@ -31,6 +31,7 @@
#include <map>
#include <string>
#include <vector>
+#include <signal.h>
#define dout_subsys ceph_subsys_rbd
#undef dout_prefix
@@ -543,7 +544,19 @@ namespace librbd {
start_time = ceph_clock_now(ictx->cct);
}
+ static void debug_sigfpe(int signo, siginfo_t *info, void *opaque)
+ {
+ printf("got SIGFPE! si_code = %d address = %p\n", info->si_code,
+ info->si_addr);
+ assert(0);
+ }
+
void complete() {
+ struct sigaction action;
+ action.sa_flags = SA_SIGINFO;
+ action.sa_sigaction = debug_sigfpe;
+ sigaction(SIGFPE, &action, NULL);
+
utime_t elapsed;
assert(lock.is_locked());
ldout(ictx->cct, 20) << "start_time sec = " << start_time.tv.tv_sec
--
1.7.2.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment