]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
btrfs: clarify error returns values in __load_free_space_cache
authorZhihao Cheng <chengzhihao1@huawei.com>
Fri, 20 Nov 2020 01:08:04 +0000 (09:08 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Apr 2021 16:31:28 +0000 (18:31 +0200)
commit3229267b2c6b63dd38ed1d414f600cce5462bdf8
tree48172edadd348286568215454cf468c9750d3ccf
parent1c628d15d1473054716fd4424e64000aaced0827
btrfs: clarify error returns values in __load_free_space_cache

BugLink: https://bugs.launchpad.net/bugs/1918974
[ Upstream commit 3cc64e7ebfb0d7faaba2438334c43466955a96e8 ]

Return value in __load_free_space_cache is not properly set after
(unlikely) memory allocation failures and 0 is returned instead.
This is not a problem for the caller load_free_space_cache because only
value 1 is considered as 'cache loaded' but for clarity it's better
to set the errors accordingly.

Fixes: a67509c30079 ("Btrfs: add a io_ctl struct and helpers for dealing with the space cache")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
fs/btrfs/free-space-cache.c