diff options
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r-- | fs/ext4/ioctl.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 6eee25591b81..8ad112ae0ade 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -38,7 +38,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
38 | handle_t *handle = NULL; | 38 | handle_t *handle = NULL; |
39 | int err, migrate = 0; | 39 | int err, migrate = 0; |
40 | struct ext4_iloc iloc; | 40 | struct ext4_iloc iloc; |
41 | unsigned int oldflags; | 41 | unsigned int oldflags, mask, i; |
42 | unsigned int jflag; | 42 | unsigned int jflag; |
43 | 43 | ||
44 | if (!inode_owner_or_capable(inode)) | 44 | if (!inode_owner_or_capable(inode)) |
@@ -115,8 +115,14 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
115 | if (err) | 115 | if (err) |
116 | goto flags_err; | 116 | goto flags_err; |
117 | 117 | ||
118 | flags = flags & EXT4_FL_USER_MODIFIABLE; | 118 | for (i = 0, mask = 1; i < 32; i++, mask <<= 1) { |
119 | flags |= oldflags & ~EXT4_FL_USER_MODIFIABLE; | 119 | if (!(mask & EXT4_FL_USER_MODIFIABLE)) |
120 | continue; | ||
121 | if (mask & flags) | ||
122 | ext4_set_inode_flag(inode, i); | ||
123 | else | ||
124 | ext4_clear_inode_flag(inode, i); | ||
125 | } | ||
120 | ei->i_flags = flags; | 126 | ei->i_flags = flags; |
121 | 127 | ||
122 | ext4_set_inode_flags(inode); | 128 | ext4_set_inode_flags(inode); |
@@ -152,6 +158,13 @@ flags_out: | |||
152 | if (!inode_owner_or_capable(inode)) | 158 | if (!inode_owner_or_capable(inode)) |
153 | return -EPERM; | 159 | return -EPERM; |
154 | 160 | ||
161 | if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, | ||
162 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { | ||
163 | ext4_warning(sb, "Setting inode version is not " | ||
164 | "supported with metadata_csum enabled."); | ||
165 | return -ENOTTY; | ||
166 | } | ||
167 | |||
155 | err = mnt_want_write_file(filp); | 168 | err = mnt_want_write_file(filp); |
156 | if (err) | 169 | if (err) |
157 | return err; | 170 | return err; |