forked from vitalif/vitastor
Explicitly print errors about -EAGAIN in io_uring
parent
5464821fa5
commit
552e207d2b
|
@ -35,24 +35,14 @@ journal_flusher_co::journal_flusher_co()
|
||||||
{
|
{
|
||||||
bs->live = true;
|
bs->live = true;
|
||||||
if (data->res != data->iov.iov_len)
|
if (data->res != data->iov.iov_len)
|
||||||
{
|
bs->disk_error_abort("read operation during flush", data->res, data->iov.iov_len);
|
||||||
throw std::runtime_error(
|
|
||||||
"data read operation failed during flush ("+std::to_string(data->res)+" != "+std::to_string(data->iov.iov_len)+
|
|
||||||
"). can't continue, sorry :-("
|
|
||||||
);
|
|
||||||
}
|
|
||||||
wait_count--;
|
wait_count--;
|
||||||
};
|
};
|
||||||
simple_callback_w = [this](ring_data_t* data)
|
simple_callback_w = [this](ring_data_t* data)
|
||||||
{
|
{
|
||||||
bs->live = true;
|
bs->live = true;
|
||||||
if (data->res != data->iov.iov_len)
|
if (data->res != data->iov.iov_len)
|
||||||
{
|
bs->disk_error_abort("write operation during flush", data->res, data->iov.iov_len);
|
||||||
throw std::runtime_error(
|
|
||||||
"write operation failed ("+std::to_string(data->res)+" != "+std::to_string(data->iov.iov_len)+
|
|
||||||
"). state "+std::to_string(wait_state)+". in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
wait_count--;
|
wait_count--;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -676,3 +676,16 @@ void blockstore_impl_t::dump_diagnostics()
|
||||||
journal.dump_diagnostics();
|
journal.dump_diagnostics();
|
||||||
flusher->dump_diagnostics();
|
flusher->dump_diagnostics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void blockstore_impl_t::disk_error_abort(const char *op, int retval, int expected)
|
||||||
|
{
|
||||||
|
if (retval == -EAGAIN)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "EAGAIN error received from a disk %s during flush."
|
||||||
|
" It must never happen with io_uring and indicates a kernel bug."
|
||||||
|
" Please upgrade your kernel. Aborting.\n", op);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
fprintf(stderr, "Disk %s failed: result is %d, expected %d. Can't continue, sorry :-(\n", op, retval, expected);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
|
@ -292,6 +292,7 @@ class blockstore_impl_t
|
||||||
// Journaling
|
// Journaling
|
||||||
void prepare_journal_sector_write(int sector, blockstore_op_t *op);
|
void prepare_journal_sector_write(int sector, blockstore_op_t *op);
|
||||||
void handle_journal_write(ring_data_t *data, uint64_t flush_id);
|
void handle_journal_write(ring_data_t *data, uint64_t flush_id);
|
||||||
|
void disk_error_abort(const char *op, int retval, int expected);
|
||||||
|
|
||||||
// Asynchronous init
|
// Asynchronous init
|
||||||
int initialized;
|
int initialized;
|
||||||
|
|
|
@ -198,10 +198,7 @@ void blockstore_impl_t::handle_journal_write(ring_data_t *data, uint64_t flush_i
|
||||||
if (data->res != data->iov.iov_len)
|
if (data->res != data->iov.iov_len)
|
||||||
{
|
{
|
||||||
// FIXME: our state becomes corrupted after a write error. maybe do something better than just die
|
// FIXME: our state becomes corrupted after a write error. maybe do something better than just die
|
||||||
throw std::runtime_error(
|
disk_error_abort("journal write", data->res, data->iov.iov_len);
|
||||||
"journal write failed ("+std::to_string(data->res)+" != "+std::to_string(data->iov.iov_len)+
|
|
||||||
"). in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
auto fl_it = journal.flushing_ops.upper_bound((pending_journaling_t){ .flush_id = flush_id });
|
auto fl_it = journal.flushing_ops.upper_bound((pending_journaling_t){ .flush_id = flush_id });
|
||||||
if (fl_it != journal.flushing_ops.end() && fl_it->flush_id == flush_id)
|
if (fl_it != journal.flushing_ops.end() && fl_it->flush_id == flush_id)
|
||||||
|
|
|
@ -586,10 +586,7 @@ void blockstore_impl_t::handle_write_event(ring_data_t *data, blockstore_op_t *o
|
||||||
if (data->res != data->iov.iov_len)
|
if (data->res != data->iov.iov_len)
|
||||||
{
|
{
|
||||||
// FIXME: our state becomes corrupted after a write error. maybe do something better than just die
|
// FIXME: our state becomes corrupted after a write error. maybe do something better than just die
|
||||||
throw std::runtime_error(
|
disk_error_abort("data write", data->res, data->iov.iov_len);
|
||||||
"write operation failed ("+std::to_string(data->res)+" != "+std::to_string(data->iov.iov_len)+
|
|
||||||
"). in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
PRIV(op)->pending_ops--;
|
PRIV(op)->pending_ops--;
|
||||||
assert(PRIV(op)->pending_ops >= 0);
|
assert(PRIV(op)->pending_ops >= 0);
|
||||||
|
|
Loading…
Reference in New Issue