diff options
author | Samuel Just <samuel.just@dreamhost.com> | 2011-02-01 22:48:39 +0100 |
---|---|---|
committer | Samuel Just <samuel.just@dreamhost.com> | 2011-02-01 23:39:27 +0100 |
commit | ece4f61a8df4bed2c6d4d33f2979189f16721e4f (patch) | |
tree | 2967ac1073d6c4b6d85cf53c814fa8e9a4cfbb34 | |
parent | OSD: update_osd_stat take heartbeat_lock (diff) | |
download | ceph-ece4f61a8df4bed2c6d4d33f2979189f16721e4f.tar.xz ceph-ece4f61a8df4bed2c6d4d33f2979189f16721e4f.zip |
FileStore: fix double close
curr_fd is already closed if cp == cur_seq. This second close
occasionally ended up closing another thread's fd. The next open would
tend to grab that fd in op_fd or current_fd which would then get closed
by the other thread leaving op_fd or current_fd pointing to some random
file (or a closed descriptor).
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
-rw-r--r-- | src/os/FileStore.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index dbe782d95de..dc7845168f1 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -1052,7 +1052,8 @@ int FileStore::mount() int curr_fd = read_op_seq(current_op_seq_fn, &curr_seq); assert(curr_fd >= 0); - close(curr_fd); + ::close(curr_fd); + curr_fd = -1; dout(10) << "*** curr_seq=" << curr_seq << " cp=" << cp << dendl; if (cp != curr_seq && !g_conf.osd_use_stale_snap) { @@ -1109,14 +1110,13 @@ int FileStore::mount() dout(10) << "mount rolled back to consistent snap " << cp << dendl; snaps.pop_back(); - assert(curr_fd >= 0); if (cp != curr_seq) { curr_fd = read_op_seq(current_op_seq_fn, &curr_seq); /* we'll use the higher version from now on */ curr_seq = cp; write_op_seq(curr_fd, curr_seq); + ::close(curr_fd); } - close(curr_fd); } } |