Message ID | 161214517714.140945.1957722027452288290.stgit@magnolia (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | xfs: try harder to reclaim space when we run out | expand |
On Sun, Jan 31, 2021 at 06:06:17PM -0800, Darrick J. Wong wrote: > @@ -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)) { One more :) Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
On Mon, Feb 01, 2021 at 12:36:37PM +0000, Christoph Hellwig wrote: > On Sun, Jan 31, 2021 at 06:06:17PM -0800, Darrick J. Wong wrote: > > @@ -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)) { > > One more :) > > Otherwise looks good: > > Reviewed-by: Christoph Hellwig <hch@lst.de> Cool, thanks for reviewing! --D
On Sun, Jan 31, 2021 at 06:06:17PM -0800, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@kernel.org> > > 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@kernel.org> > --- Reviewed-by: Brian Foster <bfoster@redhat.com> > 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; > } >
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; }