Skip to content

Commit

Permalink
mon, os: check the result of sync_filesystem.
Browse files Browse the repository at this point in the history
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
  • Loading branch information
majianpeng committed Jan 8, 2015
1 parent 397b261 commit 27cb78b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/mon/MonitorStore.cc
Expand Up @@ -437,7 +437,13 @@ void MonitorStore::put_bl_sn_map(const char *a,
derr << "failed to open " << dir << ": " << cpp_strerror(err) << dendl;
assert(0 == "failed to open temp file");
}
sync_filesystem(dirfd);

err = sync_filesystem(dirfd);
if (err < 0) {
derr << "sync_filesystem error " << cpp_strerror(err) << dendl;
assert(0 == "failed to sync_filesystem");
}

close_err = TEMP_FAILURE_RETRY(::close(dirfd));
assert (0 == close_err);

Expand Down Expand Up @@ -481,7 +487,13 @@ void MonitorStore::sync()
<< ": " << cpp_strerror(err) << dendl;
assert(0 == "failed to open dir for syncing");
}
sync_filesystem(dirfd);

int ret = sync_filesystem(dirfd);
if (ret < 0) {
derr << __func__ << " sync_filesystem error " << cpp_strerror(ret) << dendl;
assert(0 == "failed to sync_filesystem");
}

int close_err = TEMP_FAILURE_RETRY(::close(dirfd));
assert (0 == close_err);
}
6 changes: 5 additions & 1 deletion src/os/FileStore.cc
Expand Up @@ -2005,7 +2005,11 @@ void FileStore::_set_global_replay_guard(coll_t cid,
return;

// sync all previous operations on this sequencer
sync_filesystem(basedir_fd);
int ret = sync_filesystem(basedir_fd);
if (ret < 0) {
derr << __func__ << " :sync_filesytem error " << cpp_strerror(ret) << dendl;
assert(0 == "_set_global_replay_guard failed");
}

char fn[PATH_MAX];
get_cdir(cid, fn, sizeof(fn));
Expand Down

0 comments on commit 27cb78b

Please sign in to comment.