1
0
mirror of https://github.com/Zygo/bees.git synced 2025-07-01 16:22:27 +02:00

tempfile: clear FS_NOCOW_FL while setting FS_COMPR_FL

FS_NOCOW_FL can be inherited from the subvol root directory, and it
conflicts with FS_COMPR_FL.

We can only dedupe when FS_NOCOW_FL is the same on src and dst, which
means we can only dedupe when FS_NOCOW_FL is clear, so we should clear
FS_NOCOW_FL on the temporary files we create for dedupe.

Fixes: https://github.com/Zygo/bees/issues/314
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell
2025-06-29 16:30:03 -04:00
parent e9d4aa4586
commit 4039ef229e

View File

@ -547,6 +547,10 @@ BeesTempFile::BeesTempFile(shared_ptr<BeesContext> ctx) :
BEESTRACE("Getting FS_COMPR_FL on m_fd " << name_fd(m_fd));
int flags = ioctl_iflags_get(m_fd);
flags |= FS_COMPR_FL;
// Clear NOCOW because it conflicts with COMPR, and NOCOW could be set on the root subvol
flags &= FS_NOCOW_FL;
BEESTRACE("Setting FS_COMPR_FL on m_fd " << name_fd(m_fd) << " flags " << to_hex(flags));
ioctl_iflags_set(m_fd, flags);