diff options
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r-- | fs/ext4/ioctl.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 500567dd53b6..c04c7ccba9e3 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -28,6 +28,7 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
28 | 28 | ||
29 | switch (cmd) { | 29 | switch (cmd) { |
30 | case EXT4_IOC_GETFLAGS: | 30 | case EXT4_IOC_GETFLAGS: |
31 | ext4_get_inode_flags(ei); | ||
31 | flags = ei->i_flags & EXT4_FL_USER_VISIBLE; | 32 | flags = ei->i_flags & EXT4_FL_USER_VISIBLE; |
32 | return put_user(flags, (int __user *) arg); | 33 | return put_user(flags, (int __user *) arg); |
33 | case EXT4_IOC_SETFLAGS: { | 34 | case EXT4_IOC_SETFLAGS: { |
@@ -40,7 +41,7 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
40 | if (IS_RDONLY(inode)) | 41 | if (IS_RDONLY(inode)) |
41 | return -EROFS; | 42 | return -EROFS; |
42 | 43 | ||
43 | if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) | 44 | if (!is_owner_or_cap(inode)) |
44 | return -EACCES; | 45 | return -EACCES; |
45 | 46 | ||
46 | if (get_user(flags, (int __user *) arg)) | 47 | if (get_user(flags, (int __user *) arg)) |
@@ -96,7 +97,7 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
96 | ei->i_flags = flags; | 97 | ei->i_flags = flags; |
97 | 98 | ||
98 | ext4_set_inode_flags(inode); | 99 | ext4_set_inode_flags(inode); |
99 | inode->i_ctime = CURRENT_TIME_SEC; | 100 | inode->i_ctime = ext4_current_time(inode); |
100 | 101 | ||
101 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); | 102 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); |
102 | flags_err: | 103 | flags_err: |
@@ -121,7 +122,7 @@ flags_err: | |||
121 | __u32 generation; | 122 | __u32 generation; |
122 | int err; | 123 | int err; |
123 | 124 | ||
124 | if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) | 125 | if (!is_owner_or_cap(inode)) |
125 | return -EPERM; | 126 | return -EPERM; |
126 | if (IS_RDONLY(inode)) | 127 | if (IS_RDONLY(inode)) |
127 | return -EROFS; | 128 | return -EROFS; |
@@ -133,14 +134,14 @@ flags_err: | |||
133 | return PTR_ERR(handle); | 134 | return PTR_ERR(handle); |
134 | err = ext4_reserve_inode_write(handle, inode, &iloc); | 135 | err = ext4_reserve_inode_write(handle, inode, &iloc); |
135 | if (err == 0) { | 136 | if (err == 0) { |
136 | inode->i_ctime = CURRENT_TIME_SEC; | 137 | inode->i_ctime = ext4_current_time(inode); |
137 | inode->i_generation = generation; | 138 | inode->i_generation = generation; |
138 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); | 139 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); |
139 | } | 140 | } |
140 | ext4_journal_stop(handle); | 141 | ext4_journal_stop(handle); |
141 | return err; | 142 | return err; |
142 | } | 143 | } |
143 | #ifdef CONFIG_JBD_DEBUG | 144 | #ifdef CONFIG_JBD2_DEBUG |
144 | case EXT4_IOC_WAIT_FOR_READONLY: | 145 | case EXT4_IOC_WAIT_FOR_READONLY: |
145 | /* | 146 | /* |
146 | * This is racy - by the time we're woken up and running, | 147 | * This is racy - by the time we're woken up and running, |
@@ -180,7 +181,7 @@ flags_err: | |||
180 | if (IS_RDONLY(inode)) | 181 | if (IS_RDONLY(inode)) |
181 | return -EROFS; | 182 | return -EROFS; |
182 | 183 | ||
183 | if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) | 184 | if (!is_owner_or_cap(inode)) |
184 | return -EACCES; | 185 | return -EACCES; |
185 | 186 | ||
186 | if (get_user(rsv_window_size, (int __user *)arg)) | 187 | if (get_user(rsv_window_size, (int __user *)arg)) |
@@ -282,7 +283,7 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
282 | case EXT4_IOC32_SETVERSION_OLD: | 283 | case EXT4_IOC32_SETVERSION_OLD: |
283 | cmd = EXT4_IOC_SETVERSION_OLD; | 284 | cmd = EXT4_IOC_SETVERSION_OLD; |
284 | break; | 285 | break; |
285 | #ifdef CONFIG_JBD_DEBUG | 286 | #ifdef CONFIG_JBD2_DEBUG |
286 | case EXT4_IOC32_WAIT_FOR_READONLY: | 287 | case EXT4_IOC32_WAIT_FOR_READONLY: |
287 | cmd = EXT4_IOC_WAIT_FOR_READONLY; | 288 | cmd = EXT4_IOC_WAIT_FOR_READONLY; |
288 | break; | 289 | break; |