[XFS] make inode reclaim wait for log I/O to complete

During a forced shutdown a xfs inode can be destroyed before log I/O
involving that inode is complete. We need to wait for the inode to be
unpinned before tearing it down. Version 2 cleans up the code a bit by
relying on xfs_iflush() to do the unpinning and forced shutdown check.

SGI-PV: 981240

SGI-Modid: xfs-linux-melb:xfs-kern:31326a

Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: David Chinner <dgc@sgi.com>
This commit is contained in:
Lachlan McIlroy 2008-06-23 13:23:57 +10:00 коммит произвёл Niv Sardi
Родитель ad9b463aa2
Коммит 7f871d5d1b
2 изменённых файлов: 8 добавлений и 24 удалений

Просмотреть файл

@ -3082,8 +3082,6 @@ xfs_iflush(
* flush lock and do nothing. * flush lock and do nothing.
*/ */
if (xfs_inode_clean(ip)) { if (xfs_inode_clean(ip)) {
ASSERT((iip != NULL) ?
!(iip->ili_item.li_flags & XFS_LI_IN_AIL) : 1);
xfs_ifunlock(ip); xfs_ifunlock(ip);
return 0; return 0;
} }

Просмотреть файл

@ -3260,7 +3260,6 @@ xfs_finish_reclaim(
{ {
xfs_perag_t *pag = xfs_get_perag(ip->i_mount, ip->i_ino); xfs_perag_t *pag = xfs_get_perag(ip->i_mount, ip->i_ino);
bhv_vnode_t *vp = XFS_ITOV_NULL(ip); bhv_vnode_t *vp = XFS_ITOV_NULL(ip);
int error;
if (vp && VN_BAD(vp)) if (vp && VN_BAD(vp))
goto reclaim; goto reclaim;
@ -3303,29 +3302,16 @@ xfs_finish_reclaim(
xfs_iflock(ip); xfs_iflock(ip);
} }
if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { /*
if (ip->i_update_core || * In the case of a forced shutdown we rely on xfs_iflush() to
((ip->i_itemp != NULL) && * wait for the inode to be unpinned before returning an error.
(ip->i_itemp->ili_format.ilf_fields != 0))) { */
error = xfs_iflush(ip, sync_mode); if (xfs_iflush(ip, sync_mode) == 0) {
/* /* synchronize with xfs_iflush_done */
* If we hit an error, typically because of filesystem xfs_iflock(ip);
* shutdown, we don't need to let vn_reclaim to know xfs_ifunlock(ip);
* because we're gonna reclaim the inode anyway.
*/
if (error) {
xfs_iunlock(ip, XFS_ILOCK_EXCL);
goto reclaim;
}
xfs_iflock(ip); /* synchronize with xfs_iflush_done */
}
ASSERT(ip->i_update_core == 0);
ASSERT(ip->i_itemp == NULL ||
ip->i_itemp->ili_format.ilf_fields == 0);
} }
xfs_ifunlock(ip);
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
reclaim: reclaim: