diff options
author | Sage Weil <sage@inktank.com> | 2012-05-19 15:23:49 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-05-22 17:24:10 -0700 |
commit | b7a85a8f7729f55a462695d685800ab703aef961 (patch) | |
tree | a33ba620fe94d15b7e95336bc06f6e54086a0fe1 /src/os | |
parent | 79d60770e869e56a6e053e9fc7a020fec8da18fb (diff) | |
download | ceph-b7a85a8f7729f55a462695d685800ab703aef961.tar.gz |
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 <sage@inktank.com>
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/FileStore.cc | 16 |
1 files changed, 9 insertions, 7 deletions
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)); } |