Skip to content

Commit 5827713

Browse files
gtmothBrian Maly
authored andcommitted
clear inode and truncate pages before enqueuing for async inactivation
The patch "xfs: fix deadlock between shrinker and fs freeze" caused this issue. This is a uek4 only issue as the above patch is implemented as part of 'evict_inode' in uek4 where as in higher versions it is part of 'destroy_inode'. As higher versions doesn't implement 'evict_inode', the clear_inode() and truncate_inode_pages_final() are in deed called on the inode. Whereas uek4 implements evict_inode(), hence we need to explicitly call clear_inode() and truncate_inode_pages_final() before queuing up for async inactivation. Orabug: 31744270 Signed-off-by: Gautham Ananthakrishna <[email protected]> Reviewed-by: Junxiao Bi <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent 8bfd693 commit 5827713

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

fs/xfs/xfs_super.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,16 +1008,18 @@ xfs_fs_inode_init_once(
10081008

10091009
STATIC void
10101010
_xfs_fs_evict_inode(
1011-
struct inode *inode)
1011+
struct inode *inode,
1012+
bool is_clear)
10121013
{
10131014
xfs_inode_t *ip = XFS_I(inode);
10141015

10151016
ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock));
10161017

10171018
trace_xfs_evict_inode(ip);
1018-
1019-
truncate_inode_pages_final(&inode->i_data);
1020-
clear_inode(inode);
1019+
if (!is_clear) {
1020+
truncate_inode_pages_final(&inode->i_data);
1021+
clear_inode(inode);
1022+
}
10211023
XFS_STATS_INC(ip->i_mount, vn_rele);
10221024
XFS_STATS_INC(ip->i_mount, vn_remove);
10231025

@@ -1040,6 +1042,8 @@ xfs_fs_evict_inode(
10401042
freezed = !sb_start_write_trylock(mp->m_super);
10411043
if (freezed && xfs_inode_needs_inactivation(ip)) {
10421044
pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
1045+
truncate_inode_pages_final(&inode->i_data);
1046+
clear_inode(inode);
10431047
spin_lock(&pag->pag_inact_lock);
10441048
list_add_tail(&ip->i_inact_list, &pag->pag_inact_list);
10451049
spin_unlock(&pag->pag_inact_lock);
@@ -1048,7 +1052,7 @@ xfs_fs_evict_inode(
10481052
return;
10491053
}
10501054

1051-
_xfs_fs_evict_inode(inode);
1055+
_xfs_fs_evict_inode(inode, false);
10521056
if (!freezed)
10531057
sb_end_write(mp->m_super);
10541058
}
@@ -1081,7 +1085,7 @@ xfs_fs_inact_worker(
10811085

10821086
list_for_each_entry_safe(ip, next_ip, &list, i_inact_list) {
10831087
list_del_init(&ip->i_inact_list);
1084-
_xfs_fs_evict_inode(&ip->i_vnode);
1088+
_xfs_fs_evict_inode(&ip->i_vnode, true);
10851089
cond_resched();
10861090
}
10871091
sb_end_write(mp->m_super);

0 commit comments

Comments
 (0)