From: Josef Bacik <josef@redhat.com>
To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
david@fromorbit.com
Subject: [PATCH] xfs: don't take the i_mutex in ->fsync()
Date: Tue, 19 Jul 2011 08:41:33 -0400 [thread overview]
Message-ID: <1311079293-3271-1-git-send-email-josef@redhat.com> (raw)
In pushing down the i_mutex into the ->fsync() handlers I introduced a deadlock
since xfs will call xfs_file_fsync in the O_SYNC case while still holding the
i_mutex case. In talking with Dave he said that xfs doesn't really need to hold
the i_mutex in xfs_file_sync() so just drop the taking of i_mutex and we should
be good to go. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
---
fs/xfs/linux-2.6/xfs_file.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 9183f75..b928cb5 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -144,12 +144,8 @@ xfs_file_fsync(
if (error)
return error;
- mutex_lock(&inode->i_mutex);
-
- if (XFS_FORCED_SHUTDOWN(mp)) {
- mutex_unlock(&inode->i_mutex);
+ if (XFS_FORCED_SHUTDOWN(mp))
return -XFS_ERROR(EIO);
- }
xfs_iflags_clear(ip, XFS_ITRUNCATED);
@@ -205,7 +201,6 @@ xfs_file_fsync(
XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0);
if (error) {
xfs_trans_cancel(tp, 0);
- mutex_unlock(&inode->i_mutex);
return -error;
}
xfs_ilock(ip, XFS_ILOCK_EXCL);
@@ -255,7 +250,6 @@ xfs_file_fsync(
!log_flushed)
xfs_blkdev_issue_flush(mp->m_ddev_targp);
- mutex_unlock(&inode->i_mutex);
return -error;
}
--
1.7.5.2
next reply other threads:[~2011-07-19 12:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-19 12:41 Josef Bacik [this message]
2011-07-19 14:41 ` [PATCH] xfs: don't take the i_mutex in ->fsync() Christoph Hellwig
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=1311079293-3271-1-git-send-email-josef@redhat.com \
--to=josef@redhat.com \
--cc=david@fromorbit.com \
--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).