From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, allison.henderson@oracle.com
Subject: Re: [PATCH 1/2] xfs: always free xattri_leaf_bp when cancelling a deferred op
Date: Fri, 24 Jun 2022 09:09:47 +1000 [thread overview]
Message-ID: <20220623230947.GV227878@dread.disaster.area> (raw)
In-Reply-To: <165601680110.2928801.13403149388824105760.stgit@magnolia>
On Thu, Jun 23, 2022 at 01:40:01PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> While running the following fstest with logged xattrs DISabled, I
> noticed the following:
>
> # FSSTRESS_AVOID="-z -f unlink=1 -f rmdir=1 -f creat=2 -f mkdir=2 -f
> getfattr=3 -f listfattr=3 -f attr_remove=4 -f removefattr=4 -f
> setfattr=20 -f attr_set=60" ./check generic/475
>
> INFO: task u9:1:40 blocked for more than 61 seconds.
> Tainted: G O 5.19.0-rc2-djwx #rc2
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> task:u9:1 state:D stack:12872 pid: 40 ppid: 2 flags:0x00004000
> Workqueue: xfs-cil/dm-0 xlog_cil_push_work [xfs]
> Call Trace:
> <TASK>
> __schedule+0x2db/0x1110
> schedule+0x58/0xc0
> schedule_timeout+0x115/0x160
> __down_common+0x126/0x210
> down+0x54/0x70
> xfs_buf_lock+0x2d/0xe0 [xfs 0532c1cb1d67dd81d15cb79ac6e415c8dec58f73]
> xfs_buf_item_unpin+0x227/0x3a0 [xfs 0532c1cb1d67dd81d15cb79ac6e415c8dec58f73]
> xfs_trans_committed_bulk+0x18e/0x320 [xfs 0532c1cb1d67dd81d15cb79ac6e415c8dec58f73]
> xlog_cil_committed+0x2ea/0x360 [xfs 0532c1cb1d67dd81d15cb79ac6e415c8dec58f73]
> xlog_cil_push_work+0x60f/0x690 [xfs 0532c1cb1d67dd81d15cb79ac6e415c8dec58f73]
> process_one_work+0x1df/0x3c0
> worker_thread+0x53/0x3b0
> kthread+0xea/0x110
> ret_from_fork+0x1f/0x30
> </TASK>
>
> This appears to be the result of shortform_to_leaf creating a new leaf
> buffer as part of adding an xattr to a file. The new leaf buffer is
> held and attached to the xfs_attr_intent structure, but then the
> filesystem shuts down. Instead of the usual path (which adds the attr
> to the held leaf buffer which releases the hold), we instead cancel the
> entire deferred operation.
>
> Unfortunately, xfs_attr_cancel_item doesn't release any attached leaf
> buffers, so we leak the locked buffer. The CIL cannot do anything
> about that, and hangs. Fix this by teaching it to release leaf buffers,
> and make XFS a little more careful about not leaving a dangling
> reference.
>
> The prologue of xfs_attri_item_recover is (in this author's opinion) a
> little hard to figure out, so I'll clean that up in the next patch.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/xfs_attr_item.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
Looks fine.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2022-06-23 23:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 20:39 [PATCHSET v2 0/2] xfs: random fixes for 5.19-rc4 Darrick J. Wong
2022-06-23 20:40 ` [PATCH 1/2] xfs: always free xattri_leaf_bp when cancelling a deferred op Darrick J. Wong
2022-06-23 23:09 ` Dave Chinner [this message]
2022-06-23 20:40 ` [PATCH 2/2] xfs: clean up the end of xfs_attri_item_recover Darrick J. Wong
2022-06-23 23:13 ` Dave Chinner
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=20220623230947.GV227878@dread.disaster.area \
--to=david@fromorbit.com \
--cc=allison.henderson@oracle.com \
--cc=djwong@kernel.org \
--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