btrfs: fix upper limit for max_inline for page size 64K
authorAnand Jain <anand.jain@oracle.com>
Tue, 10 Aug 2021 15:23:44 +0000 (23:23 +0800)
committerDom Cobley <popcornmix@gmail.com>
Thu, 14 Oct 2021 11:32:53 +0000 (12:32 +0100)
commit621559e9933b2b4f1189f2358cfdfc31562e8584
tree81fe33ca58bc4b9b57d346b7e0124918b4c7300c
parent618efc1c50ca2105a58020dd4dbb190478b7a90b
btrfs: fix upper limit for max_inline for page size 64K

commit 6f93e834fa7c5faa0372e46828b4b2a966ac61d7 upstream.

The mount option max_inline ranges from 0 to the sectorsize (which is
now equal to page size). But we parse the mount options too early and
before the actual sectorsize is read from the superblock. So the upper
limit of max_inline is unaware of the actual sectorsize and is limited
by the temporary sectorsize 4096, even on a system where the default
sectorsize is 64K.

Fix this by reading the superblock sectorsize before the mount option
parse.

Reported-by: Alexander Tsvetkov <alexander.tsvetkov@oracle.com>
CC: stable@vger.kernel.org # 5.4+
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/disk-io.c