Hello, With the journal, fsync did not wait for the file's metadata. diskfs_file_update writes the data and leaves the inode, size and block map to the journal, but nothing asked for a commit, so they stayed in the running transaction until kjournald's next commit, up to five seconds later. Creating files, running "sync FILE..." and killing the translator at once lost all of them.
The second patch makes a waiting file_sync commit the journal. It relies on the first, which makes diskfs_journal_commit_transaction also wait for the transaction already being committed: without it, the call could return before the caller's changes were on disk. The third is unrelated but small: the last journal state change made without the journal lock now takes it. Tested: 100 files created, synced with "sync FILE" and the translator killed with kill -9 right after; all of them survive the replay. Milos Milos Nikic (3): ext2fs: Make a journal commit wait for older transactions libdiskfs: Commit the journal on a waiting file_sync ext2fs: Set T_COMMITTED under the journal lock ext2fs/journal.c | 9 ++++++++- libdiskfs/file-sync.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) -- 2.56.0
