]> Git Repo - linux.git/commitdiff
fs: sysv: Fix sysv_nblocks() returns wrong value
authorChen Zhongjin <[email protected]>
Fri, 9 Dec 2022 10:04:48 +0000 (18:04 +0800)
committerAl Viro <[email protected]>
Sat, 10 Dec 2022 19:13:37 +0000 (14:13 -0500)
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 <[email protected]>
Signed-off-by: Al Viro <[email protected]>
fs/sysv/itree.c

index d4ec9bb97de9541101057db5efb0de52fcef0cc6..3b8567564e7e4751e8b40fdd974aa9c9b75bd0e4 100644 (file)
@@ -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(struct user_namespace *mnt_userns, const struct path *path,
This page took 0.057035 seconds and 4 git commands to generate.