xfs
[Top] [All Lists]

[RFC PATCH 07/11] xfs: retry trans reservation on ENOSPC in xfs_inactive

To: xfs@xxxxxxxxxxx
Subject: [RFC PATCH 07/11] xfs: retry trans reservation on ENOSPC in xfs_inactive()
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Tue, 3 Sep 2013 14:25:04 -0400
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1378232708-57156-1-git-send-email-bfoster@xxxxxxxxxx>
References: <1378232708-57156-1-git-send-email-bfoster@xxxxxxxxxx>
An ifree data block reservation can fail with ENOSPC. Flush inodes
to try and free up space or attempt without a data block
reservation to avoid failing out of xfs_inactive().

Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
---
 fs/xfs/xfs_inode.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 56cbf63..92de4b7 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1779,7 +1779,18 @@ xfs_inactive(
        tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE);
        error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ifree,
                                  XFS_IFREE_SPACE_RES(mp), 0);
+       if (error == ENOSPC) {
+               /* flush outstanding delalloc blocks and retry */
+               xfs_flush_inodes(mp);
+               error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ifree,
+                                         XFS_IFREE_SPACE_RES(mp), 0);
+       }
+       if (error == ENOSPC) {
+               /* resort to a no alloc. reservation */
+               error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ifree, 0, 0);
+       }
        if (error) {
+               ASSERT(XFS_FORCED_SHUTDOWN(mp));
                xfs_trans_cancel(tp, 0);
                goto out_unlock;
        }
-- 
1.8.1.4

<Prev in Thread] Current Thread [Next in Thread>