Unverified Commit e4a4ee5f authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3495 xfs: fix hung and warning

Merge Pull Request from: @ci-robot 
 
PR sync from: Long Li <leo.lilong@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/75BHH4BQQZYD32TNVZ65A75GKY7DWFUM/ 
This patch set fix some hung task and warning bug:

Long Li (1):
  xfs: fix hung when transaction commit fail in xfs_inactive_ifree

Ye Bin (2):
  xfs: fix dead loop when do mount with IO fault injection
  xfs: fix warning in xfs_vm_writepages()


-- 
2.31.1
 
https://gitee.com/openeuler/kernel/issues/I8LHTR 
 
Link:https://gitee.com/openeuler/kernel/pulls/3495

 

Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 8ed52b4b 34a99d8f
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -645,8 +645,12 @@ xfs_buf_item_put(
	struct xfs_buf_log_item	*bip)
{
	struct xfs_log_item	*lip = &bip->bli_item;
	struct xfs_buf		*bp = bip->bli_buf;
	struct xfs_log_item	*lp, *n;
	struct xfs_inode_log_item *iip;
	bool			aborted;
	bool			dirty;
	bool			stale = bip->bli_flags & XFS_BLI_STALE_INODE;

	/* drop the bli ref and return if it wasn't the last one */
	if (!atomic_dec_and_test(&bip->bli_refcount))
@@ -673,6 +677,22 @@ xfs_buf_item_put(
	if (aborted)
		xfs_trans_ail_delete(lip, 0);
	xfs_buf_item_relse(bip->bli_buf);

	/*
	 * If it is an inode buffer and item marked as stale, abort flushing
	 * inodes associated with the buf, prevent inode item left in AIL.
	 */
	if (aborted && stale) {
		list_for_each_entry_safe(lp, n, &bp->b_li_list, li_bio_list) {
			iip = container_of(lp, struct xfs_inode_log_item,
					ili_item);
			if (xfs_iflags_test(iip->ili_inode, XFS_ISTALE)) {
				set_bit(XFS_LI_ABORTED, &lp->li_flags);
				xfs_iflags_clear(iip->ili_inode, XFS_IFLUSHING);
			}
		}
	}

	return true;
}

+6 −0
Original line number Diff line number Diff line
@@ -557,6 +557,12 @@ xfs_iget_cache_hit(
		if (!igrab(inode))
			goto out_skip;

		if (!(flags & XFS_IGET_DONTCACHE)) {
			spin_lock(&inode->i_lock);
			inode->i_state &= ~I_DONTCACHE;
			spin_unlock(&inode->i_lock);
		}

		/* We've got a live one. */
		spin_unlock(&ip->i_flags_lock);
		rcu_read_unlock();
+2 −1
Original line number Diff line number Diff line
@@ -3368,7 +3368,8 @@ xfs_iflush_cluster(
		 * once we drop the i_flags_lock.
		 */
		spin_lock(&ip->i_flags_lock);
		ASSERT(!__xfs_iflags_test(ip, XFS_ISTALE));
		ASSERT(!__xfs_iflags_test(ip, XFS_ISTALE) ||
				test_bit(XFS_LI_ABORTED, &lip->li_flags));
		if (__xfs_iflags_test(ip, XFS_IRECLAIM | XFS_IFLUSHING)) {
			spin_unlock(&ip->i_flags_lock);
			continue;
+2 −1
Original line number Diff line number Diff line
@@ -695,7 +695,8 @@ xfs_inode_item_push(
	uint			rval = XFS_ITEM_SUCCESS;
	int			error;

	if (!bp || (ip->i_flags & XFS_ISTALE)) {
	if (!bp || ((ip->i_flags & XFS_ISTALE) &&
		   !(lip->li_flags & XFS_LI_ABORTED))) {
		/*
		 * Inode item/buffer is being aborted due to cluster
		 * buffer deletion. Trigger a log force to have that operation
+3 −1
Original line number Diff line number Diff line
@@ -817,6 +817,8 @@ xfs_log_mount_finish(
	} else {
		xfs_info(mp, "Ending clean mount");
	}

	if (!error)
		xfs_buftarg_drain(mp->m_ddev_targp);

	clear_bit(XLOG_RECOVERY_NEEDED, &log->l_opstate);