zipl/src: Prepare for global sync(2) removal

zipl tool calls sync(2) before exit, which may hang on attempts to
flush not relevant problematic mounts (e.g. nfs) [1].

Complete any modification performed by zipl(8) tool with calling
fsync(2), or syncfs(2). This allows to get rid of the mentioned
sync(2) call.

[1] https://github.com/openshift/os/issues/1720
Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/186
Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Eduard Shishkin
2025-05-16 14:24:24 +02:00
committed by Jan Höppner
parent 06e0d569f1
commit 95e4b3413a
4 changed files with 41 additions and 5 deletions
+10
View File
@@ -131,6 +131,16 @@ int misc_open_device(const char *filename, struct misc_fd *mfd, int simulate)
return mfd->fd;
}
int misc_fsync(struct misc_fd *mfd, const char *filename)
{
if (fsync(mfd->fd)) {
error_reason(strerror(errno));
error_text("Could not sync file '%s'", filename);
return -1;
}
return 0;
}
/* Read COUNT bytes of data from file identified by file descriptor FD to
* memory at location BUFFER. Return 0 when all bytes were successfully read,
* non-zero otherwise. */