From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 0/7] xfs: serialise unaligned direct IOs
Date: Wed, 15 Dec 2010 12:23:21 +1100 [thread overview]
Message-ID: <1292376208-16282-1-git-send-email-david@fromorbit.com> (raw)
Folks,
This series aims to serialise unaligned direct IOs to an inode to avoid
corruption causedby sub-block zeroing races. The previous approaches at the
direct IO layer fail because for !DIO_LOCKING filesystems like XFS, there is no
way we can track and serialise all the direct IOs to a given inode in a race
free manner. While we can track them, we cannot close the races between mapping
blocks and tracked IO completion occuring before subsequent tracking lookups
without adding some kind of locking to the DIO layer. Hence for !DIO_LOCKING
users, unaligned direct IO needs to be serialised at a higher layer.
Because the xfs_file_aio_write() path is so twisted and difficult to follow,
adding new locking cases to the code is difficult to verify that it is correct
in all cases. Hence the series starts by cleaning up the code and splitting
apart the direct IO and buffered IO paths before adding the unaligned direct IO
detection and serialisation.
The first patch fixes a sync write error handling bug - we should consider
pushing that to .38. The next patches factor code that is common to write and
splice into helpers. The direct and buffered IO paths are then separated out
and the common write checks and bounds limiting is factored out into a helper.
Finally, the serialisation of unaligned direct IOs is added by a big-hammer
approach. That is, we take the i_mutex and XFS_IOLOCK_EXCL and hold them across
the unaligned IO submission. This means that unaligned direct IO submission is
serialised, and non-AIO DIO is serialised completely.
For unaligned AIO DIO, this would only serialise the submission of the DIO,
leaving the sub-block zeroing races open for unaligned writes into unwritten
extents. To avoid this problem, we use xfs_ioend_wait() to ensure all AIO
writes have completed before we submit the unaligned write. We do this wait
holding the i_mutex so we serialise against other unaligned AIO as there is no
need to serialise against aligned DIO.
The following changes since commit cf7d7e5a1980d1116ee152d25dac382b112b9c17:
Linux 2.6.37-rc5 (2010-12-06 20:09:04 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/dgc/xfsdev.git aio-unaligned
Dave Chinner (7):
xfs: ensure sync write errors are returned
xfs: factor common post-write isize handling code
xfs: factor post-write newsize updates
xfs: split direct IO write path from xfs_file_aio_write
xfs: split buffered IO write path from xfs_file_aio_write
xfs: factor common write setup code
xfs: serialise unaligned direct IOs
fs/xfs/linux-2.6/xfs_file.c | 440 ++++++++++++++++++++++++-------------------
1 files changed, 248 insertions(+), 192 deletions(-)
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2010-12-15 1:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 1:23 Dave Chinner [this message]
2010-12-15 1:23 ` [PATCH 1/7] xfs: ensure sync write errors are returned Dave Chinner
2010-12-16 11:57 ` Christoph Hellwig
2010-12-16 21:57 ` Dave Chinner
2010-12-16 20:50 ` Alex Elder
2010-12-17 6:43 ` Dave Chinner
2010-12-15 1:23 ` [PATCH 2/7] xfs: factor common post-write isize handling code Dave Chinner
2010-12-15 1:23 ` [PATCH 4/7] xfs: split direct IO write path from xfs_file_aio_write Dave Chinner
2010-12-16 12:06 ` Christoph Hellwig
2010-12-17 7:31 ` Dave Chinner
2010-12-20 11:29 ` Christoph Hellwig
2010-12-21 0:51 ` Dave Chinner
2010-12-15 1:23 ` [PATCH 5/7] xfs: split buffered " Dave Chinner
2010-12-15 1:23 ` [PATCH 6/7] xfs: factor common write setup code Dave Chinner
2010-12-15 1:23 ` [PATCH 7/7] xfs: serialise unaligned direct IOs 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=1292376208-16282-1-git-send-email-david@fromorbit.com \
--to=david@fromorbit.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