Skip to content

Commit

Permalink
f2fs: check read only condition before beginning write out
Browse files Browse the repository at this point in the history
If the filesystem is mounted as read-only then return from that point itself
instead of first doing a writeout/wait and then checking for read-only
condition.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
  • Loading branch information
Namjae Jeon authored and Jaegeuk Kim committed Dec 11, 2012
1 parent 154a086 commit 1fa95b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,15 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
.for_reclaim = 0,
};

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;

mutex_lock(&inode->i_mutex);

if (inode->i_sb->s_flags & MS_RDONLY)
goto out;
if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
goto out;

Expand Down

0 comments on commit 1fa95b0

Please sign in to comment.