From 1711ccdec779d32c4b128c1e3f6d10bd78abcb1c Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 3 Apr 2017 16:20:35 -0700 Subject: [PATCH] osd: Check failsafe full and crash on push/pull Signed-off-by: David Zafman --- src/osd/ECBackend.cc | 5 +++++ src/osd/PGBackend.h | 2 ++ src/osd/PrimaryLogPG.cc | 4 ++++ src/osd/PrimaryLogPG.h | 1 + src/osd/ReplicatedBackend.cc | 12 ++++++++++++ 5 files changed, 24 insertions(+) diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index 8e7b09fe38a..ea285cc4e6f 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -282,6 +282,11 @@ void ECBackend::handle_recovery_push( const PushOp &op, RecoveryMessages *m) { + ostringstream ss; + if (get_parent()->check_failsafe_full(ss)) { + dout(10) << __func__ << " Out of space (failsafe) processing push request: " << ss.str() << dendl; + ceph_abort(); + } bool oneshot = op.before_progress.first && op.after_progress.data_complete; ghobject_t tobj; diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 763e02bc2b8..ddd0612b131 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -261,6 +261,8 @@ typedef ceph::shared_ptr OSDMapRef; virtual LogClientTemp clog_error() = 0; + virtual bool check_failsafe_full(ostream &ss) = 0; + virtual ~Listener() {} }; Listener *parent; diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 5a73ca5e982..9398783d867 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -13272,6 +13272,10 @@ int PrimaryLogPG::getattrs_maybe_cache( return r; } +bool PrimaryLogPG::check_failsafe_full(ostream &ss) { + return osd->check_failsafe_full(ss); +} + void intrusive_ptr_add_ref(PrimaryLogPG *pg) { pg->get("intptr"); } void intrusive_ptr_release(PrimaryLogPG *pg) { pg->put("intptr"); } diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 3d92e3b968c..f5b025db0e4 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1731,6 +1731,7 @@ public: void on_flushed() override; void on_removal(ObjectStore::Transaction *t) override; void on_shutdown() override; + bool check_failsafe_full(ostream &ss) override; // attr cache handling void setattr_maybe_cache( diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index b897eddf815..1364cc62770 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -807,6 +807,11 @@ void ReplicatedBackend::_do_push(OpRequestRef op) vector replies; ObjectStore::Transaction t; + ostringstream ss; + if (get_parent()->check_failsafe_full(ss)) { + dout(10) << __func__ << " Out of space (failsafe) processing push request: " << ss.str() << dendl; + ceph_abort(); + } for (vector::const_iterator i = m->pushes.begin(); i != m->pushes.end(); ++i) { @@ -862,6 +867,13 @@ void ReplicatedBackend::_do_pull_response(OpRequestRef op) op->mark_started(); vector replies(1); + + ostringstream ss; + if (get_parent()->check_failsafe_full(ss)) { + dout(10) << __func__ << " Out of space (failsafe) processing pull response (push): " << ss.str() << dendl; + ceph_abort(); + } + ObjectStore::Transaction t; list to_continue; for (vector::const_iterator i = m->pushes.begin(); -- 2.39.5