summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_qm.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 11:16:10 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-12-15 17:29:15 -0800
commitc22ab7358ed955dcacd4807f56c8c7a66d90d84a (patch)
tree3079c0ab1572d6be806e616fd0d8883e42ae9b16 /fs/xfs/xfs_qm.c
parent46eafab0ad7f603c70e04830c7f3db7c165a32de (diff)
xfs: attach dquots to rt metadata files when starting quota
Attach dquots to the realtime metadata files when starting up quotas, since the resources used by them are charged to the root dquot. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_qm.c')
-rw-r--r--fs/xfs/xfs_qm.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 934dae51bc0a..fde0848daacd 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -28,6 +28,7 @@
#include "xfs_health.h"
#include "xfs_imeta.h"
#include "xfs_da_format.h"
+#include "xfs_rtalloc.h"
/*
* The global quota manager. There is only one of these for the entire
@@ -1462,7 +1463,7 @@ xfs_qm_quotacheck(
* If we fail here, the mount will continue with quota turned off. We don't
* need to inidicate success or failure at all.
*/
-void
+int
xfs_qm_mount_quotas(
struct xfs_mount *mp)
{
@@ -1501,7 +1502,7 @@ xfs_qm_mount_quotas(
error = xfs_qm_quotacheck(mp);
if (error) {
/* Quotacheck failed and disabled quotas. */
- return;
+ return 0;
}
}
/*
@@ -1542,8 +1543,21 @@ xfs_qm_mount_quotas(
if (error) {
xfs_warn(mp, "Failed to initialize disk quotas.");
- return;
+ return 0;
+ }
+
+ /*
+ * Attach dquots to realtime metadata files before we do anything that
+ * could alter the resource usage of rt metadata (log recovery, normal
+ * operation, etc).
+ */
+ error = xfs_rtmount_dqattach(mp);
+ if (error) {
+ xfs_qm_unmount_quotas(mp);
+ return error;
}
+
+ return 0;
}
/*