linux-stable/fs/xfs
Darrick J. Wong 81b549aa62 xfs: return from _defer_finish with a clean transaction
The following assertion was seen on generic/051:

XFS: Assertion failed: tp->t_firstblock == NULLFSBLOCK, file: fs/xfs/libxfs5
------------[ cut here ]------------
kernel BUG at fs/xfs/xfs_message.c:102!
invalid opcode: 0000 [#1] SMP PTI
CPU: 2 PID: 20757 Comm: fsstress Not tainted 4.18.0-rc4+ #3969
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.1-1 04/01/4
RIP: 0010:assfail+0x23/0x30
Code: c3 66 0f 1f 44 00 00 48 89 f1 41 89 d0 48 c7 c6 88 e0 8c 82 48 89 fa
RSP: 0018:ffff88012dc43c08 EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffff88012dc43ca0 RCX: 0000000000000000
RDX: 00000000ffffffc0 RSI: 000000000000000a RDI: ffffffff828480eb
RBP: ffff88012aa92758 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: f000000000000000 R12: 0000000000000000
R13: ffff88012dc43d48 R14: ffff88013092e7e8 R15: 0000000000000014
FS:  00007f8d689b8e80(0000) GS:ffff88013fd00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8d689c7000 CR3: 000000012ba6a000 CR4: 00000000000006e0
Call Trace:
 xfs_defer_init+0xff/0x160
 xfs_reflink_remap_extent+0x31b/0xa00
 xfs_reflink_remap_blocks+0xec/0x4a0
 xfs_reflink_remap_range+0x3a1/0x650
 xfs_file_dedupe_range+0x39/0x50
 vfs_dedupe_file_range+0x218/0x260
 do_vfs_ioctl+0x262/0x6a0
 ? __se_sys_newfstat+0x3c/0x60
 ksys_ioctl+0x35/0x60
 __x64_sys_ioctl+0x11/0x20
 do_syscall_64+0x4b/0x190
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The root cause of the assertion failure is that xfs_defer_finish doesn't
roll the transaction after processing all the deferred items.  Therefore
it returns a dirty transaction to the caller, which leaves the caller at
risk of exceeding the transaction reservation if it logs more items.

Brian Foster's patchset to move the defer_ops firstblock into the
transaction requires t_firstblock == NULLFSBLOCK upon defer_ops
initialization, which is how this was noticed at all.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2018-07-23 09:08:00 -07:00
..
libxfs xfs: return from _defer_finish with a clean transaction 2018-07-23 09:08:00 -07:00
scrub xfs: remove unused btree cursor bc_private.a.dfops field 2018-07-11 22:26:17 -07:00
Kconfig xfs: implement the metadata repair ioctl flag 2018-05-15 18:12:50 -07:00
Makefile xfs: move various type verifiers to common file 2018-06-08 10:07:51 -07:00
kmem.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
kmem.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
mrlock.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_acl.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_acl.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_aops.c xfs: update my copyrights for the writeback and iomap code 2018-07-11 22:26:06 -07:00
xfs_aops.h xfs: remove xfs_map_cow 2018-07-11 22:25:59 -07:00
xfs_attr.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_attr_inactive.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_attr_list.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_bmap_item.c xfs: use ->t_dfops for recovery of [b|c]ui log items 2018-07-11 22:26:09 -07:00
xfs_bmap_item.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_bmap_util.c xfs_bmap_util: use swap macro 2018-07-17 14:25:57 -07:00
xfs_bmap_util.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_buf.c xfs: kill __xfs_buf_submit_common() 2018-07-11 22:26:35 -07:00
xfs_buf.h xfs: combine [a]sync buffer submission apis 2018-07-11 22:26:35 -07:00
xfs_buf_item.c xfs: clean up MIN/MAX 2018-06-08 10:07:52 -07:00
xfs_buf_item.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_dir2_readdir.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_discard.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_discard.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xfs_dquot.c xfs: remove xfs_defer_init() firstblock param 2018-07-11 22:26:33 -07:00
xfs_dquot.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_dquot_item.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_dquot_item.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_error.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_error.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_export.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_export.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_extent_busy.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_extent_busy.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_extfree_item.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_extfree_item.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_file.c xfs: remove unused iolock arg from xfs_break_dax_layouts 2018-07-11 22:26:36 -07:00
xfs_filestream.c xfs: remove struct xfs_bmalloca dfops field 2018-07-11 22:26:14 -07:00
xfs_filestream.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_fsmap.c xfs: remove unused btree cursor bc_private.a.dfops field 2018-07-11 22:26:17 -07:00
xfs_fsmap.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_fsops.c xfs: don't trip over negative free space in xfs_reserve_blocks 2018-06-24 11:56:36 -07:00
xfs_fsops.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_globals.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_icache.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_icache.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_icreate_item.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_icreate_item.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_inode.c xfs: remove xfs_defer_init() firstblock param 2018-07-11 22:26:33 -07:00
xfs_inode.h xfs: remove dfops parameter from ifree call stack 2018-07-11 22:26:07 -07:00
xfs_inode_item.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_inode_item.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_ioctl.c Changes since last update: 2018-06-12 15:49:00 -07:00
xfs_ioctl.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_ioctl32.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_ioctl32.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_iomap.c xfs: remove xfs_defer_init() firstblock param 2018-07-11 22:26:33 -07:00
xfs_iomap.h xfs: replace do_mod with native operations 2018-06-08 10:07:52 -07:00
xfs_iops.c vfs/y2038: inode timestamps conversion to timespec64 2018-06-15 07:31:07 +09:00
xfs_iops.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_itable.c xfs: clean up MIN/MAX 2018-06-08 10:07:52 -07:00
xfs_itable.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_linux.h xfs: replace do_mod with native operations 2018-06-08 10:07:52 -07:00
xfs_log.c xfs: clean up MIN/MAX 2018-06-08 10:07:52 -07:00
xfs_log.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_log_cil.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_log_priv.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_log_recover.c xfs: combine [a]sync buffer submission apis 2018-07-11 22:26:35 -07:00
xfs_message.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_message.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xfs_mount.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_mount.h xfs: clean up MIN/MAX 2018-06-08 10:07:52 -07:00
xfs_mru_cache.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_mru_cache.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_ondisk.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_pnfs.c xfs: prepare xfs_break_layouts() for another layout type 2018-05-22 07:19:08 -07:00
xfs_pnfs.h xfs: prepare xfs_break_layouts() for another layout type 2018-05-22 07:19:08 -07:00
xfs_qm.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_qm.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_qm_bhv.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_qm_syscalls.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_quota.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_quotaops.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_refcount_item.c xfs: use ->t_dfops for recovery of [b|c]ui log items 2018-07-11 22:26:09 -07:00
xfs_refcount_item.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_reflink.c xfs: remove xfs_defer_init() firstblock param 2018-07-11 22:26:33 -07:00
xfs_reflink.h xfs: remove xfs_reflink_find_cow_mapping 2018-07-11 22:26:01 -07:00
xfs_rmap_item.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_rmap_item.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_rtalloc.c xfs: remove xfs_defer_init() firstblock param 2018-07-11 22:26:33 -07:00
xfs_rtalloc.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_stats.c Changes since last update: 2018-06-12 15:49:00 -07:00
xfs_stats.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_super.c xfs: add support for sub-pagesize writeback without buffer_heads 2018-07-11 22:26:05 -07:00
xfs_super.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_symlink.c xfs: remove xfs_defer_init() firstblock param 2018-07-11 22:26:33 -07:00
xfs_symlink.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_sysctl.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_sysctl.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_sysfs.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_sysfs.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trace.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trace.h xfs: refactor buffer submission into a common helper 2018-07-11 22:26:34 -07:00
xfs_trans.c xfs: add firstblock field to xfs_trans 2018-07-11 22:26:20 -07:00
xfs_trans.h xfs: add firstblock field to xfs_trans 2018-07-11 22:26:20 -07:00
xfs_trans_ail.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trans_bmap.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trans_buf.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trans_dquot.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trans_extfree.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trans_inode.c vfs/y2038: inode timestamps conversion to timespec64 2018-06-15 07:31:07 +09:00
xfs_trans_priv.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trans_refcount.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trans_rmap.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_xattr.c xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00