Skip to content

Commit

Permalink
Merge pull request #1517 from stgraber/main
Browse files Browse the repository at this point in the history
incusd/storage/drivers: Log on blkdiscard failure
  • Loading branch information
hallyn authored Dec 16, 2024
2 parents ed2def1 + 82abc25 commit 4e9849d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/server/storage/drivers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,10 @@ func clearDiskData(diskPath string, disk *os.File) error {
if linux.IsBlockdev(st.Mode()) {
// If dealing with a block device, attempt to discard its current content.
// This saves space and avoids issues with leaving zero blocks to their original value.
_, _ = subprocess.RunCommand("blkdiscard", "-f", diskPath)
_, err = subprocess.RunCommand("blkdiscard", "-f", diskPath)
if err != nil {
logger.Debugf("Unable to clear disk data on %q: %v", diskPath, err)
}
} else {
// Otherwise truncate the file.
err = disk.Truncate(0)
Expand Down

0 comments on commit 4e9849d

Please sign in to comment.