]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
btrfs: property: Set incompat flag if lzo/zstd compression is set
authorMisono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Tue, 15 May 2018 07:51:26 +0000 (16:51 +0900)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 Aug 2018 10:27:39 +0000 (12:27 +0200)
commit84013bd8bb1bb67f3a86de87db39b6085e0df18c
tree14a2d176f68513976ca17044006c7c84b797b9c9
parentc25e026119e8030fed261fae0f3106ba003acd95
btrfs: property: Set incompat flag if lzo/zstd compression is set

BugLink: http://bugs.launchpad.net/bugs/1782846
commit 1a63c198ddb810c790101d693c7071cca703b3c7 upstream.

Incompat flag of LZO/ZSTD compression should be set at:

 1. mount time (-o compress/compress-force)
 2. when defrag is done
 3. when property is set

Currently 3. is missing and this commit adds this.

This could lead to a filesystem that uses ZSTD but is not marked as
such. If a kernel without a ZSTD support encounteres a ZSTD compressed
extent, it will handle that but this could be confusing to the user.

Typically the filesystem is mounted with the ZSTD option, but the
discrepancy can arise when a filesystem is never mounted with ZSTD and
then the property on some file is set (and some new extents are
written). A simple mount with -o compress=zstd will fix that up on an
unpatched kernel.

Same goes for LZO, but this has been around for a very long time
(2.6.37) so it's unlikely that a pre-LZO kernel would be used.

Fixes: 5c1aab1dd544 ("btrfs: Add zstd support")
CC: stable@vger.kernel.org # 4.14+
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ add user visible impact ]
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/btrfs/props.c