]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: save "mkfs_done" only if we pass fsck() tests 15238/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 23 May 2017 14:00:35 +0000 (22:00 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 23 May 2017 14:19:36 +0000 (22:19 +0800)
In our local test bed, we found mkfs() sometimes can fail
due to errors discovered by fsck(), and is therefore unrecoverable
by redoing mkfs() as the "mkfs_done" flag has been successfully saved into disk.

This patch fixes the above case.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index 394c46c917f13a41855d5f4a63649e6d68ac6b66..e557ec875d38d84ec5d4b8dce22ddecf64cdeaa2 100644 (file)
@@ -4880,12 +4880,6 @@ int BlueStore::mkfs()
     }
   }
 
-  // indicate success by writing the 'mkfs_done' file
-  r = write_meta("mkfs_done", "yes");
-  if (r < 0)
-    goto out_close_alloc;
-  dout(10) << __func__ << " success" << dendl;
-
  out_close_alloc:
   _close_alloc();
  out_close_fm:
@@ -4909,8 +4903,16 @@ int BlueStore::mkfs()
       r = -EIO;
     }
   }
+
+  if (r == 0) {
+    // indicate success by writing the 'mkfs_done' file
+    r = write_meta("mkfs_done", "yes");
+  }
+
   if (r < 0) {
     derr << __func__ << " failed, " << cpp_strerror(r) << dendl;
+  } else {
+    dout(0) << __func__ << " success" << dendl;
   }
   return r;
 }