From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/3] xfs: track and serialize in-flight async buffers against unmount
Date: Thu, 14 Jul 2016 10:05:38 +1000 [thread overview]
Message-ID: <20160714000538.GS1922@dastard> (raw)
In-Reply-To: <1468426595-35032-4-git-send-email-bfoster@redhat.com>
On Wed, Jul 13, 2016 at 12:16:35PM -0400, Brian Foster wrote:
> Newly allocated XFS metadata buffers are added to the LRU once the hold
> count is released, which typically occurs after I/O completion. There is
> no other mechanism at current that tracks the existence or I/O state of
> a new buffer. Further, readahead I/O tends to be submitted
> asynchronously by nature, which means the I/O can remain in flight and
> actually complete long after the calling context is gone. This means
> that file descriptors or any other holds on the filesystem can be
> released, allowing the filesystem to be unmounted while I/O is still in
> flight. When I/O completion occurs, core data structures may have been
> freed, causing completion to run into invalid memory accesses and likely
> to panic.
>
> This problem is reproduced on XFS via directory readahead. A filesystem
> is mounted, a directory is opened/closed and the filesystem immediately
> unmounted. The open/close cycle triggers a directory readahead that if
> delayed long enough, runs buffer I/O completion after the unmount has
> completed.
>
> To address this problem, add a mechanism to track all in-flight,
> asynchronous buffers using per-cpu counters in the buftarg. The buffer
> is accounted on the first I/O submission after the current reference is
> acquired and unaccounted once the buffer is returned to the LRU or
> freed. Update xfs_wait_buftarg() to wait on all in-flight I/O before
> walking the LRU list. Once in-flight I/O has completed and the workqueue
> has drained, all new buffers should have been released onto the LRU.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
Yup, looks good now. I'll pull it into my test tree...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-07-14 0:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-13 16:16 [PATCH 0/3] serialize unmount against new buffer I/O Brian Foster
2016-07-13 16:16 ` [PATCH 1/3] xfs: helper to set flags on uncached buffer reads Brian Foster
2016-07-14 0:01 ` Dave Chinner
2016-07-14 10:52 ` Brian Foster
2016-07-13 16:16 ` [PATCH 2/3] xfs: exclude never-released buffers from buftarg I/O accounting Brian Foster
2016-07-13 16:16 ` [PATCH 3/3] xfs: track and serialize in-flight async buffers against unmount Brian Foster
2016-07-14 0:05 ` Dave Chinner [this message]
2016-07-14 17:29 ` [PATCH 0/3] serialize unmount against new buffer I/O 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=20160714000538.GS1922@dastard \
--to=david@fromorbit.com \
--cc=bfoster@redhat.com \
--cc=xfs@oss.sgi.com \
/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