From: xie xingguo Date: Tue, 23 May 2017 14:00:35 +0000 (+0800) Subject: os/bluestore: save "mkfs_done" only if we pass fsck() tests X-Git-Tag: v12.1.0~10^2~1^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=58291dd69c2c41016a5de671c8fba6635c2f91eb;p=ceph.git os/bluestore: save "mkfs_done" only if we pass fsck() tests 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 394c46c917f1..e557ec875d38 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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; }