]>
Commit | Line | Data |
---|---|---|
dcf4d15d GKH |
1 | From 4c63c2454eff996c5e27991221106eb511f7db38 Mon Sep 17 00:00:00 2001 |
2 | From: Luke Dashjr <luke@dashjr.org> | |
3 | Date: Thu, 29 Oct 2015 08:22:21 +0000 | |
4 | Subject: btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl | |
5 | ||
6 | From: Luke Dashjr <luke@dashjr.org> | |
7 | ||
8 | commit 4c63c2454eff996c5e27991221106eb511f7db38 upstream. | |
9 | ||
10 | 32-bit ioctl uses these rather than the regular FS_IOC_* versions. They can | |
11 | be handled in btrfs using the same code. Without this, 32-bit {ch,ls}attr | |
12 | fail. | |
13 | ||
14 | Signed-off-by: Luke Dashjr <luke-jr+git@utopios.org> | |
15 | Reviewed-by: Josef Bacik <jbacik@fb.com> | |
16 | Reviewed-by: David Sterba <dsterba@suse.com> | |
17 | Signed-off-by: David Sterba <dsterba@suse.com> | |
18 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
19 | ||
20 | --- | |
21 | fs/btrfs/ctree.h | 1 + | |
22 | fs/btrfs/file.c | 2 +- | |
23 | fs/btrfs/inode.c | 2 +- | |
24 | fs/btrfs/ioctl.c | 21 +++++++++++++++++++++ | |
25 | 4 files changed, 24 insertions(+), 2 deletions(-) | |
26 | ||
27 | --- a/fs/btrfs/ctree.h | |
28 | +++ b/fs/btrfs/ctree.h | |
29 | @@ -4122,6 +4122,7 @@ void btrfs_test_inode_set_ops(struct ino | |
30 | ||
31 | /* ioctl.c */ | |
32 | long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | |
33 | +long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | |
34 | int btrfs_ioctl_get_supported_features(void __user *arg); | |
35 | void btrfs_update_iflags(struct inode *inode); | |
36 | void btrfs_inherit_iflags(struct inode *inode, struct inode *dir); | |
37 | --- a/fs/btrfs/file.c | |
38 | +++ b/fs/btrfs/file.c | |
39 | @@ -2956,7 +2956,7 @@ const struct file_operations btrfs_file_ | |
40 | .fallocate = btrfs_fallocate, | |
41 | .unlocked_ioctl = btrfs_ioctl, | |
42 | #ifdef CONFIG_COMPAT | |
43 | - .compat_ioctl = btrfs_ioctl, | |
44 | + .compat_ioctl = btrfs_compat_ioctl, | |
45 | #endif | |
46 | .copy_file_range = btrfs_copy_file_range, | |
47 | .clone_file_range = btrfs_clone_file_range, | |
48 | --- a/fs/btrfs/inode.c | |
49 | +++ b/fs/btrfs/inode.c | |
50 | @@ -10184,7 +10184,7 @@ static const struct file_operations btrf | |
51 | .iterate = btrfs_real_readdir, | |
52 | .unlocked_ioctl = btrfs_ioctl, | |
53 | #ifdef CONFIG_COMPAT | |
54 | - .compat_ioctl = btrfs_ioctl, | |
55 | + .compat_ioctl = btrfs_compat_ioctl, | |
56 | #endif | |
57 | .release = btrfs_release_file, | |
58 | .fsync = btrfs_sync_file, | |
59 | --- a/fs/btrfs/ioctl.c | |
60 | +++ b/fs/btrfs/ioctl.c | |
61 | @@ -5552,3 +5552,24 @@ long btrfs_ioctl(struct file *file, unsi | |
62 | ||
63 | return -ENOTTY; | |
64 | } | |
65 | + | |
66 | +#ifdef CONFIG_COMPAT | |
67 | +long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |
68 | +{ | |
69 | + switch (cmd) { | |
70 | + case FS_IOC32_GETFLAGS: | |
71 | + cmd = FS_IOC_GETFLAGS; | |
72 | + break; | |
73 | + case FS_IOC32_SETFLAGS: | |
74 | + cmd = FS_IOC_SETFLAGS; | |
75 | + break; | |
76 | + case FS_IOC32_GETVERSION: | |
77 | + cmd = FS_IOC_GETVERSION; | |
78 | + break; | |
79 | + default: | |
80 | + return -ENOIOCTLCMD; | |
81 | + } | |
82 | + | |
83 | + return btrfs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); | |
84 | +} | |
85 | +#endif |