提交 3f01bd91 编写于 作者: D Darrick J. Wong 提交者: Zheng Zengkai

xfs: flush inode inactivation work when compiling usage statistics

mainline-inclusion
from mainline-v5.14-rc4
commit 01e8f379
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4KIAO
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=01e8f379a4895a9a173391408db4fb49ec91e148

-------------------------------------------------

mainline-inclusion
from mainline-v5.14-rc4
commit 01e8f379
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4KIAO
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=01e8f379a4895a9a173391408db4fb49ec91e148

-------------------------------------------------

Users have come to expect that the space accounting information in
statfs and getquota reports are fairly accurate.  Now that we inactivate
inodes from a background queue, these numbers can be thrown off by
whatever resources are singly-owned by the inodes in the queue.  Flush
the pending inactivations when userspace asks for a space usage report.
Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
Signed-off-by: NLihong Kou <koulihong@huawei.com>
Reviewed-by: NZhang Yi <yi.zhang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 1510acf4
...@@ -481,6 +481,10 @@ xfs_qm_scall_getquota( ...@@ -481,6 +481,10 @@ xfs_qm_scall_getquota(
struct xfs_dquot *dqp; struct xfs_dquot *dqp;
int error; int error;
/* Flush inodegc work at the start of a quota reporting scan. */
if (id == 0)
xfs_inodegc_flush(mp);
/* /*
* Try to get the dquot. We don't want it allocated on disk, so don't * Try to get the dquot. We don't want it allocated on disk, so don't
* set doalloc. If it doesn't exist, we'll get ENOENT back. * set doalloc. If it doesn't exist, we'll get ENOENT back.
...@@ -519,6 +523,10 @@ xfs_qm_scall_getquota_next( ...@@ -519,6 +523,10 @@ xfs_qm_scall_getquota_next(
struct xfs_dquot *dqp; struct xfs_dquot *dqp;
int error; int error;
/* Flush inodegc work at the start of a quota reporting scan. */
if (*id == 0)
xfs_inodegc_flush(mp);
error = xfs_qm_dqget_next(mp, *id, type, &dqp); error = xfs_qm_dqget_next(mp, *id, type, &dqp);
if (error) if (error)
return error; return error;
......
...@@ -791,6 +791,9 @@ xfs_fs_statfs( ...@@ -791,6 +791,9 @@ xfs_fs_statfs(
xfs_extlen_t lsize; xfs_extlen_t lsize;
int64_t ffree; int64_t ffree;
/* Wait for whatever inactivations are in progress. */
xfs_inodegc_flush(mp);
statp->f_type = XFS_SUPER_MAGIC; statp->f_type = XFS_SUPER_MAGIC;
statp->f_namelen = MAXNAMELEN - 1; statp->f_namelen = MAXNAMELEN - 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册