diff options
author | Younger Liu <younger.liucn@gmail.com> | 2014-02-10 17:25:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-02-10 19:01:42 -0500 |
commit | a987c7ca7fc9225a587b1dc59d7d4ad2d9e2e08e (patch) | |
tree | 8624277e806b28f2396fe6157b026f00a2089285 /fs | |
parent | 79040cad3f8235937e229f1b9401ba36dd5ad69b (diff) |
ocfs2: fix ocfs2_sync_file() if filesystem is readonly
If filesystem is readonly, there is no need to flush drive's caches or
force any uncommitted transactions.
[akpm@linux-foundation.org: return -EROFS, not 0]
Signed-off-by: Younger Liu <younger.liucn@gmail.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/file.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index d77d71ead8d1..fcd970636bbf 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -185,6 +185,9 @@ static int ocfs2_sync_file(struct file *file, loff_t start, loff_t end, | |||
185 | file->f_path.dentry->d_name.name, | 185 | file->f_path.dentry->d_name.name, |
186 | (unsigned long long)datasync); | 186 | (unsigned long long)datasync); |
187 | 187 | ||
188 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) | ||
189 | return -EROFS; | ||
190 | |||
188 | err = filemap_write_and_wait_range(inode->i_mapping, start, end); | 191 | err = filemap_write_and_wait_range(inode->i_mapping, start, end); |
189 | if (err) | 192 | if (err) |
190 | return err; | 193 | return err; |