Commit 849a4f09 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull xfs bug fixes from Dave Chinner:
 "Largely minor bug fixes and cleanups, th emost important of which are
  probably the fixes for regressions in the extent allocation code:

   - fixes for inode garbage collection shutdown racing with work queue
     updates

   - ensure inodegc workers run on the CPU they are supposed to

   - disable counter scrubbing until we can exclusively freeze the
     filesystem from the kernel

   - regression fixes for new allocation related bugs

   - a couple of minor cleanups"

* tag 'xfs-6.4-rc1-fixes' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: fix xfs_inodegc_stop racing with mod_delayed_work
  xfs: disable reaping in fscounters scrub
  xfs: check that per-cpu inodegc workers actually run on that cpu
  xfs: explicitly specify cpu when forcing inodegc delayed work to run immediately
  xfs: fix negative array access in xfs_getbmap
  xfs: don't allocate into the data fork for an unshare request
  xfs: flush dirty data and drain directios before scrubbing cow fork
  xfs: set bnobt/cntbt numrecs correctly when formatting new AGs
  xfs: don't unconditionally null args->pag in xfs_bmap_btalloc_at_eof
parents 105131df 2254a739
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -495,10 +495,12 @@ xfs_freesp_init_recs(
		ASSERT(start >= mp->m_ag_prealloc_blocks);
		if (start != mp->m_ag_prealloc_blocks) {
			/*
			 * Modify first record to pad stripe align of log
			 * Modify first record to pad stripe align of log and
			 * bump the record count.
			 */
			arec->ar_blockcount = cpu_to_be32(start -
						mp->m_ag_prealloc_blocks);
			be16_add_cpu(&block->bb_numrecs, 1);
			nrec = arec + 1;

			/*
@@ -509,7 +511,6 @@ xfs_freesp_init_recs(
					be32_to_cpu(arec->ar_startblock) +
					be32_to_cpu(arec->ar_blockcount));
			arec = nrec;
			be16_add_cpu(&block->bb_numrecs, 1);
		}
		/*
		 * Change record start to after the internal log
@@ -518,15 +519,13 @@ xfs_freesp_init_recs(
	}

	/*
	 * Calculate the record block count and check for the case where
	 * the log might have consumed all available space in the AG. If
	 * so, reset the record count to 0 to avoid exposure of an invalid
	 * record start block.
	 * Calculate the block count of this record; if it is nonzero,
	 * increment the record count.
	 */
	arec->ar_blockcount = cpu_to_be32(id->agsize -
					  be32_to_cpu(arec->ar_startblock));
	if (!arec->ar_blockcount)
		block->bb_numrecs = 0;
	if (arec->ar_blockcount)
		be16_add_cpu(&block->bb_numrecs, 1);
}

/*
@@ -538,7 +537,7 @@ xfs_bnoroot_init(
	struct xfs_buf		*bp,
	struct aghdr_init_data	*id)
{
	xfs_btree_init_block(mp, bp, XFS_BTNUM_BNO, 0, 1, id->agno);
	xfs_btree_init_block(mp, bp, XFS_BTNUM_BNO, 0, 0, id->agno);
	xfs_freesp_init_recs(mp, bp, id);
}

@@ -548,7 +547,7 @@ xfs_cntroot_init(
	struct xfs_buf		*bp,
	struct aghdr_init_data	*id)
{
	xfs_btree_init_block(mp, bp, XFS_BTNUM_CNT, 0, 1, id->agno);
	xfs_btree_init_block(mp, bp, XFS_BTNUM_CNT, 0, 0, id->agno);
	xfs_freesp_init_recs(mp, bp, id);
}

+3 −2
Original line number Diff line number Diff line
@@ -3494,8 +3494,10 @@ xfs_bmap_btalloc_at_eof(
		if (!caller_pag)
			args->pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, ap->blkno));
		error = xfs_alloc_vextent_exact_bno(args, ap->blkno);
		if (!caller_pag)
		if (!caller_pag) {
			xfs_perag_put(args->pag);
			args->pag = NULL;
		}
		if (error)
			return error;

@@ -3505,7 +3507,6 @@ xfs_bmap_btalloc_at_eof(
		 * Exact allocation failed. Reset to try an aligned allocation
		 * according to the original allocation specification.
		 */
		args->pag = NULL;
		args->alignment = stripe_align;
		args->minlen = nextminlen;
		args->minalignslop = 0;
+2 −2
Original line number Diff line number Diff line
@@ -42,12 +42,12 @@ xchk_setup_inode_bmap(
	xfs_ilock(sc->ip, XFS_IOLOCK_EXCL);

	/*
	 * We don't want any ephemeral data fork updates sitting around
	 * We don't want any ephemeral data/cow fork updates sitting around
	 * while we inspect block mappings, so wait for directio to finish
	 * and flush dirty data if we have delalloc reservations.
	 */
	if (S_ISREG(VFS_I(sc->ip)->i_mode) &&
	    sc->sm->sm_type == XFS_SCRUB_TYPE_BMBTD) {
	    sc->sm->sm_type != XFS_SCRUB_TYPE_BMBTA) {
		struct address_space	*mapping = VFS_I(sc->ip)->i_mapping;

		sc->ilock_flags |= XFS_MMAPLOCK_EXCL;
+0 −26
Original line number Diff line number Diff line
@@ -1164,32 +1164,6 @@ xchk_metadata_inode_forks(
	return 0;
}

/* Pause background reaping of resources. */
void
xchk_stop_reaping(
	struct xfs_scrub	*sc)
{
	sc->flags |= XCHK_REAPING_DISABLED;
	xfs_blockgc_stop(sc->mp);
	xfs_inodegc_stop(sc->mp);
}

/* Restart background reaping of resources. */
void
xchk_start_reaping(
	struct xfs_scrub	*sc)
{
	/*
	 * Readonly filesystems do not perform inactivation or speculative
	 * preallocation, so there's no need to restart the workers.
	 */
	if (!xfs_is_readonly(sc->mp)) {
		xfs_inodegc_start(sc->mp);
		xfs_blockgc_start(sc->mp);
	}
	sc->flags &= ~XCHK_REAPING_DISABLED;
}

/*
 * Enable filesystem hooks (i.e. runtime code patching) before starting a scrub
 * operation.  Callers must not hold any locks that intersect with the CPU
+0 −2
Original line number Diff line number Diff line
@@ -156,8 +156,6 @@ static inline bool xchk_skip_xref(struct xfs_scrub_metadata *sm)
}

int xchk_metadata_inode_forks(struct xfs_scrub *sc);
void xchk_stop_reaping(struct xfs_scrub *sc);
void xchk_start_reaping(struct xfs_scrub *sc);

/*
 * Setting up a hook to wait for intents to drain is costly -- we have to take
Loading