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

!1037 xfs: fixes patchs and backport patchs

Merge Pull Request from: @ci-robot 
 
PR sync from:  Long Li <leo.lilong@huawei.com>
 https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/thread/K4OKCQH4DUB6KNY6V5FAE3L2TZ4MZLHU/ 
Allison Henderson (1):
  xfs: increase rename inode reservation

ChenXiaoSong (1):
  xfs: fix NULL pointer dereference in xfs_getbmap()

Darrick J. Wong (6):
  xfs: check return codes when flushing block devices
  xfs: fix maxlevels comparisons in the btree staging code
  xfs: shut down filesystem if we xfs_trans_cancel with deferred work
    items
  xfs: don't expose internal symlink metadata buffers to the vfs
  xfs: fix negative array access in xfs_getbmap
  iomap: iomap: fix memory corruption when recording errors during
    writeback

Dave Chinner (13):
  xfs: remove xfs_blkdev_issue_flush
  xfs: AIL should be log centric
  xfs: shutdown in intent recovery has non-intent items in the AIL
  xfs: log shutdown triggers should only shut down the log
  xfs: xfs_do_force_shutdown needs to block racing shutdowns
  xfs: xfs_trans_commit() path must check for log shutdown
  xfs: shutdown during log recovery needs to mark the log shutdown
  xfs: remove XFS_PREALLOC_SYNC
  xfs: fallocate() should call file_modified()
  xfs: sb verifier doesn't handle uncached sb buffer
  xfs: write page faults in iomap are not buffered writes
  iomap: write iomap validity checks
  xfs: use iomap_valid method to detect stale cached iomaps

Gao Xiang (1):
  xfs: account extra freespace btree splits for multiple allocations

Guo Xuenan (3):
  Revert "[Huawei] xfs: fix uaf when leaf dir bestcount not match with
    dir data blocks"
  xfs: fix exception caused by unexpected illegal bestcount in leaf dir
  xfs: force shutdown xfs when xfs_attr_inactive fails

Long Li (4):
  xfs: fix ag count overflow during growfs
  xfs: fix hung when transaction commit fail in xfs_inactive_ifree
  xfs: fix a UAF when inode item push
  xfs: fix a UAF in xfs_iflush_abort_clean

Shida Zhang (1):
  xfs: trim the mapp array accordingly in xfs_da_grow_inode_int

Wu Guanghao (1):
  xfs: fix the problem of mount failure caused by not refreshing
    mp->m_sb

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

Zhang Yi (2):
  xfs: factor out __xfs_da3_node_read()
  xfs: atomic drop extent entries when inactiving attr


-- 
2.31.1
 
 
Link:https://gitee.com/openeuler/kernel/pulls/1037

 

Reviewed-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 5e58d490 ac00cf70
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -24,11 +24,16 @@ loff_t
iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned flags,
		const struct iomap_ops *ops, void *data, iomap_actor_t actor)
{
	struct iomap iomap = { .type = IOMAP_HOLE };
	struct iomap srcmap = { .type = IOMAP_HOLE };
	loff_t written = 0, ret;
	struct iomap iomap;
	struct iomap srcmap;
	loff_t written, ret;
	u64 end;

stale:
	memset(&iomap, 0, sizeof(struct iomap));
	memset(&srcmap, 0, sizeof(struct iomap));
	written = 0;

	trace_iomap_apply(inode, pos, length, flags, ops, actor, _RET_IP_);

	/*
@@ -95,5 +100,8 @@ iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned flags,
				     flags, &iomap);
	}

	if (!ret && !written && iomap.flags & IOMAP_F_STALE)
		goto stale;

	return written ? written : ret;
}
+28 −1
Original line number Diff line number Diff line
@@ -620,6 +620,25 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags,
		goto out_no_page;
	}

	/*
	 * Now we have a locked folio, before we do anything with it we need to
	 * check that the iomap we have cached is not stale. The inode extent
	 * mapping can change due to concurrent IO in flight (e.g.
	 * IOMAP_UNWRITTEN state can change and memory reclaim could have
	 * reclaimed a previously partially written page at this index after IO
	 * completion before this write reaches this file offset) and hence we
	 * could do the wrong thing here (zero a page range incorrectly or fail
	 * to zero) and corrupt data.
	 */
	if (page_ops && page_ops->iomap_valid) {
		bool iomap_valid = page_ops->iomap_valid(inode, iomap);
		if (!iomap_valid) {
			iomap->flags |= IOMAP_F_STALE;
			status = 0;
			goto out_unlock;
		}
	}

	if (srcmap->type == IOMAP_INLINE)
		iomap_read_inline_data(inode, page, srcmap);
	else if (iomap->flags & IOMAP_F_BUFFER_HEAD)
@@ -786,6 +805,8 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
				srcmap);
		if (unlikely(status))
			break;
		if (iomap->flags & IOMAP_F_STALE)
			break;

		if (mapping_writably_mapped(inode->i_mapping))
			flush_dcache_page(page);
@@ -863,6 +884,8 @@ iomap_unshare_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
				IOMAP_WRITE_F_UNSHARE, &page, iomap, srcmap);
		if (unlikely(status))
			return status;
		if (iomap->flags & IOMAP_F_STALE)
			break;

		status = iomap_write_end(inode, pos, bytes, bytes, page, iomap,
				srcmap);
@@ -911,6 +934,8 @@ static s64 iomap_zero(struct inode *inode, loff_t pos, u64 length,
	status = iomap_write_begin(inode, pos, bytes, 0, &page, iomap, srcmap);
	if (status)
		return status;
	if (iomap->flags & IOMAP_F_STALE)
		return 0;

	zero_user(page, offset, bytes);
	mark_page_accessed(page);
@@ -938,6 +963,8 @@ static loff_t iomap_zero_range_actor(struct inode *inode, loff_t pos,
			bytes = iomap_zero(inode, pos, length, iomap, srcmap);
		if (bytes < 0)
			return bytes;
		if (iomap->flags & IOMAP_F_STALE)
			break;

		pos += bytes;
		length -= bytes;
@@ -1462,7 +1489,7 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc,
	if (!count)
		end_page_writeback(page);
done:
	mapping_set_error(page->mapping, error);
	mapping_set_error(inode->i_mapping, error);
	return error;
}

+7 −2
Original line number Diff line number Diff line
@@ -2516,7 +2516,12 @@ xfs_alloc_fix_freelist(
		goto out_agbp_relse;
	}

	need = xfs_alloc_min_freelist(mp, pag);
	/*
	 * Also need to fulfill freespace btree splits by reservaing more
	 * blocks to perform multiple allocations from a single AG and
	 * transaction if needed.
	 */
	need = xfs_alloc_min_freelist(mp, pag) * (1 + args->postallocs);
	if (!xfs_alloc_space_available(args, need, flags |
			XFS_ALLOC_FLAG_CHECK))
		goto out_agbp_relse;
@@ -2540,7 +2545,7 @@ xfs_alloc_fix_freelist(
		xfs_agfl_reset(tp, agbp, pag);

	/* If there isn't enough total space or single-extent, reject it. */
	need = xfs_alloc_min_freelist(mp, pag);
	need = xfs_alloc_min_freelist(mp, pag) * (1 + args->postallocs);
	if (!xfs_alloc_space_available(args, need, flags))
		goto out_agbp_relse;

+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ typedef struct xfs_alloc_arg {
	int		datatype;	/* mask defining data type treatment */
	char		wasdel;		/* set if allocation was prev delayed */
	char		wasfromfl;	/* set if allocation is from freelist */
	bool		postallocs;	/* number of post-allocations */
	struct xfs_owner_info	oinfo;	/* owner of blocks being allocated */
	enum xfs_ag_resv_type	resv;	/* block reservation to use */
} xfs_alloc_arg_t;
+5 −2
Original line number Diff line number Diff line
@@ -3626,6 +3626,7 @@ xfs_bmap_btalloc(
		args.alignment = 1;
		args.minalignslop = 0;
	}
	args.postallocs = 1;
	args.minleft = ap->minleft;
	args.wasdel = ap->wasdel;
	args.resv = XFS_AG_RESV_NONE;
@@ -4539,7 +4540,8 @@ xfs_bmapi_convert_delalloc(
	 * the extent.  Just return the real extent at this offset.
	 */
	if (!isnullstartblock(bma.got.br_startblock)) {
		xfs_bmbt_to_iomap(ip, iomap, &bma.got, flags);
		xfs_bmbt_to_iomap(ip, iomap, &bma.got, flags,
				  xfs_iomap_inode_sequence(ip, flags));
		*seq = READ_ONCE(ifp->if_seq);
		goto out_trans_cancel;
	}
@@ -4586,7 +4588,8 @@ xfs_bmapi_convert_delalloc(
	XFS_STATS_INC(mp, xs_xstrat_quick);

	ASSERT(!isnullstartblock(bma.got.br_startblock));
	xfs_bmbt_to_iomap(ip, iomap, &bma.got, flags);
	xfs_bmbt_to_iomap(ip, iomap, &bma.got, flags,
			  xfs_iomap_inode_sequence(ip, flags));
	*seq = READ_ONCE(ifp->if_seq);

	if (whichfork == XFS_COW_FORK)
Loading