diff options
author | Theodore Ts'o <tytso@mit.edu> | 2012-08-17 09:58:17 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-08-17 09:58:17 -0400 |
commit | a4a39040e9dacb5fa28b7ee7f842237ee534e7bf (patch) | |
tree | 141c76f177f8625db5a394f0b3f294e35e383b8d /fs/ext4/fsync.c | |
parent | 316e4cfd0b0b4ce846fd0fbda2deebcffbd3e440 (diff) |
ext4: check return value of blkdev_issue_flush()
blkdev_issue_flush() can fail; make sure the error gets properly
propagated.
This is a port of the equivalent ext3 patch from commit 44f4f729e7a1.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/fsync.c')
-rw-r--r-- | fs/ext4/fsync.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index 2a1dcea4f12e..323eb15c2d94 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -203,7 +203,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
203 | struct inode *inode = file->f_mapping->host; | 203 | struct inode *inode = file->f_mapping->host; |
204 | struct ext4_inode_info *ei = EXT4_I(inode); | 204 | struct ext4_inode_info *ei = EXT4_I(inode); |
205 | journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; | 205 | journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; |
206 | int ret; | 206 | int ret, err; |
207 | tid_t commit_tid; | 207 | tid_t commit_tid; |
208 | bool needs_barrier = false; | 208 | bool needs_barrier = false; |
209 | 209 | ||
@@ -255,8 +255,11 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
255 | needs_barrier = true; | 255 | needs_barrier = true; |
256 | jbd2_log_start_commit(journal, commit_tid); | 256 | jbd2_log_start_commit(journal, commit_tid); |
257 | ret = jbd2_log_wait_commit(journal, commit_tid); | 257 | ret = jbd2_log_wait_commit(journal, commit_tid); |
258 | if (needs_barrier) | 258 | if (needs_barrier) { |
259 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); | 259 | err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); |
260 | if (!ret) | ||
261 | ret = err; | ||
262 | } | ||
260 | out: | 263 | out: |
261 | mutex_unlock(&inode->i_mutex); | 264 | mutex_unlock(&inode->i_mutex); |
262 | trace_ext4_sync_file_exit(inode, ret); | 265 | trace_ext4_sync_file_exit(inode, ret); |