Commit 9141c5d3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'xfs-fixes-6.13-rc2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Carlos Maiolino:

 - Use xchg() in xlog_cil_insert_pcp_aggregate()

 - Fix ABBA deadlock on a race between mount and log shutdown

 - Fix quota softlimit incoherency on delalloc

 - Fix sparse inode limits on runt AG

 - remove unknown compat feature checks in SB write valdation

 - Eliminate a lockdep false positive

* tag 'xfs-fixes-6.13-rc2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: don't call xfs_bmap_same_rtgroup in xfs_bmap_add_extent_hole_delay
  xfs: Use xchg() in xlog_cil_insert_pcp_aggregate()
  xfs: prevent mount and log shutdown race
  xfs: delalloc and quota softlimit timers are incoherent
  xfs: fix sparse inode limits on runt AG
  xfs: remove unknown compat feature check in superblock write validation
  xfs: eliminate lockdep false positives in xfs_attr_shortform_list
parents ceb8bf2c cc2dba08
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -2620,8 +2620,7 @@ xfs_bmap_add_extent_hole_delay(
	 */
	if ((state & BMAP_LEFT_VALID) && (state & BMAP_LEFT_DELAY) &&
	    left.br_startoff + left.br_blockcount == new->br_startoff &&
	    left.br_blockcount + new->br_blockcount <= XFS_MAX_BMBT_EXTLEN &&
	    xfs_bmap_same_rtgroup(ip, whichfork, &left, new))
	    left.br_blockcount + new->br_blockcount <= XFS_MAX_BMBT_EXTLEN)
		state |= BMAP_LEFT_CONTIG;

	if ((state & BMAP_RIGHT_VALID) && (state & BMAP_RIGHT_DELAY) &&
@@ -2629,8 +2628,7 @@ xfs_bmap_add_extent_hole_delay(
	    new->br_blockcount + right.br_blockcount <= XFS_MAX_BMBT_EXTLEN &&
	    (!(state & BMAP_LEFT_CONTIG) ||
	     (left.br_blockcount + new->br_blockcount +
	      right.br_blockcount <= XFS_MAX_BMBT_EXTLEN)) &&
	    xfs_bmap_same_rtgroup(ip, whichfork, new, &right))
	      right.br_blockcount <= XFS_MAX_BMBT_EXTLEN)))
		state |= BMAP_RIGHT_CONTIG;

	/*
+9 −7
Original line number Diff line number Diff line
@@ -853,7 +853,8 @@ xfs_ialloc_ag_alloc(
		 * the end of the AG.
		 */
		args.min_agbno = args.mp->m_sb.sb_inoalignmt;
		args.max_agbno = round_down(args.mp->m_sb.sb_agblocks,
		args.max_agbno = round_down(xfs_ag_block_count(args.mp,
							pag_agno(pag)),
					    args.mp->m_sb.sb_inoalignmt) -
				 igeo->ialloc_blks;

@@ -2349,9 +2350,9 @@ xfs_difree(
		return -EINVAL;
	}
	agbno = XFS_AGINO_TO_AGBNO(mp, agino);
	if (agbno >= mp->m_sb.sb_agblocks)  {
		xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).",
			__func__, agbno, mp->m_sb.sb_agblocks);
	if (agbno >= xfs_ag_block_count(mp, pag_agno(pag))) {
		xfs_warn(mp, "%s: agbno >= xfs_ag_block_count (%d >= %d).",
			__func__, agbno, xfs_ag_block_count(mp, pag_agno(pag)));
		ASSERT(0);
		return -EINVAL;
	}
@@ -2474,7 +2475,7 @@ xfs_imap(
	 */
	agino = XFS_INO_TO_AGINO(mp, ino);
	agbno = XFS_AGINO_TO_AGBNO(mp, agino);
	if (agbno >= mp->m_sb.sb_agblocks ||
	if (agbno >= xfs_ag_block_count(mp, pag_agno(pag)) ||
	    ino != xfs_agino_to_ino(pag, agino)) {
		error = -EINVAL;
#ifdef DEBUG
@@ -2484,11 +2485,12 @@ xfs_imap(
		 */
		if (flags & XFS_IGET_UNTRUSTED)
			return error;
		if (agbno >= mp->m_sb.sb_agblocks) {
		if (agbno >= xfs_ag_block_count(mp, pag_agno(pag))) {
			xfs_alert(mp,
		"%s: agbno (0x%llx) >= mp->m_sb.sb_agblocks (0x%lx)",
				__func__, (unsigned long long)agbno,
				(unsigned long)mp->m_sb.sb_agblocks);
				(unsigned long)xfs_ag_block_count(mp,
							pag_agno(pag)));
		}
		if (ino != xfs_agino_to_ino(pag, agino)) {
			xfs_alert(mp,
+0 −7
Original line number Diff line number Diff line
@@ -326,13 +326,6 @@ xfs_validate_sb_write(
	 * the kernel cannot support since we checked for unsupported bits in
	 * the read verifier, which means that memory is corrupt.
	 */
	if (xfs_sb_has_compat_feature(sbp, XFS_SB_FEAT_COMPAT_UNKNOWN)) {
		xfs_warn(mp,
"Corruption detected in superblock compatible features (0x%x)!",
			(sbp->sb_features_compat & XFS_SB_FEAT_COMPAT_UNKNOWN));
		return -EFSCORRUPTED;
	}

	if (!xfs_is_readonly(mp) &&
	    xfs_sb_has_ro_compat_feature(sbp, XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {
		xfs_alert(mp,
+2 −1
Original line number Diff line number Diff line
@@ -114,7 +114,8 @@ xfs_attr_shortform_list(
	 * It didn't all fit, so we have to sort everything on hashval.
	 */
	sbsize = sf->count * sizeof(*sbuf);
	sbp = sbuf = kmalloc(sbsize, GFP_KERNEL | __GFP_NOFAIL);
	sbp = sbuf = kmalloc(sbsize,
			GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);

	/*
	 * Scan the attribute list for the rest of the entries, storing
+11 −0
Original line number Diff line number Diff line
@@ -3455,6 +3455,16 @@ xlog_force_shutdown(
	if (!log)
		return false;

	/*
	 * Ensure that there is only ever one log shutdown being processed.
	 * If we allow the log force below on a second pass after shutting
	 * down the log, we risk deadlocking the CIL push as it may require
	 * locks on objects the current shutdown context holds (e.g. taking
	 * buffer locks to abort buffers on last unpin of buf log items).
	 */
	if (test_and_set_bit(XLOG_SHUTDOWN_STARTED, &log->l_opstate))
		return false;

	/*
	 * Flush all the completed transactions to disk before marking the log
	 * being shut down. We need to do this first as shutting down the log
@@ -3487,6 +3497,7 @@ xlog_force_shutdown(
	spin_lock(&log->l_icloglock);
	if (test_and_set_bit(XLOG_IO_ERROR, &log->l_opstate)) {
		spin_unlock(&log->l_icloglock);
		ASSERT(0);
		return false;
	}
	spin_unlock(&log->l_icloglock);
Loading