diff options
| author | Chao Yu <yuchao0@huawei.com> | 2017-05-03 11:59:13 -0400 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-05-03 17:30:19 -0400 |
| commit | a72d4b97bb83c92a25d3eb21cc36b9bf94077c60 (patch) | |
| tree | ddf25cc4340c7f3a48974669354a4cc7df3b43d8 /fs/f2fs | |
| parent | 3adc5fcb7edf5f8dfe8d37dcb50ba6b30077c905 (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>
Diffstat (limited to 'fs/f2fs')
| -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 cdbf1add2a11..abb0403d3414 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
| @@ -1473,10 +1473,10 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg) | |||
| 1473 | if (ret) | 1473 | if (ret) |
| 1474 | return ret; | 1474 | return ret; |
| 1475 | 1475 | ||
| 1476 | flags = f2fs_mask_flags(inode->i_mode, flags); | ||
| 1477 | |||
| 1478 | inode_lock(inode); | 1476 | inode_lock(inode); |
| 1479 | 1477 | ||
| 1478 | flags = f2fs_mask_flags(inode->i_mode, flags); | ||
| 1479 | |||
| 1480 | oldflags = fi->i_flags; | 1480 | oldflags = fi->i_flags; |
| 1481 | 1481 | ||
| 1482 | if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) { | 1482 | if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) { |
| @@ -1490,10 +1490,11 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg) | |||
| 1490 | flags = flags & FS_FL_USER_MODIFIABLE; | 1490 | flags = flags & FS_FL_USER_MODIFIABLE; |
| 1491 | flags |= oldflags & ~FS_FL_USER_MODIFIABLE; | 1491 | flags |= oldflags & ~FS_FL_USER_MODIFIABLE; |
| 1492 | fi->i_flags = flags; | 1492 | fi->i_flags = flags; |
| 1493 | inode_unlock(inode); | ||
| 1494 | 1493 | ||
| 1495 | inode->i_ctime = current_time(inode); | 1494 | inode->i_ctime = current_time(inode); |
| 1496 | f2fs_set_inode_flags(inode); | 1495 | f2fs_set_inode_flags(inode); |
| 1496 | |||
| 1497 | inode_unlock(inode); | ||
| 1497 | out: | 1498 | out: |
| 1498 | mnt_drop_write_file(filp); | 1499 | mnt_drop_write_file(filp); |
| 1499 | return ret; | 1500 | return ret; |
