diff options
-rw-r--r-- | fs/ext3/fsync.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c index d33634119e17..451d166bbe93 100644 --- a/fs/ext3/fsync.c +++ b/fs/ext3/fsync.c | |||
@@ -23,6 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/time.h> | 25 | #include <linux/time.h> |
26 | #include <linux/blkdev.h> | ||
26 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
27 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
28 | #include <linux/writeback.h> | 29 | #include <linux/writeback.h> |
@@ -73,7 +74,7 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync) | |||
73 | } | 74 | } |
74 | 75 | ||
75 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) | 76 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) |
76 | goto out; | 77 | goto flush; |
77 | 78 | ||
78 | /* | 79 | /* |
79 | * The VFS has written the file data. If the inode is unaltered | 80 | * 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) | |||
85 | .nr_to_write = 0, /* sys_fsync did this */ | 86 | .nr_to_write = 0, /* sys_fsync did this */ |
86 | }; | 87 | }; |
87 | ret = sync_inode(inode, &wbc); | 88 | ret = sync_inode(inode, &wbc); |
89 | goto out; | ||
88 | } | 90 | } |
91 | flush: | ||
92 | /* | ||
93 | * In case we didn't commit a transaction, we have to flush | ||
94 | * disk caches manually so that data really is on persistent | ||
95 | * storage | ||
96 | */ | ||
97 | if (test_opt(inode->i_sb, BARRIER)) | ||
98 | blkdev_issue_flush(inode->i_sb->s_bdev, NULL); | ||
89 | out: | 99 | out: |
90 | return ret; | 100 | return ret; |
91 | } | 101 | } |