diff options
| author | Chao Yu <yuchao0@huawei.com> | 2017-05-03 23:59:13 +0800 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2017-05-21 18:43:49 +0200 |
| commit | 3faf20b45d631d42f67d41cbcebaea6a0beb1843 (patch) | |
| tree | 41ef6db724311332038c4c6f7c0460ca9f2a7f04 | |
| parent | ea03c5642201944fee08ca246aa6b49a61642707 (diff) | |
f2fs: relocate inode_{,un}lock in F2FS_IOC_SETFLAGS
This patch expands cover region of inode->i_rwsem to keep setting flag
atomically.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
| -rw-r--r-- | fs/f2fs/file.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index c67ceb563..3bbddfe69 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1505,10 +1505,10 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg) if (ret) return ret; - flags = f2fs_mask_flags(inode->i_mode, flags); - inode_lock(inode); + flags = f2fs_mask_flags(inode->i_mode, flags); + oldflags = fi->i_flags; if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) { @@ -1522,10 +1522,11 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg) flags = flags & FS_FL_USER_MODIFIABLE; flags |= oldflags & ~FS_FL_USER_MODIFIABLE; fi->i_flags = flags; - inode_unlock(inode); inode->i_ctime = current_time(inode); f2fs_set_inode_flags(inode); + + inode_unlock(inode); out: mnt_drop_write_file(filp); return ret; |
