[PATCH 09/12] xfs: flush eof/cowblocks if we can't reserve quota for chown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

If a file user, group, or project change is unable to reserve enough
quota to handle the modification, try clearing whatever space the
filesystem might have been hanging onto in the hopes of speeding up the
filesystem.  The flushing behavior will become particularly important
when we add deferred inode inactivation because that will increase the
amount of space that isn't actively tied to user data.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 fs/xfs/xfs_trans.c |    9 +++++++++
 1 file changed, 9 insertions(+)


diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index ee3cb916c5c9..3203841ab19b 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -1149,8 +1149,10 @@ xfs_trans_alloc_ichange(
 	struct xfs_dquot	*new_udqp;
 	struct xfs_dquot	*new_gdqp;
 	struct xfs_dquot	*new_pdqp;
+	bool			retried = false;
 	int			error;
 
+retry:
 	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp);
 	if (error)
 		return error;
@@ -1175,6 +1177,13 @@ xfs_trans_alloc_ichange(
 	if (new_udqp || new_gdqp || new_pdqp) {
 		error = xfs_trans_reserve_quota_chown(tp, ip, new_udqp,
 				new_gdqp, new_pdqp, force);
+		if (!retried && (error == -EDQUOT || error == -ENOSPC)) {
+			xfs_trans_cancel(tp);
+			xfs_blockgc_free_dquots(new_udqp, new_gdqp, new_pdqp,
+					0);
+			retried = true;
+			goto retry;
+		}
 		if (error)
 			goto out_cancel;
 	}




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux