lib/deploy: Round to block size in early prune space check
authorJonathan Lebon <jonathan@jlebon.com>
Thu, 4 Jan 2024 16:14:39 +0000 (11:14 -0500)
committerJonathan Lebon <jonathan@jlebon.com>
Thu, 4 Jan 2024 17:57:43 +0000 (12:57 -0500)
commit4982306e67f79260b1319f4acde03d1eb11d5060
tree1e984ea83576318c047f9068b8e86d3227f68448
parent40b143f494f50e46c736eedf002c20468816281c
lib/deploy: Round to block size in early prune space check

When we estimate how much space a new bootcsum dir will use, we
weren't accounting for the space overhead from files not using the
last filesystem block completely. This doesn't matter much if counting
a few files, but e.g. on FCOS aarch64, we include lots of small
devicetree blobs in the bootfs. That loss can add up to enough for the
`fallocate()` check to pass but copying still hitting `ENOSPC` later on.

I think a better fix here is to change approach entirely and instead
refactor `install_deployment_kernel()` so that we can call just the
copying bits of it as part of the early prune logic. We'll get a more
accurate assessment and it's not lost work since we won't need to
recopy later on. Also this would not require having to keep in sync the
estimator and the install bits.

That said, this is blocking FCOS releases, so I went with a more tactical
fix for now.

Fixes: https://github.com/coreos/fedora-coreos-tracker/issues/1637
src/libostree/ostree-sysroot-deploy.c
src/libotutil/ot-fs-utils.c
src/libotutil/ot-fs-utils.h
tests/kolainst/destructive/auto-prune.sh