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>
}
}
- // 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:
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;
}