]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
global: fault handlers cope with simultaneous faults now.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 4 May 2021 18:52:49 +0000 (18:52 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 5 May 2021 05:45:14 +0000 (05:45 +0000)
commitcd16f6b2065b92c5f2046166d0491f57d88bde7a
tree8a22a8c0aea0038d5e4ad3c77c49ad80363ca345
parent06d18bc36a665ee25611181d6c4b9fe574a67760
global: fault handlers cope with simultaneous faults now.

This fix deals with the problem that arose due to installing
the fault handlers with the `SA_RESETHAND` flag which instructs
the kernel to restore the default handler for a signal upon
entry to its handler. Unfortunately, in a situation when more
than one fault happens the same time (which may happen if e.g.
two `tp_osd_tp` threads run into the same, buggy path),
the default handler can interrupt-and-exit-the-process when
our original one is still executing.

The problem can be demonstrated with

```
rados bench -p test-pool 1 write -b 4096 --no-cleanup
```

and following instrumentation in `ceph-osd`:

```diff
diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc
index 626e8ccefbd..cde46776d53 100644
--- a/src/osd/PrimaryLogPG.cc
+++ b/src/osd/PrimaryLogPG.cc
@@ -6617,6 +6617,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
       ++ctx->num_write;
       result = 0;
       { // write
+        *((int*)((int)ceph_gettid() % 0x42)) = 0xdeadbeef;
         __u32 seq = oi.truncate_seq;
        tracepoint(osd, do_osd_op_pre_write, soid.oid.name.c_str(), soid.snap.val, oi.size, seq, op.extent.offset, op.extent.length, op.extent.truncate_size, op.extent.truncate_seq);
        if (op.extent.length != osd_op.indata.length()) {
```

Fixes: https://tracker.ceph.com/issues/50647
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/global/signal_handler.cc