| .. | .. |
|---|
| 98 | 98 | /* Lock against other parallel changes of flags */ |
|---|
| 99 | 99 | inode_lock(inode); |
|---|
| 100 | 100 | |
|---|
| 101 | | - oldflags = jfs_inode->mode2; |
|---|
| 102 | | - |
|---|
| 103 | | - /* |
|---|
| 104 | | - * The IMMUTABLE and APPEND_ONLY flags can only be changed by |
|---|
| 105 | | - * the relevant capability. |
|---|
| 106 | | - */ |
|---|
| 107 | | - if ((oldflags & JFS_IMMUTABLE_FL) || |
|---|
| 108 | | - ((flags ^ oldflags) & |
|---|
| 109 | | - (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) { |
|---|
| 110 | | - if (!capable(CAP_LINUX_IMMUTABLE)) { |
|---|
| 111 | | - inode_unlock(inode); |
|---|
| 112 | | - err = -EPERM; |
|---|
| 113 | | - goto setflags_out; |
|---|
| 114 | | - } |
|---|
| 101 | + oldflags = jfs_map_ext2(jfs_inode->mode2 & JFS_FL_USER_VISIBLE, |
|---|
| 102 | + 0); |
|---|
| 103 | + err = vfs_ioc_setflags_prepare(inode, oldflags, flags); |
|---|
| 104 | + if (err) { |
|---|
| 105 | + inode_unlock(inode); |
|---|
| 106 | + goto setflags_out; |
|---|
| 115 | 107 | } |
|---|
| 116 | 108 | |
|---|
| 117 | 109 | flags = flags & JFS_FL_USER_MODIFIABLE; |
|---|
| 118 | | - flags |= oldflags & ~JFS_FL_USER_MODIFIABLE; |
|---|
| 110 | + flags |= jfs_inode->mode2 & ~JFS_FL_USER_MODIFIABLE; |
|---|
| 119 | 111 | jfs_inode->mode2 = flags; |
|---|
| 120 | 112 | |
|---|
| 121 | 113 | jfs_set_inode_flags(inode); |
|---|