From: Stephen Rothwell Date: Tue, 26 Jul 2011 02:03:47 +0000 (+1000) Subject: Merge remote-tracking branch 'ext3/for_next' X-Git-Tag: next-20110726~64 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3000dfc469839bae23c278e19d66ca4e866d415b;p=karo-tx-linux.git Merge remote-tracking branch 'ext3/for_next' Conflicts: fs/ext3/fsync.c --- 3000dfc469839bae23c278e19d66ca4e866d415b diff --cc fs/ext3/fsync.c index 0bcf63adb80a,06a4394d2bc3..4850708c4b67 --- a/fs/ext3/fsync.c +++ b/fs/ext3/fsync.c @@@ -51,22 -52,14 +52,24 @@@ int ext3_sync_file(struct file *file, l int ret, needs_barrier = 0; tid_t commit_tid; - if (inode->i_sb->s_flags & MS_RDONLY) - return 0; - + ret = filemap_write_and_wait_range(inode->i_mapping, start, end); + if (ret) + return ret; + + /* + * Taking the mutex here just to keep consistent with how fsync was + * called previously, however it looks like we don't need to take + * i_mutex at all. + */ + mutex_lock(&inode->i_mutex); + J_ASSERT(ext3_journal_current_handle() == NULL); + trace_ext3_sync_file_enter(file, datasync); + + if (inode->i_sb->s_flags & MS_RDONLY) + return 0; + - /* * data=writeback,ordered: * The caller's filemap_fdatawrite()/wait will sync the data. @@@ -82,8 -75,8 +85,9 @@@ * safe in-journal, which is all fsync() needs to ensure. */ if (ext3_should_journal_data(inode)) { + mutex_unlock(&inode->i_mutex); - return ext3_force_commit(inode->i_sb); + ret = ext3_force_commit(inode->i_sb); + goto out; } if (datasync) @@@ -104,6 -97,8 +108,9 @@@ */ if (needs_barrier) blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); + mutex_unlock(&inode->i_mutex); + + out: + trace_ext3_sync_file_exit(inode, ret); return ret; }