From: Josef Bacik <josef@redhat.com>
To: hch@infradead.org, viro@zeniv.linux.org.uk,
linux-fsdevel@vger.kernel.org, david@fromorbit.com
Subject: [PATCH] xfs: fix xfs_file_fsync() call in O_SYNC case
Date: Tue, 19 Jul 2011 12:19:17 -0400 [thread overview]
Message-ID: <1311092357-17994-1-git-send-email-josef@redhat.com> (raw)
When I pushed down the i_mutex into ->fsync() I created a deadlock with xfs when
writing O_SYNC. Fix this by dropping the filemap_write_and_wait_range() since
it's done in ->fsync() now and call xfs_file_fsync() where we've dropped the
i_mutex. This was suggested by Christoph and has passed xfstests. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
---
fs/xfs/linux-2.6/xfs_file.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 9183f75..1db8bd8 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -887,18 +887,11 @@ xfs_file_aio_write(
/* Handle various SYNC-type writes */
if ((file->f_flags & O_DSYNC) || IS_SYNC(inode)) {
loff_t end = pos + ret - 1;
- int error, error2;
xfs_rw_iunlock(ip, iolock);
- error = filemap_write_and_wait_range(mapping, pos, end);
+ ret = -xfs_file_fsync(file, pos, end,
+ (file->f_flags & __O_SYNC) ? 0 : 1);
xfs_rw_ilock(ip, iolock);
-
- error2 = -xfs_file_fsync(file, pos, end,
- (file->f_flags & __O_SYNC) ? 0 : 1);
- if (error)
- ret = error;
- else if (error2)
- ret = error2;
}
out_unlock:
--
1.7.5.2
reply other threads:[~2011-07-19 16:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1311092357-17994-1-git-send-email-josef@redhat.com \
--to=josef@redhat.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).