diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-01-28 10:29:26 +0800 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2015-05-02 14:36:19 +0200 |
commit | a0e1e14dd5ba627351f6597c1af7df447fe19fc3 (patch) | |
tree | 7e480d908ddb1c777e80bd65b90c2fa7ef8a36b6 /fs | |
parent | 3bbff0f865ac1eec71b73dd555d0332f20100711 (diff) | |
download | kernel_samsung_tuna-a0e1e14dd5ba627351f6597c1af7df447fe19fc3.zip kernel_samsung_tuna-a0e1e14dd5ba627351f6597c1af7df447fe19fc3.tar.gz kernel_samsung_tuna-a0e1e14dd5ba627351f6597c1af7df447fe19fc3.tar.bz2 |
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 'fs')
-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 a72ecd9..facf03d 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -561,6 +561,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 @@ -570,6 +572,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; } |