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 <xie.xingguo@zte.com.cn>
This commit is contained in:
xie xingguo 2017-05-23 22:00:35 +08:00
parent 2839052174
commit 58291dd69c

View 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;
}