aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iget.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-04-23 01:58:32 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:25 -0400
commit32ce90a4b79155a155de2b284d8b69023e5e8fea (patch)
tree1280a85dea9061a8089a39fccc8a5ce0fc222e62 /fs/xfs/xfs_iget.c
parentdea9609527a55b65638a6323894269334dfe6ec5 (diff)
xfs: remove log item from AIL in xfs_iflush after a shutdown
If a filesystem has been forced shutdown we are never going to write inodes to disk, which means the inode items will stay in the AIL until we free the inode. Currently that is not a problem, but a pending change requires us to empty the AIL before shutting down the filesystem. In that case leaving the inode in the AIL is lethal. Make sure to remove the log item from the AIL to allow emptying the AIL on shutdown filesystems. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_iget.c')
-rw-r--r--fs/xfs/xfs_iget.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index bcc6c249b2c7..ab89ca7fdb95 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -123,23 +123,7 @@ xfs_inode_free(
123 xfs_idestroy_fork(ip, XFS_ATTR_FORK); 123 xfs_idestroy_fork(ip, XFS_ATTR_FORK);
124 124
125 if (ip->i_itemp) { 125 if (ip->i_itemp) {
126 /* 126 ASSERT(!(ip->i_itemp->ili_item.li_flags & XFS_LI_IN_AIL));
127 * Only if we are shutting down the fs will we see an
128 * inode still in the AIL. If it is there, we should remove
129 * it to prevent a use-after-free from occurring.
130 */
131 xfs_log_item_t *lip = &ip->i_itemp->ili_item;
132 struct xfs_ail *ailp = lip->li_ailp;
133
134 ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) ||
135 XFS_FORCED_SHUTDOWN(ip->i_mount));
136 if (lip->li_flags & XFS_LI_IN_AIL) {
137 spin_lock(&ailp->xa_lock);
138 if (lip->li_flags & XFS_LI_IN_AIL)
139 xfs_trans_ail_delete(ailp, lip);
140 else
141 spin_unlock(&ailp->xa_lock);
142 }
143 xfs_inode_item_destroy(ip); 127 xfs_inode_item_destroy(ip);
144 ip->i_itemp = NULL; 128 ip->i_itemp = NULL;
145 } 129 }