On Wed, Jun 12, 2019 at 03:14:11PM +0100, fdmanana@xxxxxxxxxx wrote:
> From: Filipe Manana <fdmanana@xxxxxxxx>
>
> After the recent series of cleanups in the properties and xattrs modules
> that landed in the 5.2 merge window, we ended up with a regression where
> after deleting the compression xattr property through the setflags ioctl,
> we don't set the BTRFS_INODE_COPY_EVERYTHING flag in the inode anymore.
> As a consequence, if the inode was fsync'ed when it had the compression
> property set, after deleting the compression property through the setflags
> ioctl and fsync'ing again the inode, the log will still contain the
> compression xattr, because the inode did not had that bit set, which
> made the fsync not delete all xattrs from the log and copy all xattrs
> from the subvolume tree to the log tree.
>
> This regression happens due to the fact that that series of cleanups
> made btrfs_set_prop() call the old function do_setxattr() (which is now
> named btrfs_setxattr()), and not the old version of btrfs_setxattr(),
> which is now called btrfs_setxattr_trans().
>
> Fix this by setting the BTRFS_INODE_COPY_EVERYTHING bit in the current
> btrfs_setxattr() function and remove it from everywhere else, including
> its setup at btrfs_ioctl_setflags(). This is cleaner, avoids similar
> regressions in the future, and centralizes the setup of the bit. After
> all, the need to setup this bit should only be in the xattrs module,
> since it is an implementation of xattrs.
>
> Fixes: 04e6863b19c722 ("btrfs: split btrfs_setxattr calls regarding transaction")
> Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
Queued for 5.2, thanks.