forked from vitalif/vitastor
Check result to be equal to iov_len
parent
d9d6a4f9c4
commit
e40a71b2ce
|
@ -24,9 +24,12 @@ journal_flusher_co::journal_flusher_co()
|
||||||
wait_state = 0;
|
wait_state = 0;
|
||||||
simple_callback = [this](ring_data_t* data)
|
simple_callback = [this](ring_data_t* data)
|
||||||
{
|
{
|
||||||
if (data->res < 0)
|
if (data->res != data->iov.iov_len)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("write operation failed. in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111");
|
throw std::runtime_error(
|
||||||
|
"write operation failed ("+std::to_string(data->res)+" != "+std::to_string(data->iov.iov_len)+
|
||||||
|
"). in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
wait_count--;
|
wait_count--;
|
||||||
};
|
};
|
||||||
|
@ -243,9 +246,12 @@ resume_0:
|
||||||
data->iov = (struct iovec){ meta_it->second.buf, 512 };
|
data->iov = (struct iovec){ meta_it->second.buf, 512 };
|
||||||
data->callback = [this](ring_data_t* data)
|
data->callback = [this](ring_data_t* data)
|
||||||
{
|
{
|
||||||
if (data->res < 0)
|
if (data->res != data->iov.iov_len)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("write operation failed. in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111");
|
throw std::runtime_error(
|
||||||
|
"write operation failed ("+std::to_string(data->res)+" != "+std::to_string(data->iov.iov_len)+
|
||||||
|
"). in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
meta_it->second.state = 1;
|
meta_it->second.state = 1;
|
||||||
wait_count--;
|
wait_count--;
|
||||||
|
|
|
@ -7,7 +7,7 @@ blockstore_init_meta::blockstore_init_meta(blockstore *bs)
|
||||||
|
|
||||||
void blockstore_init_meta::handle_event(ring_data_t *data)
|
void blockstore_init_meta::handle_event(ring_data_t *data)
|
||||||
{
|
{
|
||||||
if (data->res < 0)
|
if (data->res <= 0)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
std::string("read metadata failed at offset ") + std::to_string(metadata_read) +
|
std::string("read metadata failed at offset ") + std::to_string(metadata_read) +
|
||||||
|
@ -29,6 +29,8 @@ int blockstore_init_meta::loop()
|
||||||
if (!metadata_buffer)
|
if (!metadata_buffer)
|
||||||
{
|
{
|
||||||
metadata_buffer = (uint8_t*)memalign(512, 2*bs->metadata_buf_size);
|
metadata_buffer = (uint8_t*)memalign(512, 2*bs->metadata_buf_size);
|
||||||
|
if (!metadata_buffer)
|
||||||
|
throw std::bad_alloc();
|
||||||
}
|
}
|
||||||
if (!submitted)
|
if (!submitted)
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,7 +144,7 @@ int blockstore::dequeue_read(blockstore_operation *read_op)
|
||||||
void blockstore::handle_read_event(ring_data_t *data, blockstore_operation *op)
|
void blockstore::handle_read_event(ring_data_t *data, blockstore_operation *op)
|
||||||
{
|
{
|
||||||
op->pending_ops--;
|
op->pending_ops--;
|
||||||
if (data->res < 0)
|
if (data->res != data->iov.iov_len)
|
||||||
{
|
{
|
||||||
// read error
|
// read error
|
||||||
op->retval = data->res;
|
op->retval = data->res;
|
||||||
|
|
|
@ -107,9 +107,12 @@ int blockstore::dequeue_stable(blockstore_operation *op)
|
||||||
|
|
||||||
void blockstore::handle_stable_event(ring_data_t *data, blockstore_operation *op)
|
void blockstore::handle_stable_event(ring_data_t *data, blockstore_operation *op)
|
||||||
{
|
{
|
||||||
if (data->res < 0)
|
if (data->res != data->iov.iov_len)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("write operation failed. in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111");
|
throw std::runtime_error(
|
||||||
|
"write operation failed ("+std::to_string(data->res)+" != "+std::to_string(data->iov.iov_len)+
|
||||||
|
"). in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
op->pending_ops--;
|
op->pending_ops--;
|
||||||
if (op->pending_ops == 0)
|
if (op->pending_ops == 0)
|
||||||
|
|
|
@ -111,9 +111,12 @@ int blockstore::continue_sync(blockstore_operation *op)
|
||||||
|
|
||||||
void blockstore::handle_sync_event(ring_data_t *data, blockstore_operation *op)
|
void blockstore::handle_sync_event(ring_data_t *data, blockstore_operation *op)
|
||||||
{
|
{
|
||||||
if (data->res < 0)
|
if (data->res < data->iov.iov_len)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("write operation failed. in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111");
|
throw std::runtime_error(
|
||||||
|
"write operation failed ("+std::to_string(data->res)+" != "+std::to_string(data->iov.iov_len)+
|
||||||
|
"). in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
op->pending_ops--;
|
op->pending_ops--;
|
||||||
if (op->pending_ops == 0)
|
if (op->pending_ops == 0)
|
||||||
|
|
|
@ -96,6 +96,7 @@ int blockstore::dequeue_write(blockstore_operation *op)
|
||||||
vcnt = 1;
|
vcnt = 1;
|
||||||
op->iov_zerofill[0] = (struct iovec){ op->buf, op->len };
|
op->iov_zerofill[0] = (struct iovec){ op->buf, op->len };
|
||||||
}
|
}
|
||||||
|
data->iov.iov_len = op->len; // to check it in the callback
|
||||||
data->callback = cb;
|
data->callback = cb;
|
||||||
my_uring_prep_writev(
|
my_uring_prep_writev(
|
||||||
sqe, data_fd, op->iov_zerofill, vcnt, data_offset + (loc << block_order)
|
sqe, data_fd, op->iov_zerofill, vcnt, data_offset + (loc << block_order)
|
||||||
|
@ -150,10 +151,13 @@ int blockstore::dequeue_write(blockstore_operation *op)
|
||||||
|
|
||||||
void blockstore::handle_write_event(ring_data_t *data, blockstore_operation *op)
|
void blockstore::handle_write_event(ring_data_t *data, blockstore_operation *op)
|
||||||
{
|
{
|
||||||
if (data->res < 0)
|
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("write operation failed. in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111");
|
throw std::runtime_error(
|
||||||
|
"write operation failed ("+std::to_string(data->res)+" != "+std::to_string(data->iov.iov_len)+
|
||||||
|
"). in-memory state is corrupted. AAAAAAAaaaaaaaaa!!!111"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
op->pending_ops--;
|
op->pending_ops--;
|
||||||
if (op->pending_ops == 0)
|
if (op->pending_ops == 0)
|
||||||
|
|
Loading…
Reference in New Issue