]> git.hungrycats.org Git - bees/commitdiff
tempfile: clear FS_NOCOW_FL while setting FS_COMPR_FL
authorZygo Blaxell <bees@furryterror.org>
Sun, 29 Jun 2025 20:30:03 +0000 (16:30 -0400)
committerZygo Blaxell <bees@furryterror.org>
Mon, 30 Jun 2025 03:24:55 +0000 (23:24 -0400)
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>
src/bees.cc

index bf58d25795530c15d5bcc8315479ef887d8d78c0..e13b035db983d4d4df2a9af8d25d393650bdee69 100644 (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);