Skip to content

Commit

Permalink
fusefrontend: disallow O_DIRECT and fall back to buffered IO
Browse files Browse the repository at this point in the history
O_DIRECT accesses must be aligned in both offset and length. Due to our
crypto header, alignment will be off, even if userspace makes aligned
accesses. Running xfstests generic/013 on ext4 used to trigger lots of
EINVAL errors due to missing alignment. Just fall back to buffered IO.
  • Loading branch information
rfjakob committed Jul 2, 2018
1 parent c51fc9e commit 893e411
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/fusefrontend/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ func (fs *FS) mangleOpenFlags(flags uint32) (newFlags int) {
}
// We also cannot open the file in append mode, we need to seek back for RMW
newFlags = newFlags &^ os.O_APPEND
// O_DIRECT accesses must be aligned in both offset and length. Due to our
// crypto header, alignment will be off, even if userspace makes aligned
// accesses. Running xfstests generic/013 on ext4 used to trigger lots of
// EINVAL errors due to missing alignment. Just fall back to buffered IO.
newFlags = newFlags &^ syscall.O_DIRECT

return newFlags
}
Expand Down

0 comments on commit 893e411

Please sign in to comment.