summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@mykernel.net>2020-01-04 22:20:03 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-11 04:35:24 -0800
commitb1de9ec0e78866b252a32fee126af22ec8d42603 (patch)
treedacb9ec52d5bc3fcc1d66ecb4709e421db8e3c15 /fs/f2fs
parentae2cb41583a94cb9ca2cf209e03ad6d790a29c3c (diff)
downloadlinux-stable-b1de9ec0e78866b252a32fee126af22ec8d42603.tar.gz
linux-stable-b1de9ec0e78866b252a32fee126af22ec8d42603.tar.bz2
linux-stable-b1de9ec0e78866b252a32fee126af22ec8d42603.zip
f2fs: fix miscounted block limit in f2fs_statfs_project()
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
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/super.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a2af155567b8..3df83c1d374a 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1219,6 +1219,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;