Bug fixes

This commit is contained in:
2025-11-15 10:38:45 +01:00
parent a11740ab41
commit a366b46398
4 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ static int store_chunk(ChunkStore *store, string data, SHA256 *hash)
// This is okay as long as we check that the hash
// is correct while reading back the data.
Handle fd;
if (file_open(path, &fd) < 0)
if (file_open(path, &fd) < 0) // TODO: open in overwrite mode
return -1;
int copied = 0;
while (copied < data.len) {
+4 -6
View File
@@ -292,12 +292,8 @@ static int get_chunk_server(MouseFS *mfs, Address *addrs, int num_addrs, ByteQue
if (!have_insertection(addrs, num_addrs, mfs->chunk_servers[i].addrs, mfs->chunk_servers[i].num_addrs))
continue;
// It's possible that this chunk server's connection
// was dropped but we still didn't process the DISCONNECT
// event.
int conn_idx = tcp_index_from_tag(&mfs->tcp, found);
if (conn_idx < 0)
continue;
int conn_idx = tcp_index_from_tag(&mfs->tcp, i);
assert(conn_idx > -1);
if (output)
*output = tcp_output_buffer(&mfs->tcp, conn_idx);
@@ -1252,6 +1248,8 @@ static void process_event_for_write(MouseFS *mfs,
return;
}
mfs->operations[opidx].hashes[i] = hash;
uint32_t num_holders;
if (!binary_read(&reader, &num_holders, sizeof(num_holders))) {
mfs->operations[opidx].result = (MouseFS_Result) { .type=MOUSEFS_RESULT_WRITE_ERROR };
+2
View File
@@ -798,6 +798,8 @@ static int process_chunk_server_sync(MetadataServer *state,
if (!file_tree_uses_hash(&state->file_tree, hash))
continue;
// TODO: execution never reaches this point for some reason
// If the chunk is properly replicated or under-replicated,
// add it to the ms_add_list.