Commit 8dbf3ff1 authored by Luke Dashjr's avatar Luke Dashjr Committed by Greg Kroah-Hartman

btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl

commit 4c63c245 upstream.

32-bit ioctl uses these rather than the regular FS_IOC_* versions. They can
be handled in btrfs using the same code. Without this, 32-bit {ch,ls}attr
fail.
Signed-off-by: default avatarLuke Dashjr <luke-jr+git@utopios.org>
Reviewed-by: default avatarJosef Bacik <jbacik@fb.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent edd7cd7a
...@@ -4089,6 +4089,7 @@ void btrfs_test_inode_set_ops(struct inode *inode); ...@@ -4089,6 +4089,7 @@ void btrfs_test_inode_set_ops(struct inode *inode);
/* ioctl.c */ /* ioctl.c */
long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
void btrfs_update_iflags(struct inode *inode); void btrfs_update_iflags(struct inode *inode);
void btrfs_inherit_iflags(struct inode *inode, struct inode *dir); void btrfs_inherit_iflags(struct inode *inode, struct inode *dir);
int btrfs_is_empty_uuid(u8 *uuid); int btrfs_is_empty_uuid(u8 *uuid);
......
...@@ -2931,7 +2931,7 @@ const struct file_operations btrfs_file_operations = { ...@@ -2931,7 +2931,7 @@ const struct file_operations btrfs_file_operations = {
.fallocate = btrfs_fallocate, .fallocate = btrfs_fallocate,
.unlocked_ioctl = btrfs_ioctl, .unlocked_ioctl = btrfs_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = btrfs_ioctl, .compat_ioctl = btrfs_compat_ioctl,
#endif #endif
.copy_file_range = btrfs_copy_file_range, .copy_file_range = btrfs_copy_file_range,
.clone_file_range = btrfs_clone_file_range, .clone_file_range = btrfs_clone_file_range,
......
...@@ -10088,7 +10088,7 @@ static const struct file_operations btrfs_dir_file_operations = { ...@@ -10088,7 +10088,7 @@ static const struct file_operations btrfs_dir_file_operations = {
.iterate = btrfs_real_readdir, .iterate = btrfs_real_readdir,
.unlocked_ioctl = btrfs_ioctl, .unlocked_ioctl = btrfs_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = btrfs_ioctl, .compat_ioctl = btrfs_compat_ioctl,
#endif #endif
.release = btrfs_release_file, .release = btrfs_release_file,
.fsync = btrfs_sync_file, .fsync = btrfs_sync_file,
......
...@@ -5555,3 +5555,24 @@ long btrfs_ioctl(struct file *file, unsigned int ...@@ -5555,3 +5555,24 @@ long btrfs_ioctl(struct file *file, unsigned int
return -ENOTTY; return -ENOTTY;
} }
#ifdef CONFIG_COMPAT
long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
switch (cmd) {
case FS_IOC32_GETFLAGS:
cmd = FS_IOC_GETFLAGS;
break;
case FS_IOC32_SETFLAGS:
cmd = FS_IOC_SETFLAGS;
break;
case FS_IOC32_GETVERSION:
cmd = FS_IOC_GETVERSION;
break;
default:
return -ENOIOCTLCMD;
}
return btrfs_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment