linux/fs/xfs
Carlos Maiolino 8c81dd46ef Force log to disk before reading the AGF during a fstrim
Forcing the log to disk after reading the agf is wrong, we might be
calling xfs_log_force with XFS_LOG_SYNC with a metadata lock held.

This can cause a deadlock when racing a fstrim with a filesystem
shutdown.

The deadlock has been identified due a miscalculation bug in device-mapper
dm-thin, which returns lack of space to its users earlier than the device itself
really runs out of space, changing the device-mapper volume into an error state.

The problem happened while filling the filesystem with a single file,
triggering the bug in device-mapper, consequently causing an IO error
and shutting down the filesystem.

If such file is removed, and fstrim executed before the XFS finishes the
shut down process, the fstrim process will end up holding the buffer
lock, and going to sleep on the cil wait queue.

At this point, the shut down process will try to wake up all the threads
waiting on the cil wait queue, but for this, it will try to hold the
same buffer log already held my the fstrim, locking up the filesystem.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
2018-04-10 22:39:04 -07:00
..
libxfs xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
scrub xfs: xfs_scrub_iallocbt_xref_rmap_inodes should use xref_set_corrupt 2018-03-23 18:05:09 -07:00
Kconfig
Makefile
kmem.c xfs: fall back to vmalloc when allocation log vector buffers 2018-03-11 20:27:55 -07:00
kmem.h xfs: fall back to vmalloc when allocation log vector buffers 2018-03-11 20:27:55 -07:00
mrlock.h
xfs.h
xfs_acl.c
xfs_acl.h
xfs_aops.c Export __set_page_dirty 2018-04-10 22:39:01 -07:00
xfs_aops.h
xfs_attr.h
xfs_attr_inactive.c
xfs_attr_list.c
xfs_bmap_item.c xfs: fix intent use-after-free on abort 2018-04-02 20:08:27 -07:00
xfs_bmap_item.h
xfs_bmap_util.c xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_bmap_util.h
xfs_buf.c xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_buf.h xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_buf_item.c xfs: Rename xa_ elements to ail_ 2018-03-11 20:27:56 -07:00
xfs_buf_item.h Use list_head infra-structure for buffer's log items list 2018-01-29 07:27:22 -08:00
xfs_dir2_readdir.c xfs: directory scrubber must walk through data block to offset 2018-01-17 21:00:46 -08:00
xfs_discard.c Force log to disk before reading the AGF during a fstrim 2018-04-10 22:39:04 -07:00
xfs_discard.h
xfs_dquot.c xfs: Rename xa_ elements to ail_ 2018-03-11 20:27:56 -07:00
xfs_dquot.h
xfs_dquot_item.c xfs: Rename xa_ elements to ail_ 2018-03-11 20:27:56 -07:00
xfs_dquot_item.h
xfs_error.c xfs: refactor inode buffer verifier error logging 2018-03-23 18:05:07 -07:00
xfs_error.h xfs: refactor inode buffer verifier error logging 2018-03-23 18:05:07 -07:00
xfs_export.c xfs: merge _xfs_log_force_lsn and xfs_log_force_lsn 2018-03-14 11:12:52 -07:00
xfs_export.h
xfs_extent_busy.c xfs: merge _xfs_log_force and xfs_log_force 2018-03-14 11:12:52 -07:00
xfs_extent_busy.h
xfs_extfree_item.c xfs: fix intent use-after-free on abort 2018-04-02 20:08:27 -07:00
xfs_extfree_item.h
xfs_file.c xfs: remove xfs_zero_range 2018-03-15 10:31:38 -07:00
xfs_filestream.c xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_filestream.h
xfs_fsmap.c
xfs_fsmap.h
xfs_fsops.c xfs: convert XFS_AGFL_SIZE to a helper function 2018-03-11 20:27:56 -07:00
xfs_fsops.h xfs: hoist xfs_fs_geometry to libxfs 2018-01-08 10:54:48 -08:00
xfs_globals.c
xfs_icache.c xfs: catch inode allocation state mismatch corruption 2018-03-23 18:05:09 -07:00
xfs_icache.h
xfs_icreate_item.c
xfs_icreate_item.h
xfs_inode.c xfs: only cancel cow blocks when truncating the data fork 2018-04-10 08:28:33 -07:00
xfs_inode.h xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_inode_item.c xfs: remove an outdated comment for xfs_inode_item_committing 2018-03-14 11:12:51 -07:00
xfs_inode_item.h
xfs_ioctl.c xfs: refactor the geometry structure filling function 2018-01-08 10:54:48 -08:00
xfs_ioctl.h
xfs_ioctl32.c xfs: refactor the geometry structure filling function 2018-01-08 10:54:48 -08:00
xfs_ioctl32.h
xfs_iomap.c xfs: don't block on the ilock for RWF_NOWAIT 2018-03-01 14:12:45 -08:00
xfs_iomap.h
xfs_iops.c xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_iops.h
xfs_itable.c
xfs_itable.h
xfs_linux.h xfs: use %px for data pointers when debugging 2018-01-12 14:09:08 -08:00
xfs_log.c xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_log.h xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_log_cil.c xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_log_priv.h
xfs_log_recover.c xfs: do not log/recover swapext extent owner changes for deleted inodes 2018-03-29 10:19:15 -07:00
xfs_message.c
xfs_message.h
xfs_mount.c xfs: clean up xfs_mount allocation and dynamic initializers 2018-03-26 08:54:15 -07:00
xfs_mount.h xfs: detect agfl count corruption and reset agfl 2018-03-23 18:05:06 -07:00
xfs_mru_cache.c xfs: remove filestream item xfs_inode reference 2018-04-09 10:23:39 -07:00
xfs_mru_cache.h xfs: remove filestream item xfs_inode reference 2018-04-09 10:23:39 -07:00
xfs_ondisk.h
xfs_pnfs.c
xfs_pnfs.h
xfs_qm.c xfs: Remove "committed" argument of xfs_dir_ialloc 2018-04-02 15:47:43 -07:00
xfs_qm.h
xfs_qm_bhv.c
xfs_qm_syscalls.c
xfs_quota.h
xfs_quotaops.c
xfs_refcount_item.c xfs: fix intent use-after-free on abort 2018-04-02 20:08:27 -07:00
xfs_refcount_item.h
xfs_reflink.c xfs: minor cleanup for xfs_reflink_end_cow 2018-03-15 10:31:38 -07:00
xfs_reflink.h
xfs_rmap_item.c xfs: fix intent use-after-free on abort 2018-04-02 20:08:27 -07:00
xfs_rmap_item.h
xfs_rtalloc.c
xfs_rtalloc.h xfs: cross-reference the realtime bitmap 2018-01-17 21:00:46 -08:00
xfs_stats.c
xfs_stats.h
xfs_super.c xfs: non-scrub - remove unused function parameters 2018-04-09 10:23:42 -07:00
xfs_super.h xfs: add scrub to XFS_BUILD_OPTIONS 2018-02-01 21:06:15 -08:00
xfs_symlink.c xfs: Remove "committed" argument of xfs_dir_ialloc 2018-04-02 15:47:43 -07:00
xfs_symlink.h
xfs_sysctl.c
xfs_sysctl.h
xfs_sysfs.c
xfs_sysfs.h
xfs_trace.c
xfs_trace.h xfs: remove filestream item xfs_inode reference 2018-04-09 10:23:39 -07:00
xfs_trans.c xfs: merge _xfs_log_force_lsn and xfs_log_force_lsn 2018-03-14 11:12:52 -07:00
xfs_trans.h Use list_head infra-structure for buffer's log items list 2018-01-29 07:27:22 -08:00
xfs_trans_ail.c xfs: Rename xa_ elements to ail_ 2018-03-11 20:27:56 -07:00
xfs_trans_bmap.c
xfs_trans_buf.c xfs: Rename xa_ elements to ail_ 2018-03-11 20:27:56 -07:00
xfs_trans_dquot.c
xfs_trans_extfree.c
xfs_trans_inode.c xfs: implement the lazytime mount option 2018-03-11 20:27:55 -07:00
xfs_trans_priv.h xfs: Rename xa_ elements to ail_ 2018-03-11 20:27:56 -07:00
xfs_trans_refcount.c
xfs_trans_rmap.c
xfs_xattr.c