]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: fix miscounted block limit in f2fs_statfs_project()
authorChengguang Xu <cgxu519@mykernel.net>
Sat, 4 Jan 2020 14:20:03 +0000 (22:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:34:03 +0000 (04:34 -0800)
commit acdf2172172a511f97fa21ed0ee7609a6d3b3a07 upstream.

statfs calculates Total/Used/Avail disk space in block unit,
so we should translate soft/hard prjquota limit to block unit
as well.

Below testing result shows the block/inode numbers of
Total/Used/Avail from df command are all correct afer
applying this patch.

[root@localhost quota-tools]\# ./repquota -P /dev/sdb1

fs/f2fs/super.c

index 662c7de58b9906f501f6b622177f8d8160e37eae..379933da5c8584d13a9d23e01245231b3cd4bc34 100644 (file)
@@ -1154,6 +1154,8 @@ static int f2fs_statfs_project(struct super_block *sb,
        if (dquot->dq_dqb.dqb_bhardlimit &&
                        (!limit || dquot->dq_dqb.dqb_bhardlimit < limit))
                limit = dquot->dq_dqb.dqb_bhardlimit;
+       if (limit)
+               limit >>= sb->s_blocksize_bits;
 
        if (limit && buf->f_blocks > limit) {
                curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits;