summaryrefslogtreecommitdiff
path: root/fs/sysv
diff options
context:
space:
mode:
authorChen Zhongjin <chenzhongjin@huawei.com>2022-12-09 13:04:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-14 12:15:22 +0300
commitad4842634d6819994c567073f9fb43bd5c9b1ee9 (patch)
treee7e55e660ab0f86dd076a66bc7d091e8c1a05d79 /fs/sysv
parent6f8ef1de8c655c5622f7d239d99a8a081a0f4f0b (diff)
downloadlinux-ad4842634d6819994c567073f9fb43bd5c9b1ee9.tar.xz
fs: sysv: Fix sysv_nblocks() returns wrong value
[ Upstream commit e0c49bd2b4d3cd1751491eb2d940bce968ac65e9 ] sysv_nblocks() returns 'blocks' rather than 'res', which only counting the number of triple-indirect blocks and causing sysv_getattr() gets a wrong result. [AV: this is actually a sysv counterpart of minixfs fix - 0fcd426de9d0 "[PATCH] minix block usage counting fix" in historical tree; mea culpa, should've thought to check fs/sysv back then...] Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/sysv')
-rw-r--r--fs/sysv/itree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index bcb67b0cabe7..31f66053e239 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -438,7 +438,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size)
res += blocks;
direct = 1;
}
- return blocks;
+ return res;
}
int sysv_getattr(const struct path *path, struct kstat *stat,