From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 2/8] xfs: return from _defer_finish with a clean transaction
Date: Thu, 19 Jul 2018 08:24:37 -0400 [thread overview]
Message-ID: <20180719122436.GD25672@bfoster> (raw)
In-Reply-To: <153192904042.31685.60438652773989931.stgit@magnolia>
On Wed, Jul 18, 2018 at 08:50:40AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Christoph Hellwig reported seeing the following assertion in
> 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>
I was about ready to post the embedded dfops series but this reminds me
that this last roll should be optimized out in the xfs_defer_finish() ->
xfs_trans_commit() case. Technically a commit of a clean transaction
doesn't have to do anything, but that would at least avoid the
unnecessary regrant that occurs during the roll. Hmm, I may just post
the series as is for initial review and then tack on a patch for the
last bit later..
Brian
> fs/xfs/libxfs/xfs_defer.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>
> diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
> index c3e5bffda4f5..3ba8bb308c3c 100644
> --- a/fs/xfs/libxfs/xfs_defer.c
> +++ b/fs/xfs/libxfs/xfs_defer.c
> @@ -424,6 +424,12 @@ xfs_defer_finish(
> cleanup_fn(*tp, state, error);
> }
>
> + /*
> + * Roll the transaction once more to avoid returning to the caller
> + * with a dirty transaction.
> + */
> + if ((*tp)->t_flags & XFS_TRANS_DIRTY)
> + error = xfs_defer_trans_roll(tp, dop);
> out:
> (*tp)->t_agfl_dfops = orig_dop;
> if (error)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-07-19 13:07 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 15:50 [PATCH 0/8] xfs-4.19: fixes & cleanups Darrick J. Wong
2018-07-18 15:50 ` [PATCH 1/8] xfs: check leaf attribute block freemap in verifier Darrick J. Wong
2018-07-19 12:19 ` Carlos Maiolino
2018-07-19 12:24 ` Brian Foster
2018-07-19 15:20 ` Darrick J. Wong
2018-07-19 15:25 ` [PATCH v2 " Darrick J. Wong
2018-07-19 15:30 ` Brian Foster
2018-07-19 15:46 ` Carlos Maiolino
2018-07-19 16:40 ` Christoph Hellwig
2018-07-18 15:50 ` [PATCH 2/8] xfs: return from _defer_finish with a clean transaction Darrick J. Wong
2018-07-19 12:24 ` Brian Foster [this message]
2018-07-19 16:41 ` Christoph Hellwig
2018-07-18 15:50 ` [PATCH 3/8] xfs: trivial xfs_btree_del_cursor cleanups Darrick J. Wong
2018-07-19 12:24 ` Brian Foster
2018-07-19 12:25 ` Carlos Maiolino
2018-07-19 16:43 ` Christoph Hellwig
2018-07-19 19:22 ` Darrick J. Wong
2018-07-20 16:04 ` Christoph Hellwig
2018-07-18 15:50 ` [PATCH 4/8] xfs: clean up xfs_btree_del_cursor callers Darrick J. Wong
2018-07-19 12:24 ` Brian Foster
2018-07-19 12:28 ` Carlos Maiolino
2018-07-19 16:46 ` Christoph Hellwig
2018-07-18 15:51 ` [PATCH 5/8] xfs: shorten xfs_scrub_ prefix Darrick J. Wong
2018-07-19 12:59 ` Brian Foster
2018-07-18 15:51 ` [PATCH 6/8] xfs: shorten xfs_repair_ prefix to xrep_ Darrick J. Wong
2018-07-19 12:59 ` Brian Foster
2018-07-18 15:52 ` [PATCH 7/8] xfs: shorten struct xfs_scrub_context to struct xfs_scrub Darrick J. Wong
2018-07-19 12:59 ` Brian Foster
2018-07-18 15:52 ` [PATCH 8/8] xfs: fix indentation and other whitespace problems in scrub/repair Darrick J. Wong
2018-07-19 12:59 ` Brian Foster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180719122436.GD25672@bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox