From 5b7c8ae8bdc26e7593323c76527cb37912b9d833 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 27 May 2011 12:55:22 -0700 Subject: [PATCH] osd: protect recovery_wq ops with the recovery lock We were calling recovery_item.remove_myself() without holding the recoveryWQ::lock. Naughty naughty! Signed-off-by: Greg Farnum --- src/osd/OSD.cc | 8 +++++++- src/osd/PG.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 5d6ca78a10ae5..32f505f1441e2 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4790,11 +4790,17 @@ void OSD::do_recovery(PG *pg) do_queries(query_map); else { dout(10) << "do_recovery no luck, giving up on this pg for now" << dendl; + recovery_wq.lock(); pg->recovery_item.remove_myself(); // sigh... + recovery_wq.unlock(); + } } - else if (started < max) + else if (started < max) { + recovery_wq.lock(); pg->recovery_item.remove_myself(); + recovery_wq.unlock(); + } pg->unlock(); } diff --git a/src/osd/PG.h b/src/osd/PG.h index 985cd95fec3d6..324dcc96d15a2 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -787,6 +787,8 @@ public: interval_set snap_trimq; + /* You should not use these items without taking their respective queue locks + * (if they have one) */ xlist::item recovery_item, backlog_item, scrub_item, scrub_finalize_item, snap_trim_item, remove_item, stat_queue_item; int recovery_ops_active; #ifdef DEBUG_RECOVERY_OIDS -- 2.39.5