From mboxrd@z Thu Jan 1 00:00:00 1970 From: Josef Bacik Subject: [PATCH] xfs: don't take the i_mutex in ->fsync() Date: Tue, 19 Jul 2011 08:41:33 -0400 Message-ID: <1311079293-3271-1-git-send-email-josef@redhat.com> To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, david@fromorbit.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:55979 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265Ab1GSMlo (ORCPT ); Tue, 19 Jul 2011 08:41:44 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- 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