Commit 663ea695 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull xfs fixes from Carlos Maiolino:
 "A few bug fixes, nothing really special stands out"

* tag 'xfs-fixes-7.1-rc4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: Fix typo in comment
  xfs: fix the "limiting open zones" message
  xfs: flush delalloc blocks on ENOSPC in xfs_trans_alloc_icreate
  xfs: check da node block pad field during scrub
  xfs: fix memory leak for data allocated by xfs_zone_gc_data_alloc()
  xfs: fix memory leak on error in xfs_alloc_zone_info()
  xfs: check directory data block header padding in scrub
  xfs: zero directory data block padding on write verification
  xfs: zero entire directory data block header region at init
  xfs: remove the meaningless XFS_ALLOC_FLAG_FREEING
parents 56ec2b64 509fdeb3
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -382,6 +382,7 @@ xfs_dir3_data_write_verify(
	struct xfs_mount	*mp = bp->b_mount;
	struct xfs_buf_log_item	*bip = bp->b_log_item;
	struct xfs_dir3_blk_hdr	*hdr3 = bp->b_addr;
	struct xfs_dir3_data_hdr *datahdr3 = bp->b_addr;
	xfs_failaddr_t		fa;

	fa = xfs_dir3_data_verify(bp);
@@ -396,6 +397,11 @@ xfs_dir3_data_write_verify(
	if (bip)
		hdr3->lsn = cpu_to_be64(bip->bli_item.li_lsn);

	/*
	 * Zero padding that may be stale from old kernels.
	 */
	datahdr3->pad = 0;

	xfs_buf_update_cksum(bp, XFS_DIR3_DATA_CRC_OFF);
}

@@ -728,7 +734,6 @@ xfs_dir3_data_init(
	struct xfs_dir2_data_unused	*dup;
	struct xfs_dir2_data_free 	*bf;
	int				error;
	int				i;

	/*
	 * Get the buffer set up for the block.
@@ -741,13 +746,16 @@ xfs_dir3_data_init(
	xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DIR_DATA_BUF);

	/*
	 * Initialize the header.
	 * Initialize the whole directory header region to zero
	 * so that all padding, bestfree entries, and any
	 * future header fields are clean.
	 */
	hdr = bp->b_addr;
	memset(hdr, 0, geo->data_entry_offset);

	if (xfs_has_crc(mp)) {
		struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;

		memset(hdr3, 0, sizeof(*hdr3));
		hdr3->magic = cpu_to_be32(XFS_DIR3_DATA_MAGIC);
		hdr3->blkno = cpu_to_be64(xfs_buf_daddr(bp));
		hdr3->owner = cpu_to_be64(args->owner);
@@ -759,10 +767,6 @@ xfs_dir3_data_init(
	bf = xfs_dir2_data_bestfree_p(mp, hdr);
	bf[0].offset = cpu_to_be16(geo->data_entry_offset);
	bf[0].length = cpu_to_be16(geo->blksize - geo->data_entry_offset);
	for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) {
		bf[i].length = 0;
		bf[i].offset = 0;
	}

	/*
	 * Set up an unused entry for the block's body.
+1 −2
Original line number Diff line number Diff line
@@ -1414,8 +1414,7 @@ xfs_refcount_finish_one(
	if (rcur == NULL) {
		struct xfs_perag	*pag = to_perag(ri->ri_group);

		error = xfs_alloc_read_agf(pag, tp,
				XFS_ALLOC_FLAG_FREEING, &agbp);
		error = xfs_alloc_read_agf(pag, tp, 0, &agbp);
		if (error)
			return error;

+11 −0
Original line number Diff line number Diff line
@@ -251,6 +251,17 @@ xchk_ino_set_preen(
	trace_xchk_ino_preen(sc, ino, __return_address);
}

/* Record a block indexed by a file fork that could be optimized. */
void
xchk_fblock_set_preen(
	struct xfs_scrub        *sc,
	int                     whichfork,
	xfs_fileoff_t           offset)
{
	sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN;
	trace_xchk_fblock_preen(sc, whichfork, offset, __return_address);
}

/* Record something being wrong with the filesystem primary superblock. */
void
xchk_set_corrupt(
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ bool xchk_fblock_xref_process_error(struct xfs_scrub *sc,
void xchk_block_set_preen(struct xfs_scrub *sc,
		struct xfs_buf *bp);
void xchk_ino_set_preen(struct xfs_scrub *sc, xfs_ino_t ino);
void xchk_fblock_set_preen(struct xfs_scrub *sc,
		int whichfork, xfs_fileoff_t offset);

void xchk_set_corrupt(struct xfs_scrub *sc);
void xchk_block_set_corrupt(struct xfs_scrub *sc,
+6 −1
Original line number Diff line number Diff line
@@ -454,7 +454,12 @@ xchk_da_btree_block(
			}
		}

		/* XXX: Check hdr3.pad32 once we know how to fix it. */
		if (xfs_has_crc(ip->i_mount)) {
			struct xfs_da3_node_hdr *nodehdr3 = blk->bp->b_addr;

			if (nodehdr3->__pad32)
				xchk_da_set_preen(ds, level);
		}
		break;
	default:
		xchk_da_set_corrupt(ds, level);
Loading