btrfs: reset compression level for lzo on remount
authorMarcos Paulo de Souza <mpdesouza@suse.com>
Mon, 3 Aug 2020 19:55:01 +0000 (16:55 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:39 +0000 (11:29 +0200)
commit204ed5f3f628166d4eea59e87c8197d68bb62096
tree6b6e978a7b362227fdbcb4d8507093e4f17e222b
parentb4cbbc1305f0cb0a70adb47d026619fad3f4d9cb
btrfs: reset compression level for lzo on remount

commit 282dd7d7718444679b046b769d872b188818ca35 upstream.

Currently a user can set mount "-o compress" which will set the
compression algorithm to zlib, and use the default compress level for
zlib (3):

  relatime,compress=zlib:3,space_cache

If the user remounts the fs using "-o compress=lzo", then the old
compress_level is used:

  relatime,compress=lzo:3,space_cache

But lzo does not expose any tunable compression level. The same happens
if we set any compress argument with different level, also with zstd.

Fix this by resetting the compress_level when compress=lzo is
specified.  With the fix applied, lzo is shown without compress level:

  relatime,compress=lzo,space_cache

CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/super.c