Try this:

    touch test
    chattr +C test
    lsattr test
    mv test test2
    lsattr test2

The original file (test) will have the C flag but when renamed the
flag disappears. If the volume is unmounted and then mounted again the
flag reappears. However, if the file is modified in any way after the
renaming but before the umount/mount then even weirder things happen,
eg:

    touch test
    chattr +C test
    head -c1048576 /dev/zero >> test
    lsattr test
    # the C flag exists and the file does not COW when modified as expected
    mv test test2
    lsattr test2
    # now the C flag disappeared
    # if you modify the file it will COW and the flag will not
reappear after umount/mount

even worse, if you try to use BTRFS_IOC_CLONE to clone test2 to a
non-COW file with eg

    cp --reflink test2 test3

it will fail with EINVAL as if the file test2 had the COW flag.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to