From: Sage Weil Date: Sat, 19 May 2012 22:23:49 +0000 (-0700) Subject: filestore: create but do not clobber current/commit_op_seq X-Git-Tag: v0.48argonaut~151^2~26^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b7a85a8f7729f55a462695d685800ab703aef961;p=ceph.git filestore: create but do not clobber current/commit_op_seq If it exists, preserve its value. Otherwise, create and set it to 1. Signed-off-by: Sage Weil --- diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 7bcd0b4b1c8..15e887d1f1f 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -979,19 +979,21 @@ int FileStore::mkfs() // write initial op_seq { - uint64_t initial_seq; + uint64_t initial_seq = 0; int fd = read_op_seq(&initial_seq); if (fd < 0) { derr << "mkfs: failed to create " << current_op_seq_fn << ": " << cpp_strerror(fd) << dendl; goto close_fsid_fd; } - int err = write_op_seq(fd, 1); - if (err < 0) { - TEMP_FAILURE_RETRY(::close(fd)); - derr << "mkfs: failed to write to " << current_op_seq_fn << ": " - << cpp_strerror(err) << dendl; - goto close_fsid_fd; + if (initial_seq == 0) { + int err = write_op_seq(fd, 1); + if (err < 0) { + TEMP_FAILURE_RETRY(::close(fd)); + derr << "mkfs: failed to write to " << current_op_seq_fn << ": " + << cpp_strerror(err) << dendl; + goto close_fsid_fd; + } } TEMP_FAILURE_RETRY(::close(fd)); }