Skip to content

Commit

Permalink
storage: Fix direct I/O write check (#14164)
Browse files Browse the repository at this point in the history
Follow up on #14157
  • Loading branch information
tomponline authored Sep 26, 2024
2 parents f49b5d7 + f2c1a20 commit 85392b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lxd/storage/drivers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ func copyDevice(inputPath string, outputPath string) error {
_ = from.Close()
}

to, err := os.OpenFile(outputPath, unix.O_DIRECT|unix.O_RDONLY, 0)
to, err := os.OpenFile(outputPath, unix.O_DIRECT|unix.O_WRONLY, 0)
if err == nil {
cmd = append(cmd, "oflag=direct")
_ = to.Close()
Expand Down
2 changes: 1 addition & 1 deletion lxd/storage/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ func ImageUnpack(imageFile string, vol drivers.Volume, destBlockFile string, sys
_ = from.Close()
}

to, err := os.OpenFile(dstPath, unix.O_DIRECT|unix.O_RDONLY, 0)
to, err := os.OpenFile(dstPath, unix.O_DIRECT|unix.O_WRONLY, 0)
if err == nil {
cmd = append(cmd, "-t", "none")
_ = to.Close()
Expand Down

0 comments on commit 85392b1

Please sign in to comment.