mirror-linux/fs/xfs
Christoph Hellwig c69439a891 xfs: fix a buffer lookup against removal race
When a buffer is freed either by LRU eviction or because it is unset,
the lockref is marked as dead instantly, which prevents the buffer from
being used after finding it in the buffer hash in xfs_buf_lookup and
xfs_buf_find_insert.  But the latter will then not add the new buffer to
the hash because it already found an existing buffer.

Fix this using in two places:  Remove the buffer from the hash before
marking the lockref dead so that that no buffer with a dead lockref can
be found in the hash, but if we find one in xfs_buf_find_insert due to
store reordering, handle this case correctly instead of returning an
unhashed buffer.

Fixes: 67fe430397 ("xfs: don't keep a reference for buffers on the LRU")
Reported-by: Andrey Albershteyn <aalbersh@redhat.com>
Reported-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
2026-05-21 13:43:58 +02:00
..
libxfs xfs: zero directory data block padding on write verification 2026-04-27 10:36:36 +02:00
scrub xfs: check da node block pad field during scrub 2026-04-27 10:36:36 +02:00
Kconfig xfs: XFS_ONLINE_SCRUB_STATS should depend on DEBUG_FS 2025-10-21 09:52:59 +02:00
Makefile xfs: add media verification ioctl 2026-01-20 18:06:52 -08:00
xfs_acl.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_acl.h
xfs_aops.c xfs: support T10 protection information 2026-03-10 10:29:17 +01:00
xfs_aops.h
xfs_attr_inactive.c xfs: close crash window in attr dabtree inactivation 2026-03-23 10:47:28 +01:00
xfs_attr_item.c xfs: don't irele after failing to iget in xfs_attri_recover_work 2026-03-26 14:25:06 +01:00
xfs_attr_item.h xfs: don't use a xfs_log_iovec for attr_item names and values 2025-07-24 17:30:15 +02:00
xfs_attr_list.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_bio_io.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_bmap_item.c xfs: fix integer overflow in bmap intent sort comparator 2026-03-11 13:21:42 +01:00
xfs_bmap_item.h
xfs_bmap_util.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_bmap_util.h
xfs_buf.c xfs: fix a buffer lookup against removal race 2026-05-21 13:43:58 +02:00
xfs_buf.h xfs: switch (back) to a per-buftarg buffer hash 2026-03-30 16:34:05 +02:00
xfs_buf_item.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_buf_item.h xfs: don't use a xfs_log_iovec for ri_buf in log recovery 2025-07-24 17:30:15 +02:00
xfs_buf_item_recover.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xfs_buf_mem.c xfs: switch (back) to a per-buftarg buffer hash 2026-03-30 16:34:05 +02:00
xfs_buf_mem.h
xfs_dahash_test.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_dahash_test.h
xfs_dir2_readdir.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_discard.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xfs_discard.h xfs: ignore discard return value 2025-12-16 08:49:56 +01:00
xfs_dquot.c xfs: ensure dquot item is deleted from AIL only after log shutdown 2026-03-10 09:40:38 +01:00
xfs_dquot.h xfs: remove xfs_qm_dqput and optimize dropping dquot references 2025-11-11 11:45:58 +01:00
xfs_dquot_item.c xfs: save ailp before dropping the AIL lock in push callbacks 2026-03-18 09:40:31 +01:00
xfs_dquot_item.h
xfs_dquot_item_recover.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_drain.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_drain.h
xfs_error.c xfs: allow setting errortags at mount time 2026-01-30 10:41:42 +01:00
xfs_error.h xfs: allow setting errortags at mount time 2026-01-30 10:41:42 +01:00
xfs_exchmaps_item.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_exchmaps_item.h
xfs_exchrange.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_exchrange.h
xfs_export.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_export.h
xfs_extent_busy.c xfs: fix integer overflow in busy extent sort comparator 2026-04-07 13:08:27 +02:00
xfs_extent_busy.h xfs: don't allocate the xfs_extent_busy structure for zoned RTGs 2025-07-18 17:42:31 +02:00
xfs_extfree_item.c xfs: fix integer overflow in deferred intent sort comparators 2026-04-07 13:08:27 +02:00
xfs_extfree_item.h xfs: remove the xfs_efd_log_format_t typedef 2025-09-16 12:25:05 +02:00
xfs_file.c xfs: flush eof folio before insert range size update 2026-03-23 11:07:59 +01:00
xfs_file.h
xfs_filestream.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfs_filestream.h
xfs_fsmap.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xfs_fsmap.h
xfs_fsops.c xfs: Refactoring the nagcount and delta calculation 2026-02-25 13:58:48 +01:00
xfs_fsops.h
xfs_globals.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_handle.c xfs: annotate struct xfs_attr_list_context with __counted_by_ptr 2026-03-18 09:54:39 +01:00
xfs_handle.h
xfs_health.c xfs: don't report half-built inodes to fserror 2026-02-25 13:58:49 +01:00
xfs_healthmon.c xfs: fix race between healthmon unmount and read_iter 2026-03-04 10:11:47 +01:00
xfs_healthmon.h xfs: convey file I/O errors to the health monitor 2026-01-20 18:06:50 -08:00
xfs_hooks.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_hooks.h
xfs_icache.c xfs: remove redundant set null for ip->i_itemp 2026-03-10 09:39:53 +01:00
xfs_icache.h
xfs_icreate_item.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_icreate_item.h
xfs_inode.c xfs: flush delalloc blocks on ENOSPC in xfs_trans_alloc_icreate 2026-04-27 11:31:15 +02:00
xfs_inode.h xfs: disallow atomic writes on DAX 2025-08-11 14:03:44 +02:00
xfs_inode_item.c xfs: save ailp before dropping the AIL lock in push callbacks 2026-03-18 09:40:31 +01:00
xfs_inode_item.h xfs: rework datasync tracking and execution 2025-09-23 15:12:43 +02:00
xfs_inode_item_recover.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfs_ioctl.c xfs: add write pointer to xfs_rtgroup_geometry 2026-03-04 09:58:24 +01:00
xfs_ioctl.h
xfs_ioctl32.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_ioctl32.h
xfs_iomap.c xfs: new code for Linux 7.1 2026-04-13 17:03:48 -07:00
xfs_iomap.h iomap: replace iomap_folio_ops with iomap_write_ops 2025-07-14 10:51:33 +02:00
xfs_iops.c xfs: fold xfs_setattr_size into xfs_vn_setattr_size 2026-04-07 13:03:52 +02:00
xfs_iops.h
xfs_itable.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfs_itable.h xfs: remove XFS_IBULK_SAME_AG 2025-08-11 14:03:31 +02:00
xfs_iunlink_item.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_iunlink_item.h
xfs_iwalk.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfs_iwalk.h
xfs_log.c xfs: fix undersized l_iclog_roundoff values 2026-03-10 16:19:31 +01:00
xfs_log.h xfs: move struct xfs_log_vec to xfs_log_priv.h 2026-01-21 12:57:16 +01:00
xfs_log_cil.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfs_log_priv.h xfs: move struct xfs_log_vec to xfs_log_priv.h 2026-01-21 12:57:16 +01:00
xfs_log_recover.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfs_message.c xfs: promote metadata directories and large block support 2026-01-21 12:57:17 +01:00
xfs_message.h xfs: promote metadata directories and large block support 2026-01-21 12:57:17 +01:00
xfs_mount.c Merge branch 'xfs-7.1-merge' into for-next 2026-03-23 11:11:13 +01:00
xfs_mount.h xfs: Use xarray to track SB UUIDs instead of plain array. 2026-03-23 10:40:18 +01:00
xfs_mru_cache.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfs_mru_cache.h
xfs_notify_failure.c xfs: Fix typo in comment 2026-05-11 12:58:38 +02:00
xfs_notify_failure.h
xfs_platform.h xfs: Add comments for usages of some macros. 2026-02-25 13:58:49 +01:00
xfs_pnfs.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_pnfs.h
xfs_pwork.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_pwork.h
xfs_qm.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfs_qm.h xfs: make qi_dquots a 64-bit value 2025-11-11 11:45:57 +01:00
xfs_qm_bhv.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_qm_syscalls.c xfs: return default quota limits for IDs without a dquot 2026-03-31 12:51:41 +02:00
xfs_quota.h
xfs_quotaops.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_refcount_item.c xfs: fix integer overflow in deferred intent sort comparators 2026-04-07 13:08:27 +02:00
xfs_refcount_item.h
xfs_reflink.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_reflink.h xfs: use the new ->i_state accessors 2025-10-20 20:22:27 +02:00
xfs_rmap_item.c xfs: fix integer overflow in deferred intent sort comparators 2026-04-07 13:08:27 +02:00
xfs_rmap_item.h
xfs_rtalloc.c xfs: Update lazy counters in xfs_growfs_rt_bmblock() 2026-02-25 13:58:49 +01:00
xfs_rtalloc.h
xfs_stats.c xfs: remove metafile inodes from the active inode stat 2026-02-25 13:58:48 +01:00
xfs_stats.h xfs: remove metafile inodes from the active inode stat 2026-02-25 13:58:48 +01:00
xfs_super.c xfs: cleanup inode counter stats 2026-02-25 13:58:48 +01:00
xfs_super.h
xfs_symlink.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_symlink.h
xfs_sysctl.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_sysctl.h xfs: remove deprecated sysctl knobs 2025-09-05 08:48:23 -07:00
xfs_sysfs.c xfs: expose the number of open zones in sysfs 2026-04-07 13:28:47 +02:00
xfs_sysfs.h
xfs_trace.c xfs: autonomous self healing of filesystems [v7] 2026-01-28 10:02:20 +01:00
xfs_trace.h xfs: add a separate tracepoint for stealing an open zone for GC 2026-04-07 13:28:47 +02:00
xfs_trans.c xfs: flush delalloc blocks on ENOSPC in xfs_trans_alloc_icreate 2026-04-27 11:31:15 +02:00
xfs_trans.h xfs: fix incorrect context handling in xfs_trans_roll 2026-01-21 12:59:10 +01:00
xfs_trans_ail.c xfs: refactor xfsaild_push loop into helper 2026-03-18 09:40:31 +01:00
xfs_trans_buf.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_trans_dquot.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
xfs_trans_priv.h
xfs_verify_media.c xfs: cleanup buftarg handling in XFS_IOC_VERIFY_MEDIA 2026-03-18 09:52:33 +01:00
xfs_verify_media.h xfs: add media verification ioctl 2026-01-20 18:06:52 -08:00
xfs_xattr.c xfs: annotate struct xfs_attr_list_context with __counted_by_ptr 2026-03-18 09:54:39 +01:00
xfs_xattr.h
xfs_zone_alloc.c xfs: fix the "limiting open zones" message 2026-05-11 12:51:57 +02:00
xfs_zone_alloc.h xfs: start gc on zonegc_low_space attribute updates 2026-03-30 16:34:05 +02:00
xfs_zone_gc.c xfs: fix memory leak for data allocated by xfs_zone_gc_data_alloc() 2026-04-27 10:36:36 +02:00
xfs_zone_info.c xfs: untangle the open zones reporting in mountinfo 2026-04-07 13:28:47 +02:00
xfs_zone_priv.h xfs: reduce special casing for the open GC zone 2026-04-07 13:28:47 +02:00
xfs_zone_space_resv.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00