return snprintf(s, len, "%s/current/%s", basedir.c_str(), cid_str.c_str());
}
+void FileStore::handle_eio()
+{
+ // don't try to map this back to an offset; too hard since there is
+ // a file system in between. we also don't really know whether this
+ // was a read or a write, since we have so many layers beneath us.
+ // don't even try.
+ note_io_error_event(devname.c_str(), basedir.c_str(), -EIO, 0, 0, 0);
+ ceph_abort_msg("unexpected eio error");
+}
+
int FileStore::get_index(const coll_t& cid, Index *index)
{
int r = index_manager.get_index(cid, basedir, index);
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
char path[PATH_MAX];
get_cdir(cid, path, sizeof(path));
int r = index_manager.init_index(cid, path, target_version);
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
ceph_assert(index.index);
r = (index.index)->lookup(oid, path, &exist);
if (r < 0) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
if (!exist)
ceph_assert(rc >= 0);
}
lfn_close(fd);
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
((*index).index)->access_lock.put_write();
}
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
r = index_old->lookup(o, &path_old, &exist);
if (r < 0) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
if (!exist)
r = index_new->lookup(newoid, &path_new, &exist);
if (r < 0) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
if (exist)
r = index_new->created(newoid, path_new->path());
if (r < 0) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
} else {
r = index_old->lookup(o, &path_old, &exist);
if (r < 0) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
if (!exist)
r = index_new->lookup(newoid, &path_new, &exist);
if (r < 0) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
if (exist)
r = index_new->created(newoid, path_new->path());
if (r < 0) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
}
int hardlink;
r = index->lookup(o, &path, &hardlink);
if (r < 0) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
r = object_map->clear(o, &spos);
if (r < 0 && r != -ENOENT) {
dout(25) << __FUNC__ << ": omap clear failed " << cpp_strerror(r) << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
if (cct->_conf->filestore_debug_inject_read_err) {
}
if (::statfs(basedir.c_str(), &buf) < 0) {
int r = -errno;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
ceph_assert(r != -ENOENT);
return r;
}
int op_fd = ::open(current_op_seq_fn.c_str(), O_CREAT|O_RDWR|O_CLOEXEC, 0644);
if (op_fd < 0) {
int r = -errno;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
char s[40];
int r = chain_fgetxattr(fd, GLOBAL_REPLAY_GUARD_XATTR, buf, sizeof(buf));
if (r < 0) {
dout(20) << __FUNC__ << ": no xattr" << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
VOID_TEMP_FAILURE_RETRY(::close(fd));
return 1; // no xattr
}
int r = chain_fgetxattr(fd, REPLAY_GUARD_XATTR, buf, sizeof(buf));
if (r < 0) {
dout(20) << __FUNC__ << ": no xattr" << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return 1; // no xattr
}
bufferlist bl;
done:
dout(10) << __FUNC__ << ": " << cid << "/" << oid << " " << offset << "~" << len << " = " << r << " num_extents=" << destmap.size() << " " << destmap << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
tracepoint(objectstore, fiemap_exit, r);
return r;
}
lfn_close(o);
out2:
dout(10) << __FUNC__ << ": " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " = " << r << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
}
out:
dout(10) << __FUNC__ << ": " << cid << "/" << oid << " '" << name << "' = " << r << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
if (cct->_conf->filestore_debug_inject_read_err &&
debug_mdata_eio(oid)) {
return -EIO;
}
out:
dout(10) << __FUNC__ << ": " << cid << "/" << oid << " = " << r << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
if (cct->_conf->filestore_debug_inject_read_err &&
debug_mdata_eio(oid)) {
r = _fgetattrs(**fd, inline_set);
incomplete_inline = (r == -E2BIG);
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
dout(15) << __FUNC__ << ": " << cid << "/" << oid
<< (incomplete_inline ? " (incomplete_inline, forcing omap)" : "")
<< dendl;
r = object_map->remove_xattrs(oid, omap_remove, &spos);
if (r < 0 && r != -ENOENT) {
dout(10) << __FUNC__ << ": could not remove_xattrs r = " << r << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
goto out_close;
} else {
r = 0; // don't confuse the debug output
r = object_map->set_xattrs(oid, omap_set, &spos);
if (r < 0) {
dout(10) << __FUNC__ << ": could not set_xattrs r = " << r << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
goto out_close;
}
}
r = object_map->remove_xattrs(oid, to_remove, &spos);
if (r < 0 && r != -ENOENT) {
dout(10) << __FUNC__ << ": could not remove_xattrs index r = " << r << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
goto out_close;
}
}
r = object_map->get_all_xattrs(oid, &omap_attrs);
if (r < 0 && r != -ENOENT) {
dout(10) << __FUNC__ << ": could not get omap_attrs r = " << r << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
goto out_close;
}
r = object_map->remove_xattrs(oid, omap_attrs, &spos);
if (!dir) {
r = -errno;
derr << "tried opening directory " << fn << ": " << cpp_strerror(-r) << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
if (r < 0) {
r = -errno;
derr << "stat on " << filename << ": " << cpp_strerror(-r) << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
break;
}
if (!S_ISDIR(sb.st_mode)) {
}
::closedir(dir);
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
tracepoint(objectstore, list_collections_exit, r);
return r;
}
if (r < 0)
r = -errno;
dout(10) << __FUNC__ << ": " << fn << " = " << r << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
tracepoint(objectstore, collection_stat_exit, r);
return r;
}
if (r < 0) {
derr << __FUNC__ << ": collection_list_partial returned: "
<< cpp_strerror(r) << dendl;
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
*empty = ls.empty();
r = index->collection_list_partial(start, end, max, ls, next);
if (r < 0) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
dout(20) << "objects: " << *ls << dendl;
}
r = object_map->get(hoid, header, out);
if (r < 0 && r != -ENOENT) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
tracepoint(objectstore, omap_get_exit, 0);
}
r = object_map->get_keys(hoid, keys);
if (r < 0 && r != -ENOENT) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
tracepoint(objectstore, omap_get_keys_exit, 0);
}
r = object_map->get_values(hoid, keys, out);
if (r < 0 && r != -ENOENT) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
where = " (get_values)";
goto out;
}
}
r = object_map->check_keys(hoid, keys, out);
if (r < 0 && r != -ENOENT) {
- ceph_assert(!m_filestore_fail_eio || r != -EIO);
+ if (r == -EIO && m_filestore_fail_eio) handle_eio();
return r;
}
tracepoint(objectstore, omap_check_keys_exit, 0);