Skip to content

Commit d58c6ff

Browse files
committed
Merge tag 'for-linus-v3.10-rc6' of git://oss.sgi.com/xfs/xfs
Pull xfs fixes from Ben Myers: - Remove noisy warnings about experimental support which spams the logs - Add padding to align directory and attr structures correctly - Set block number on child buffer on a root btree split - Disable verifiers during log recovery for non-CRC filesystems * tag 'for-linus-v3.10-rc6' of git://oss.sgi.com/xfs/xfs: xfs: don't shutdown log recovery on validation errors xfs: ensure btree root split sets blkno correctly xfs: fix implicit padding in directory and attr CRC formats xfs: don't emit v5 superblock warnings on write
2 parents 9bb9285 + d302cf1 commit d58c6ff

File tree

5 files changed

+42
-11
lines changed

5 files changed

+42
-11
lines changed

fs/xfs/xfs_attr_leaf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ struct xfs_attr3_leaf_hdr {
128128
__u8 holes;
129129
__u8 pad1;
130130
struct xfs_attr_leaf_map freemap[XFS_ATTR_LEAF_MAPSIZE];
131+
__be32 pad2; /* 64 bit alignment */
131132
};
132133

133134
#define XFS_ATTR3_LEAF_CRC_OFF (offsetof(struct xfs_attr3_leaf_hdr, info.crc))

fs/xfs/xfs_btree.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2544,7 +2544,17 @@ xfs_btree_new_iroot(
25442544
if (error)
25452545
goto error0;
25462546

2547+
/*
2548+
* we can't just memcpy() the root in for CRC enabled btree blocks.
2549+
* In that case have to also ensure the blkno remains correct
2550+
*/
25472551
memcpy(cblock, block, xfs_btree_block_len(cur));
2552+
if (cur->bc_flags & XFS_BTREE_CRC_BLOCKS) {
2553+
if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
2554+
cblock->bb_u.l.bb_blkno = cpu_to_be64(cbp->b_bn);
2555+
else
2556+
cblock->bb_u.s.bb_blkno = cpu_to_be64(cbp->b_bn);
2557+
}
25482558

25492559
be16_add_cpu(&block->bb_level, 1);
25502560
xfs_btree_set_numrecs(block, 1);

fs/xfs/xfs_dir2_format.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ struct xfs_dir3_blk_hdr {
266266
struct xfs_dir3_data_hdr {
267267
struct xfs_dir3_blk_hdr hdr;
268268
xfs_dir2_data_free_t best_free[XFS_DIR2_DATA_FD_COUNT];
269+
__be32 pad; /* 64 bit alignment */
269270
};
270271

271272
#define XFS_DIR3_DATA_CRC_OFF offsetof(struct xfs_dir3_data_hdr, hdr.crc)
@@ -477,7 +478,7 @@ struct xfs_dir3_leaf_hdr {
477478
struct xfs_da3_blkinfo info; /* header for da routines */
478479
__be16 count; /* count of entries */
479480
__be16 stale; /* count of stale entries */
480-
__be32 pad;
481+
__be32 pad; /* 64 bit alignment */
481482
};
482483

483484
struct xfs_dir3_icleaf_hdr {
@@ -715,7 +716,7 @@ struct xfs_dir3_free_hdr {
715716
__be32 firstdb; /* db of first entry */
716717
__be32 nvalid; /* count of valid entries */
717718
__be32 nused; /* count of used entries */
718-
__be32 pad; /* 64 bit alignment. */
719+
__be32 pad; /* 64 bit alignment */
719720
};
720721

721722
struct xfs_dir3_free {

fs/xfs/xfs_log_recover.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,13 @@ xlog_recover_do_inode_buffer(
18451845
xfs_agino_t *buffer_nextp;
18461846

18471847
trace_xfs_log_recover_buf_inode_buf(mp->m_log, buf_f);
1848-
bp->b_ops = &xfs_inode_buf_ops;
1848+
1849+
/*
1850+
* Post recovery validation only works properly on CRC enabled
1851+
* filesystems.
1852+
*/
1853+
if (xfs_sb_version_hascrc(&mp->m_sb))
1854+
bp->b_ops = &xfs_inode_buf_ops;
18491855

18501856
inodes_per_buf = BBTOB(bp->b_io_length) >> mp->m_sb.sb_inodelog;
18511857
for (i = 0; i < inodes_per_buf; i++) {
@@ -2205,7 +2211,16 @@ xlog_recover_do_reg_buffer(
22052211
/* Shouldn't be any more regions */
22062212
ASSERT(i == item->ri_total);
22072213

2208-
xlog_recovery_validate_buf_type(mp, bp, buf_f);
2214+
/*
2215+
* We can only do post recovery validation on items on CRC enabled
2216+
* fielsystems as we need to know when the buffer was written to be able
2217+
* to determine if we should have replayed the item. If we replay old
2218+
* metadata over a newer buffer, then it will enter a temporarily
2219+
* inconsistent state resulting in verification failures. Hence for now
2220+
* just avoid the verification stage for non-crc filesystems
2221+
*/
2222+
if (xfs_sb_version_hascrc(&mp->m_sb))
2223+
xlog_recovery_validate_buf_type(mp, bp, buf_f);
22092224
}
22102225

22112226
/*

fs/xfs/xfs_mount.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ STATIC int
314314
xfs_mount_validate_sb(
315315
xfs_mount_t *mp,
316316
xfs_sb_t *sbp,
317-
bool check_inprogress)
317+
bool check_inprogress,
318+
bool check_version)
318319
{
319320

320321
/*
@@ -337,9 +338,10 @@ xfs_mount_validate_sb(
337338

338339
/*
339340
* Version 5 superblock feature mask validation. Reject combinations the
340-
* kernel cannot support up front before checking anything else.
341+
* kernel cannot support up front before checking anything else. For
342+
* write validation, we don't need to check feature masks.
341343
*/
342-
if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) {
344+
if (check_version && XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) {
343345
xfs_alert(mp,
344346
"Version 5 superblock detected. This kernel has EXPERIMENTAL support enabled!\n"
345347
"Use of these features in this kernel is at your own risk!");
@@ -675,7 +677,8 @@ xfs_sb_to_disk(
675677

676678
static int
677679
xfs_sb_verify(
678-
struct xfs_buf *bp)
680+
struct xfs_buf *bp,
681+
bool check_version)
679682
{
680683
struct xfs_mount *mp = bp->b_target->bt_mount;
681684
struct xfs_sb sb;
@@ -686,7 +689,8 @@ xfs_sb_verify(
686689
* Only check the in progress field for the primary superblock as
687690
* mkfs.xfs doesn't clear it from secondary superblocks.
688691
*/
689-
return xfs_mount_validate_sb(mp, &sb, bp->b_bn == XFS_SB_DADDR);
692+
return xfs_mount_validate_sb(mp, &sb, bp->b_bn == XFS_SB_DADDR,
693+
check_version);
690694
}
691695

692696
/*
@@ -719,7 +723,7 @@ xfs_sb_read_verify(
719723
goto out_error;
720724
}
721725
}
722-
error = xfs_sb_verify(bp);
726+
error = xfs_sb_verify(bp, true);
723727

724728
out_error:
725729
if (error) {
@@ -758,7 +762,7 @@ xfs_sb_write_verify(
758762
struct xfs_buf_log_item *bip = bp->b_fspriv;
759763
int error;
760764

761-
error = xfs_sb_verify(bp);
765+
error = xfs_sb_verify(bp, false);
762766
if (error) {
763767
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr);
764768
xfs_buf_ioerror(bp, error);

0 commit comments

Comments
 (0)