hfs_file_fsync() takes inode_lock() around the metadata part of fsync. For HFS it is not needed, because everything done under the lock is already serialized by other means: - write_inode_now() ends up in hfs_write_inode(), which is also called by the flusher threads and by sync without holding inode_lock. Concurrent writeback of the same inode is serialized by the writeback code itself (I_SYNC), and the extent and catalog records are updated under the extents and catalog b-tree locks taken by hfs_find_init(). - flush_delayed_work() of mdb_work runs flush_mdb(), which commits the MDB, the alternate MDB and the volume bitmap under sbi->mdb_lock. This state is per-superblock, so inode_lock of one file never protected it anyway. - sync_blockdev() works on the block device and needs no inode lock. So inode_lock only serializes fsync() of an inode against write(), truncate and setattr on the same inode, and against another fsync() of it, without protecting any state that is not already protected, while holding off writers of that file for the whole duration of the MDB commit and the block device flush. Drop inode_lock()/inode_unlock() from hfs_file_fsync(). Fixes: 02c24a82187d ("fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers") cc: John Paul Adrian Glaubitz cc: Yangtao Li cc: linux-fsdevel@vger.kernel.org Signed-off-by: Viacheslav Dubeyko --- fs/hfs/inode.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index ef1275bbbcbb..f1122ffae712 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -773,7 +773,6 @@ static int hfs_file_fsync(struct file *filp, loff_t start, loff_t end, ret = file_write_and_wait_range(filp, start, end); if (ret) return ret; - inode_lock(inode); /* sync the inode to buffers */ ret = write_inode_now(inode, 0); @@ -785,7 +784,6 @@ static int hfs_file_fsync(struct file *filp, loff_t start, loff_t end, err = sync_blockdev(sb->s_bdev); if (!ret) ret = err; - inode_unlock(inode); return ret; } -- 2.53.0