diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-01-28 03:29:26 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-02-17 06:58:53 +0100 |
commit | 3375f696bd9cfdfd385e2460a9cf021d8ef01eab (patch) | |
tree | 439ff4140f238286f7dbbfd5bf739723fcd96a07 /fs/f2fs/file.c | |
parent | f2fs: clean up redundant function call (diff) | |
download | linux-3375f696bd9cfdfd385e2460a9cf021d8ef01eab.tar.xz linux-3375f696bd9cfdfd385e2460a9cf021d8ef01eab.zip |
f2fs: use inode mutex to keep atomicity of f2fs_falloc
Previously without protection of inode mutex, f2fs_falloc and other data
correlated operations will interfere with each other.
So let's use inode mutex to keep atomicity of f2fs_falloc.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to '')
-rw-r--r-- | fs/f2fs/file.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 0dfcef53a6ed..00f937ec4794 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -560,6 +560,8 @@ static long f2fs_fallocate(struct file *file, int mode, if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) return -EOPNOTSUPP; + mutex_lock(&inode->i_mutex); + if (mode & FALLOC_FL_PUNCH_HOLE) ret = punch_hole(inode, offset, len); else @@ -569,6 +571,9 @@ static long f2fs_fallocate(struct file *file, int mode, inode->i_mtime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); } + + mutex_unlock(&inode->i_mutex); + trace_f2fs_fallocate(inode, mode, offset, len, ret); return ret; } |