Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1635101 > unrolled thread
| Started by | Chao Yu <chao@kernel.org> |
|---|---|
| First post | 2017-05-03 18:10 +0200 |
| Last post | 2017-05-03 18:10 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/3] f2fs: relocate inode_{,un}lock in F2FS_IOC_SETFLAGS Chao Yu <chao@kernel.org> - 2017-05-03 18:10 +0200
| From | Chao Yu <chao@kernel.org> |
|---|---|
| Date | 2017-05-03 18:10 +0200 |
| Subject | [PATCH 2/3] f2fs: relocate inode_{,un}lock in F2FS_IOC_SETFLAGS |
| Message-ID | <tD50J-7GP-5@gated-at.bofh.it> |
From: Chao Yu <yuchao0@huawei.com>
This patch expands cover region of inode->i_rwsem to keep setting flag
atomically.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
fs/f2fs/file.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 1c1c9bc4f19a..e20a1c01e556 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1494,10 +1494,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)) {
@@ -1511,10 +1511,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;
--
2.12.2.575.gb14f27f
Back to top | Article view | linux.kernel
csiph-web