btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl
PATCH v2 1/1 btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl
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 Luke Dashjr <[email protected]>
--- fs/btrfs/ctree.h | 1 + fs/btrfs/file.c | 2 +- fs/btrfs/inode.c | 2 +- fs/btrfs/ioctl.c | 21 +++++++++++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-)
fs/btrfs/ctree.h +1 -0
@@ -3956,6 +3956,7 @@ void btrfs_test_inode_set_ops(struct inode *inode);/* ioctl.c */ 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_inherit_iflags (struct inode *inode,struct inode *dir);int btrfs_is_empty_uuid (u8 *uuid);
fs/btrfs/file.c +1 -1
@@ -2811,7 +2811,7 @@ const struct file_operations btrfs_file_operations = { .fallocate = btrfs_fallocate, .unlocked_ioctl = btrfs_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = btrfs_ioctl, + .compat_ioctl = btrfs_compat_ioctl,#endif };
fs/btrfs/inode.c +1 -1
@@ -9812,7 +9812,7 @@ static const struct file_operations btrfs_dir_file_operations = { .iterate = btrfs_real_readdir, .unlocked_ioctl = btrfs_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = btrfs_ioctl, + .compat_ioctl = btrfs_compat_ioctl, #endif .release = btrfs_release_file, .fsync = btrfs_sync_file,
fs/btrfs/ioctl.c +21 -0
@@ -5357,3 +5357,24 @@ long btrfs_ioctl(struct file *file, unsigned intreturn -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
Signature · 1 line
2.4.10
Quoted 6 lines · Luke Dashjr
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 Luke Dashjr <[email protected]>
Reviewed-by David Sterba <[email protected]>
Quoted 4 lines · Luke Dashjr
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.
Looks good, thanks,
Reviewed-by Josef Bacik <[email protected]>