diff options
author | Dave Chinner <david@fromorbit.com> | 2014-05-15 09:37:44 +1000 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-05-15 09:37:44 +1000 |
commit | b76769294ba400415fc44038c21cc2df86f9a28b (patch) | |
tree | a1ca6152391c86ae024e09d69e7b0ad75a5c61d5 /fs/xfs/xfs_inode.c | |
parent | 232c2f5c65dd80055e7163a5c82e3816119330e6 (diff) | |
parent | 53801fd97ae000793f51187b122b9475102199a8 (diff) | |
download | linux-b76769294ba400415fc44038c21cc2df86f9a28b.tar.bz2 |
Merge branch 'xfs-free-inode-btree' into for-next
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 6bbfcf0b3bb2..6d6b44a508f9 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -1811,9 +1811,33 @@ xfs_inactive_ifree( int error; tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); - error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ifree, 0, 0); + + /* + * The ifree transaction might need to allocate blocks for record + * insertion to the finobt. We don't want to fail here at ENOSPC, so + * allow ifree to dip into the reserved block pool if necessary. + * + * Freeing large sets of inodes generally means freeing inode chunks, + * directory and file data blocks, so this should be relatively safe. + * Only under severe circumstances should it be possible to free enough + * inodes to exhaust the reserve block pool via finobt expansion while + * at the same time not creating free space in the filesystem. + * + * Send a warning if the reservation does happen to fail, as the inode + * now remains allocated and sits on the unlinked list until the fs is + * repaired. + */ + tp->t_flags |= XFS_TRANS_RESERVE; + error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ifree, + XFS_IFREE_SPACE_RES(mp), 0); if (error) { - ASSERT(XFS_FORCED_SHUTDOWN(mp)); + if (error == ENOSPC) { + xfs_warn_ratelimited(mp, + "Failed to remove inode(s) from unlinked list. " + "Please free space, unmount and run xfs_repair."); + } else { + ASSERT(XFS_FORCED_SHUTDOWN(mp)); + } xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES); return error; } |