diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2008-09-13 12:52:26 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-09-13 12:52:26 -0400 |
commit | 2a43a878001cc5cb7c3c7be2e8dad0a1aeb939b0 (patch) | |
tree | a0653e45baefbbe3d4de74087525d1b86292a101 /fs/ext4/ioctl.c | |
parent | 7ee1ec4ca30c6df8e989615cdaacb75f2af4fa6b (diff) |
ext4: elevate write count for migrate ioctl
The migrate ioctl writes to the filsystem, so we need to elevate the
write count.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r-- | fs/ext4/ioctl.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index ca09dd1039ec..9f3044ac6994 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -267,7 +267,26 @@ setversion_out: | |||
267 | } | 267 | } |
268 | 268 | ||
269 | case EXT4_IOC_MIGRATE: | 269 | case EXT4_IOC_MIGRATE: |
270 | return ext4_ext_migrate(inode, filp, cmd, arg); | 270 | { |
271 | int err; | ||
272 | if (!is_owner_or_cap(inode)) | ||
273 | return -EACCES; | ||
274 | |||
275 | err = mnt_want_write(filp->f_path.mnt); | ||
276 | if (err) | ||
277 | return err; | ||
278 | /* | ||
279 | * inode_mutex prevent write and truncate on the file. | ||
280 | * Read still goes through. We take i_data_sem in | ||
281 | * ext4_ext_swap_inode_data before we switch the | ||
282 | * inode format to prevent read. | ||
283 | */ | ||
284 | mutex_lock(&(inode->i_mutex)); | ||
285 | err = ext4_ext_migrate(inode); | ||
286 | mutex_unlock(&(inode->i_mutex)); | ||
287 | mnt_drop_write(filp->f_path.mnt); | ||
288 | return err; | ||
289 | } | ||
271 | 290 | ||
272 | default: | 291 | default: |
273 | return -ENOTTY; | 292 | return -ENOTTY; |