From 4039ef229e5fcbfa34dfee2fd601073e5005a5b7 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Sun, 29 Jun 2025 16:30:03 -0400 Subject: [PATCH] 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 --- src/bees.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bees.cc b/src/bees.cc index bf58d25..e13b035 100644 --- a/src/bees.cc +++ b/src/bees.cc @@ -547,6 +547,10 @@ BeesTempFile::BeesTempFile(shared_ptr 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);