summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_qm.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_qm.c')
-rw-r--r--fs/xfs/xfs_qm.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 8699342306f4..b0c4ace8a3ee 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -836,6 +836,7 @@ xfs_qm_qino_alloc(
struct xfs_imeta_end ic;
struct xfs_trans *tp;
const struct xfs_imeta_path *path = xfs_qflags_to_imeta(flags);
+ uint old_qflags;
int error;
bool need_alloc = true;
@@ -844,6 +845,18 @@ xfs_qm_qino_alloc(
if (error)
return error;
+ /*
+ * Ensure the quota directory exists, being careful to disable quotas
+ * while we do this. We'll have to quotacheck anyway, so the loss
+ * of one inode shouldn't affect the quota count.
+ */
+ old_qflags = mp->m_qflags & XFS_ALL_QUOTA_ACCT;
+ mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT;
+ error = xfs_imeta_ensure_dirpath(mp, xfs_qflags_to_imeta(flags));
+ mp->m_qflags |= old_qflags;
+ if (error)
+ return error;
+
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_imeta_create,
xfs_imeta_create_space_res(mp), 0, 0, &tp);
if (error)