public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/9] xfs: clean up xfs_buf io interfaces
@ 2014-08-15  6:38 Dave Chinner
  2014-08-15  6:38 ` [PATCH 1/9] xfs: synchronous buffer IO needs a reference Dave Chinner
                   ` (8 more replies)
  0 siblings, 9 replies; 43+ messages in thread
From: Dave Chinner @ 2014-08-15  6:38 UTC (permalink / raw)
  To: xfs

Hi folks,

This patch set has come from the conversion Brian and I have been
having over how to fix a use-after-free issue related to IO
completions racing with synchronous IO submission. It seemed to me
we were having trouble grasping all the different things that were
wrong and putting them in a line, so I figured the easiest way to do
with was to write a patchset that fixed the original bug, everything
else we'd noticed, and changed the IO API such that we wouldn't have
problems in the future.

So, this patch contains:

	a) initial fix for the use after free issue (patch 1)
	b) clear separation of IO submission errors at the XFS level
	   from IO errors reported through BIO completion callbacks
	   (patches 2,3)
	c) removal of some historic cruft around IO submission
	   (patch 4)
	d) rework of unnecessarily complex historic error handling
	   paths (patches 5,6,7)
	e) a new API for clear and concise asynchronous and
	   synchronous IO.  (patch 8)

The last patch fixes a bug I found writing patch 8, and can probably
be moved to first in the series...

I was just going to send this compile tested for comments, but I
threw it at a couple of VMs and it's half way through xfstests now
without any failures. That means I haven't broken anything badly,
though the error hendling changes will be interesting to test.

The error handling changes have something in common - a buffer that
took an IO error was mostly marked stale, but not always. Sometimes
they were marked as "not done" indicating that IO needed to be done
on them before the contents were valid. Some got marked stale and
done, and so on. The thing is, when we mark a buffer stale, it is
essentially the same thing as marking it !XBF_DONE. So all the error
handling paths now stale the buffer and clear XBF_DONE. Nice,
consistent error handling. This enabled some significant cleanups -
xfs_trans_buf_read_map() finally got the love it's been needing for
long time.

It also defines a specific, safe way for waiting on XBF_ASYNC buffer
IO, and makes use of that in the buffer delayed write code. Hence
the patchset also solves the problem of how do async dispatch, some
work, then wait for IO completion as separate steps as opposed to
issuing synchronous IO that is waited on immediately.

Also, the rework of the IO submission interfaces removes the fixes
added in the first patch to solve the use-after-free issue - we no
longer need an extra reference to protect parts of the IO completion
path because the reference we take during submission is held until
after the IO completion wait has occurred.

Anyway, I figured patches would speak louder than any description,
and most especially a diffstat that looks like this:

	9 files changed, 286 insertions(+), 360 deletions(-)

Comments welcome.

-Dave.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2014-08-30  0:05 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-15  6:38 [RFC PATCH 0/9] xfs: clean up xfs_buf io interfaces Dave Chinner
2014-08-15  6:38 ` [PATCH 1/9] xfs: synchronous buffer IO needs a reference Dave Chinner
2014-08-15 13:18   ` Brian Foster
2014-08-15 23:17     ` Dave Chinner
2014-08-18 14:15       ` Brian Foster
2014-08-29  0:18   ` Christoph Hellwig
2014-08-15  6:39 ` [PATCH 2/9] xfs: xfs_buf_ioend and xfs_buf_iodone_work duplicate functionality Dave Chinner
2014-08-15 13:18   ` Brian Foster
2014-08-15 23:21     ` Dave Chinner
2014-08-18 14:15       ` Brian Foster
2014-08-29  0:22   ` Christoph Hellwig
2014-08-29  0:55     ` Dave Chinner
2014-08-15  6:39 ` [PATCH 3/9] xfs: rework xfs_buf_bio_endio error handling Dave Chinner
2014-08-15 13:18   ` Brian Foster
2014-08-15 23:25     ` Dave Chinner
2014-08-29  0:23   ` Christoph Hellwig
2014-08-15  6:39 ` [PATCH 4/9] xfs: kill xfs_bdstrat_cb Dave Chinner
2014-08-29  0:24   ` Christoph Hellwig
2014-08-15  6:39 ` [PATCH 5/9] xfs: xfs_bioerror can die Dave Chinner
2014-08-15 14:35   ` Brian Foster
2014-08-15 23:27     ` Dave Chinner
2014-08-29  0:28   ` Christoph Hellwig
2014-08-29  1:05     ` Dave Chinner
2014-08-15  6:39 ` [PATCH 6/9] xfs: kill xfs_bioerror_relse Dave Chinner
2014-08-29  0:32   ` Christoph Hellwig
2014-08-29  1:12     ` Dave Chinner
2014-08-29 18:26       ` Christoph Hellwig
2014-08-30  0:05         ` Dave Chinner
2014-08-15  6:39 ` [PATCH 7/9] xfs: clean up xfs_trans_buf_read_map Dave Chinner
2014-08-15  6:39 ` [PATCH 8/9] xfs: introduce xfs_buf_submit[_wait] Dave Chinner
2014-08-15 13:10   ` Christoph Hellwig
2014-08-15 23:37     ` Dave Chinner
2014-08-16  4:55       ` Christoph Hellwig
2014-08-15 14:35   ` Brian Foster
2014-08-15 23:39     ` Dave Chinner
2014-08-18 14:16       ` Brian Foster
2014-08-15 16:13   ` Brian Foster
2014-08-15 23:58     ` Dave Chinner
2014-08-18 14:26       ` Brian Foster
2014-08-15  6:39 ` [PATCH 9/9] xfs: check xfs_buf_read_uncached returns correctly Dave Chinner
2014-08-15 12:56   ` Christoph Hellwig
2014-08-15 23:58     ` Dave Chinner
2014-08-29  0:37       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox