From 3055d094413aa7e6c94bec7ece646856ce7f5f25 Mon Sep 17 00:00:00 2001
From: Sage Weil <sage.weil@dreamhost.com>
Date: Tue, 8 Feb 2011 08:20:19 -0800
Subject: [PATCH] osd: always write backlog after creation

dirty_log is never set to true, so we would set the log.backlog flag but
not write it to disk.  If we restarted the OSD, we would think we had the
backlog in the log but in reality we would not.  clean_up_local() could
then erase almost every object in the PG.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
---
 src/osd/OSD.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index bf2da5a2193..2983d684779 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -4593,10 +4593,8 @@ void OSD::generate_backlog(PG *pg)
     C_Contexts *fin = new C_Contexts;
     pg->do_peer(*t, fin->contexts, query_map, NULL);
     do_queries(query_map);
-    if (pg->dirty_info)
-      pg->write_info(*t);
-    if (pg->dirty_log)
-      pg->write_log(*t);
+    pg->write_info(*t);
+    pg->write_log(*t);
     int tr = store->queue_transaction(&pg->osr, t, new ObjectStore::C_DeleteTransaction(t), fin);
     assert(tr == 0);
   }