aboutsummaryrefslogtreecommitdiff
path: root/fs/ext3/fsync.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-18 09:18:52 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-18 09:18:52 -0700
commit2511817cf9b1cf2506f47e20bb128e2da231c150 (patch)
tree26b0cd6b9491bcb1284e6c60f64ea1dbd25f2aa7 /fs/ext3/fsync.c
parent714af0693863dfb6f075f4465053976d2d076a21 (diff)
parent56fcad29d4b3cbcbb2ed47a9d3ceca3f57175417 (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: ext3: Flush disk caches on fsync when needed ext3: Add locking to ext3_do_update_inode ext3: Fix possible deadlock between ext3_truncate() and ext3_get_blocks() jbd: Annotate transaction start also for journal_restart() jbd: Journal block numbers can ever be only 32-bit use unsigned int for them ext3: Update MAINTAINERS for ext3 and JBD JBD: round commit timer up to avoid uncommitted transaction
Diffstat (limited to 'fs/ext3/fsync.c')
-rw-r--r--fs/ext3/fsync.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c
index d33634119e1..451d166bbe9 100644
--- a/fs/ext3/fsync.c
+++ b/fs/ext3/fsync.c
@@ -23,6 +23,7 @@
*/
#include <linux/time.h>
+#include <linux/blkdev.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/writeback.h>
@@ -73,7 +74,7 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync)
}
if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
- goto out;
+ goto flush;
/*
* The VFS has written the file data. If the inode is unaltered
@@ -85,7 +86,16 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync)
.nr_to_write = 0, /* sys_fsync did this */
};
ret = sync_inode(inode, &wbc);
+ goto out;
}
+flush:
+ /*
+ * In case we didn't commit a transaction, we have to flush
+ * disk caches manually so that data really is on persistent
+ * storage
+ */
+ if (test_opt(inode->i_sb, BARRIER))
+ blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
out:
return ret;
}