Repository navigation
lklfuse: fix lost appends on FreeBSD - #654
chrislongros wants to merge 2 commits into
Conversation
FreeBSD's fusefs reads the old block before a partial write. On a file opened O_WRONLY the read fails with EBADF and the write is lost. Open such files with O_RDWR instead. Signed-off-by: Christos Longros <longros@FreeBSD.org>
|
Thanks for the fix, this looks good to me! Could you also add a small write + append check to Minor nit: the PR description also mentions |
lklfuse_basic only creates and removes empty files. Write to a file, append to it and check the content, so that the FreeBSD CI job covers appends. Signed-off-by: Christos Longros <longros@FreeBSD.org>
I cleaned up the PR body and added a simple test that covers a write and append check. |
On FreeBSD, appending to a file on an lklfuse mount loses the data. This affects ext4, xfs, btrfs and vfat. Linux remains unaffected.
O_WRONLYinside LKL, so the read fails with EBADF and the write is lost. The patch modifies the open flag asO_RDWRfor FreeBSD.Tested on FreeBSD 16.0-CURRENT and 15.1 with both fixes applied to lkl 6.12: The files written through lklfuse on ext4, xfs and btrfs read back identical, and the images pass fsck on Linux.
A second commit introduces a simple FreeBSD CI test for writing and appending into a file.
P.S.: I came across this while trying to update the FreeBSD port of lklfuse, which is stuck on kernel 4.16.