Skip to content

Commit 7ee307d

Browse files
pks-tgitster
authored andcommitted
reftable/stack: do not die when fsyncing lock file files
We use `fsync_component_or_die()` when committing an addition to the "tables.list" lock file, which unsurprisingly dies in case the fsync fails. Given that this is part of the reftable library, we should never die and instead let callers handle the error. Adapt accordingly and use `fsync_component()` instead. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 558f6fb commit 7ee307d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

reftable/stack.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,11 @@ int reftable_addition_commit(struct reftable_addition *add)
674674
goto done;
675675
}
676676

677-
fsync_component_or_die(FSYNC_COMPONENT_REFERENCE, lock_file_fd,
678-
get_tempfile_path(add->lock_file));
677+
err = fsync_component(FSYNC_COMPONENT_REFERENCE, lock_file_fd);
678+
if (err < 0) {
679+
err = REFTABLE_IO_ERROR;
680+
goto done;
681+
}
679682

680683
err = rename_tempfile(&add->lock_file, add->stack->list_file);
681684
if (err < 0) {

0 commit comments

Comments
 (0)