linux/fs/xfs
Zhang Tianci 5759aa4f95 xfs: update dir3 leaf block metadata after swap
xfs_da3_swap_lastblock() copy the last block content to the dead block,
but do not update the metadata in it. We need update some metadata
for some kinds of type block, such as dir3 leafn block records its
blkno, we shall update it to the dead block blkno. Otherwise,
before write the xfs_buf to disk, the verify_write() will fail in
blk_hdr->blkno != xfs_buf->b_bn, then xfs will be shutdown.

We will get this warning:

  XFS (dm-0): Metadata corruption detected at xfs_dir3_leaf_verify+0xa8/0xe0 [xfs], xfs_dir3_leafn block 0x178
  XFS (dm-0): Unmount and run xfs_repair
  XFS (dm-0): First 128 bytes of corrupted metadata buffer:
  00000000e80f1917: 00 80 00 0b 00 80 00 07 3d ff 00 00 00 00 00 00  ........=.......
  000000009604c005: 00 00 00 00 00 00 01 a0 00 00 00 00 00 00 00 00  ................
  000000006b6fb2bf: e4 44 e3 97 b5 64 44 41 8b 84 60 0e 50 43 d9 bf  .D...dDA..`.PC..
  00000000678978a2: 00 00 00 00 00 00 00 83 01 73 00 93 00 00 00 00  .........s......
  00000000b28b247c: 99 29 1d 38 00 00 00 00 99 29 1d 40 00 00 00 00  .).8.....).@....
  000000002b2a662c: 99 29 1d 48 00 00 00 00 99 49 11 00 00 00 00 00  .).H.....I......
  00000000ea2ffbb8: 99 49 11 08 00 00 45 25 99 49 11 10 00 00 48 fe  .I....E%.I....H.
  0000000069e86440: 99 49 11 18 00 00 4c 6b 99 49 11 20 00 00 4d 97  .I....Lk.I. ..M.
  XFS (dm-0): xfs_do_force_shutdown(0x8) called from line 1423 of file fs/xfs/xfs_buf.c.  Return address = 00000000c0ff63c1
  XFS (dm-0): Corruption of in-memory data detected.  Shutting down filesystem
  XFS (dm-0): Please umount the filesystem and rectify the problem(s)

>From the log above, we know xfs_buf->b_no is 0x178, but the block's hdr record
its blkno is 0x1a0.

Fixes: 24df33b45e ("xfs: add CRC checking to dir2 leaf blocks")
Signed-off-by: Zhang Tianci <zhangtianci.1997@bytedance.com>
Suggested-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
2023-12-07 14:57:14 +05:30
..
libxfs xfs: update dir3 leaf block metadata after swap 2023-12-07 14:57:14 +05:30
scrub xfs: force small EFIs for reaping btree extents 2023-12-06 18:45:19 -08:00
Kconfig xfs: fix again select in kconfig XFS_ONLINE_SCRUB_STATS 2023-11-13 09:11:41 +05:30
kmem.c
kmem.h
Makefile xfs: implement block reservation accounting for btrees we're staging 2023-12-06 18:45:18 -08:00
mrlock.h
xfs_acl.c xfs: convert to ctime accessor functions 2023-07-24 10:30:06 +02:00
xfs_acl.h fs: port ->set_acl() to pass mnt_idmap 2023-01-19 09:24:27 +01:00
xfs_aops.c New code for 6.6: 2023-08-30 12:34:12 -07:00
xfs_aops.h
xfs_attr_inactive.c xfs: make inode unlinked bucket recovery work with quotacheck 2023-09-12 10:31:07 -07:00
xfs_attr_item.c xfs: elide ->create_done calls for unlogged deferred work 2023-12-06 18:45:17 -08:00
xfs_attr_item.h
xfs_attr_list.c
xfs_bio_io.c
xfs_bmap_item.c xfs: move ->iop_relog to struct xfs_defer_op_type 2023-12-06 18:45:17 -08:00
xfs_bmap_item.h
xfs_bmap_util.c New code for 6.7: 2023-11-08 13:22:16 -08:00
xfs_bmap_util.h
xfs_buf_item_recover.c xfs: verify buffer contents when we skip log replay 2023-04-12 15:49:23 +10:00
xfs_buf_item.c xfs: buffer pins need to hold a buffer reference 2023-06-05 04:05:27 +10:00
xfs_buf_item.h
xfs_buf.c Many singleton patches against the MM code. The patch series which are 2023-11-02 19:38:47 -10:00
xfs_buf.h Many singleton patches against the MM code. The patch series which are 2023-11-02 19:38:47 -10:00
xfs_dahash_test.c xfs: test the ascii case-insensitive hash 2023-04-11 19:05:05 -07:00
xfs_dahash_test.h xfs: test dir/attr hash when loading module 2023-03-19 09:55:49 -07:00
xfs_dir2_readdir.c
xfs_discard.c xfs: abort fstrim if kernel is suspending 2023-10-04 09:25:04 +11:00
xfs_discard.h xfs: move log discard work to xfs_discard.c 2023-10-04 09:24:02 +11:00
xfs_dquot_item_recover.c xfs: dquot recovery does not validate the recovered dquot 2023-11-22 23:39:36 +05:30
xfs_dquot_item.c
xfs_dquot_item.h
xfs_dquot.c xfs: clean up dqblk extraction 2023-11-22 23:39:27 +05:30
xfs_dquot.h
xfs_drain.c xfs: minimize overhead of drain wakeups by using jump labels 2023-04-11 18:59:59 -07:00
xfs_drain.h xfs: minimize overhead of drain wakeups by using jump labels 2023-04-11 18:59:59 -07:00
xfs_error.c xfs: make kobj_type structures constant 2023-02-10 08:59:48 -08:00
xfs_error.h xfs: allow setting full range of panic tags 2023-02-09 18:36:17 -08:00
xfs_export.c xfs: fix reloading entire unlinked bucket lists 2023-09-24 18:12:13 -07:00
xfs_export.h
xfs_extent_busy.c xfs: process free extents to busy list in FIFO order 2023-10-11 12:35:21 -07:00
xfs_extent_busy.h xfs: reduce AGF hold times during fstrim operations 2023-10-04 09:24:52 +11:00
xfs_extfree_item.c xfs: automatic freeing of freshly allocated unwritten space 2023-12-06 18:45:18 -08:00
xfs_extfree_item.h
xfs_file.c xfs: allow read IO and FICLONE to run concurrently 2023-10-23 12:02:26 +05:30
xfs_filestream.c xfs: fix double xfs_perag_rele() in xfs_filestream_pick_ag() 2023-06-05 14:48:15 +10:00
xfs_filestream.h xfs: pass perag to filestreams tracing 2023-02-13 09:14:56 +11:00
xfs_fsmap.c xfs: convert do_div calls to xfs_rtb_to_rtx helper calls 2023-10-17 16:25:55 -07:00
xfs_fsmap.h
xfs_fsops.c xfs: clean up the xfs_reserve_blocks interface 2023-12-07 14:51:07 +05:30
xfs_fsops.h xfs: clean up xfs_fsops.h 2023-12-07 14:51:07 +05:30
xfs_globals.c xfs: allow setting full range of panic tags 2023-02-09 18:36:17 -08:00
xfs_health.c
xfs_icache.c xfs: dynamically allocate the xfs-inodegc shrinker 2023-10-04 10:32:26 -07:00
xfs_icache.h xfs: use per-mount cpumask to track nonempty percpu inodegc lists 2023-09-11 08:39:03 -07:00
xfs_icreate_item.c
xfs_icreate_item.h
xfs_inode_item_recover.c xfs: recovery should not clear di_flushiter unconditionally 2023-11-13 09:11:41 +05:30
xfs_inode_item.c New code for 6.7: 2023-11-08 13:22:16 -08:00
xfs_inode_item.h xfs: fix AGF vs inode cluster buffer deadlock 2023-06-05 04:08:27 +10:00
xfs_inode.c New code for 6.7: 2023-11-08 13:22:16 -08:00
xfs_inode.h xfs: respect the stable writes flag on the RT device 2023-11-20 15:05:19 +01:00
xfs_ioctl32.c fs: port i_{g,u}id_into_vfs{g,u}id() to mnt_idmap 2023-01-19 09:24:29 +01:00
xfs_ioctl32.h arch: Remove Itanium (IA-64) architecture 2023-09-11 08:13:17 +00:00
xfs_ioctl.c xfs: clean up the xfs_reserve_blocks interface 2023-12-07 14:51:07 +05:30
xfs_ioctl.h fs: port ->fileattr_set() to pass mnt_idmap 2023-01-19 09:24:27 +01:00
xfs_iomap.c xfs: don't allocate into the data fork for an unshare request 2023-05-02 09:14:51 +10:00
xfs_iomap.h
xfs_iops.c xfs: respect the stable writes flag on the RT device 2023-11-20 15:05:19 +01:00
xfs_iops.h fs: port ->setattr() to pass mnt_idmap 2023-01-19 09:24:02 +01:00
xfs_itable.c xfs: convert to new timestamp accessors 2023-10-18 14:08:29 +02:00
xfs_itable.h fs: port i_{g,u}id_into_vfs{g,u}id() to mnt_idmap 2023-01-19 09:24:29 +01:00
xfs_iunlink_item.c xfs: create traced helper to get extra perag references 2023-04-11 18:59:55 -07:00
xfs_iunlink_item.h
xfs_iwalk.c xfs: create traced helper to get extra perag references 2023-04-11 18:59:55 -07:00
xfs_iwalk.h
xfs_linux.h xfs: use shifting and masking when converting rt extents, if possible 2023-10-17 16:26:25 -07:00
xfs_log_cil.c xfs: move log discard work to xfs_discard.c 2023-10-04 09:24:02 +11:00
xfs_log_priv.h xfs: use xfs_defer_pending objects to recover intent items 2023-12-06 18:45:14 -08:00
xfs_log_recover.c xfs: move ->iop_recover to xfs_defer_op_type 2023-12-06 18:45:15 -08:00
xfs_log.c xfs: use xfs_defer_pending objects to recover intent items 2023-12-06 18:45:14 -08:00
xfs_log.h
xfs_message.c
xfs_message.h
xfs_mount.c xfs: clean up the xfs_reserve_blocks interface 2023-12-07 14:51:07 +05:30
xfs_mount.h New code for 6.7: 2023-11-08 13:22:16 -08:00
xfs_mru_cache.c
xfs_mru_cache.h
xfs_notify_failure.c mm, pmem, xfs: Introduce MF_MEM_PRE_REMOVE for unbind 2023-12-07 14:34:26 +05:30
xfs_ondisk.h xfs: use accessor functions for summary info words 2023-10-18 16:53:00 -07:00
xfs_pnfs.c fs: port ->setattr() to pass mnt_idmap 2023-01-19 09:24:02 +01:00
xfs_pnfs.h
xfs_pwork.c
xfs_pwork.h
xfs_qm_bhv.c
xfs_qm_syscalls.c
xfs_qm.c xfs: dynamically allocate the xfs-qm shrinker 2023-10-04 10:32:26 -07:00
xfs_qm.h xfs: dynamically allocate the xfs-qm shrinker 2023-10-04 10:32:26 -07:00
xfs_quota.h
xfs_quotaops.c
xfs_refcount_item.c xfs: move ->iop_relog to struct xfs_defer_op_type 2023-12-06 18:45:17 -08:00
xfs_refcount_item.h
xfs_reflink.c xfs: remove __xfs_free_extent_later 2023-12-06 18:45:18 -08:00
xfs_reflink.h
xfs_rmap_item.c xfs: move ->iop_relog to struct xfs_defer_op_type 2023-12-06 18:45:17 -08:00
xfs_rmap_item.h
xfs_rtalloc.c xfs: don't allow overly small or large realtime volumes 2023-12-06 18:45:17 -08:00
xfs_rtalloc.h xfs: convert rt extent numbers to xfs_rtxnum_t 2023-10-17 16:24:22 -07:00
xfs_stats.c
xfs_stats.h
xfs_super.c xfs: clean up the xfs_reserve_blocks interface 2023-12-07 14:51:07 +05:30
xfs_super.h xfs: create scaffolding for creating debugfs entries 2023-08-10 07:48:07 -07:00
xfs_symlink.c fs: port fs{g,u}id helpers to mnt_idmap 2023-01-19 09:24:30 +01:00
xfs_symlink.h fs: port inode_init_owner() to mnt_idmap 2023-01-19 09:24:28 +01:00
xfs_sysctl.c xfs: simplify two-level sysctl registration for xfs_table 2023-04-13 11:49:35 -07:00
xfs_sysctl.h
xfs_sysfs.c xfs: document what LARP means 2023-12-06 18:45:17 -08:00
xfs_sysfs.h xfs: make kobj_type structures constant 2023-02-10 08:59:48 -08:00
xfs_trace.c xfs: add debug knob to slow down writeback for fun 2022-11-28 17:24:35 -08:00
xfs_trace.h xfs: allow pausing of pending deferred work items 2023-12-06 18:45:18 -08:00
xfs_trans_ail.c xfs: don't reverse order of items in bulk AIL insertion 2023-06-29 09:28:23 -07:00
xfs_trans_buf.c
xfs_trans_dquot.c
xfs_trans_priv.h
xfs_trans.c xfs: use shifting and masking when converting rt extents, if possible 2023-10-17 16:26:25 -07:00
xfs_trans.h xfs: move ->iop_relog to struct xfs_defer_op_type 2023-12-06 18:45:17 -08:00
xfs_xattr.c vfs-6.7.xattr 2023-10-30 09:29:44 -10:00
xfs_xattr.h xfs: move xfs_xattr_handlers to .rodata 2023-10-10 13:49:20 +02:00
xfs.h