From: Zygo Blaxell Date: Sun, 29 Jun 2025 20:30:03 +0000 (-0400) Subject: tempfile: clear FS_NOCOW_FL while setting FS_COMPR_FL X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4039ef229e5fcbfa34dfee2fd601073e5005a5b7;p=bees 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 --- diff --git a/src/bees.cc b/src/bees.cc index bf58d257..e13b035d 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);