Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6:
BKL-removal: Implement a compat_ioctl handler for JFS
BKL-removal: Use unlocked_ioctl for jfs

+40 -7
+4 -1
fs/jfs/file.c
··· 112 .splice_write = generic_file_splice_write, 113 .fsync = jfs_fsync, 114 .release = jfs_release, 115 - .ioctl = jfs_ioctl, 116 };
··· 112 .splice_write = generic_file_splice_write, 113 .fsync = jfs_fsync, 114 .release = jfs_release, 115 + .unlocked_ioctl = jfs_ioctl, 116 + #ifdef CONFIG_COMPAT 117 + .compat_ioctl = jfs_compat_ioctl, 118 + #endif 119 };
+28 -3
fs/jfs/ioctl.c
··· 51 } 52 53 54 - int jfs_ioctl(struct inode * inode, struct file * filp, unsigned int cmd, 55 - unsigned long arg) 56 { 57 struct jfs_inode_info *jfs_inode = JFS_IP(inode); 58 unsigned int flags; 59 ··· 82 /* Is it quota file? Do not allow user to mess with it */ 83 if (IS_NOQUOTA(inode)) 84 return -EPERM; 85 jfs_get_inode_flags(jfs_inode); 86 oldflags = jfs_inode->mode2; 87 ··· 96 if ((oldflags & JFS_IMMUTABLE_FL) || 97 ((flags ^ oldflags) & 98 (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) { 99 - if (!capable(CAP_LINUX_IMMUTABLE)) 100 return -EPERM; 101 } 102 103 flags = flags & JFS_FL_USER_MODIFIABLE; ··· 107 jfs_inode->mode2 = flags; 108 109 jfs_set_inode_flags(inode); 110 inode->i_ctime = CURRENT_TIME_SEC; 111 mark_inode_dirty(inode); 112 return 0; ··· 117 } 118 } 119
··· 51 } 52 53 54 + long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 55 { 56 + struct inode *inode = filp->f_dentry->d_inode; 57 struct jfs_inode_info *jfs_inode = JFS_IP(inode); 58 unsigned int flags; 59 ··· 82 /* Is it quota file? Do not allow user to mess with it */ 83 if (IS_NOQUOTA(inode)) 84 return -EPERM; 85 + 86 + /* Lock against other parallel changes of flags */ 87 + mutex_lock(&inode->i_mutex); 88 + 89 jfs_get_inode_flags(jfs_inode); 90 oldflags = jfs_inode->mode2; 91 ··· 92 if ((oldflags & JFS_IMMUTABLE_FL) || 93 ((flags ^ oldflags) & 94 (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) { 95 + if (!capable(CAP_LINUX_IMMUTABLE)) { 96 + mutex_unlock(&inode->i_mutex); 97 return -EPERM; 98 + } 99 } 100 101 flags = flags & JFS_FL_USER_MODIFIABLE; ··· 101 jfs_inode->mode2 = flags; 102 103 jfs_set_inode_flags(inode); 104 + mutex_unlock(&inode->i_mutex); 105 inode->i_ctime = CURRENT_TIME_SEC; 106 mark_inode_dirty(inode); 107 return 0; ··· 110 } 111 } 112 113 + #ifdef CONFIG_COMPAT 114 + long jfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 115 + { 116 + /* While these ioctl numbers defined with 'long' and have different 117 + * numbers than the 64bit ABI, 118 + * the actual implementation only deals with ints and is compatible. 119 + */ 120 + switch (cmd) { 121 + case JFS_IOC_GETFLAGS32: 122 + cmd = JFS_IOC_GETFLAGS; 123 + break; 124 + case JFS_IOC_SETFLAGS32: 125 + cmd = JFS_IOC_SETFLAGS; 126 + break; 127 + } 128 + return jfs_ioctl(filp, cmd, arg); 129 + } 130 + #endif
+2
fs/jfs/jfs_dinode.h
··· 170 #define JFS_IOC_GETFLAGS _IOR('f', 1, long) 171 #define JFS_IOC_SETFLAGS _IOW('f', 2, long) 172 173 174 #endif /*_H_JFS_DINODE */
··· 170 #define JFS_IOC_GETFLAGS _IOR('f', 1, long) 171 #define JFS_IOC_SETFLAGS _IOW('f', 2, long) 172 173 + #define JFS_IOC_GETFLAGS32 _IOR('f', 1, int) 174 + #define JFS_IOC_SETFLAGS32 _IOW('f', 2, int) 175 176 #endif /*_H_JFS_DINODE */
+2 -2
fs/jfs/jfs_inode.h
··· 22 23 extern struct inode *ialloc(struct inode *, umode_t); 24 extern int jfs_fsync(struct file *, struct dentry *, int); 25 - extern int jfs_ioctl(struct inode *, struct file *, 26 - unsigned int, unsigned long); 27 extern struct inode *jfs_iget(struct super_block *, unsigned long); 28 extern int jfs_commit_inode(struct inode *, int); 29 extern int jfs_write_inode(struct inode*, int);
··· 22 23 extern struct inode *ialloc(struct inode *, umode_t); 24 extern int jfs_fsync(struct file *, struct dentry *, int); 25 + extern long jfs_ioctl(struct file *, unsigned int, unsigned long); 26 + extern long jfs_compat_ioctl(struct file *, unsigned int, unsigned long); 27 extern struct inode *jfs_iget(struct super_block *, unsigned long); 28 extern int jfs_commit_inode(struct inode *, int); 29 extern int jfs_write_inode(struct inode*, int);
+4 -1
fs/jfs/namei.c
··· 1556 .read = generic_read_dir, 1557 .readdir = jfs_readdir, 1558 .fsync = jfs_fsync, 1559 - .ioctl = jfs_ioctl, 1560 }; 1561 1562 static int jfs_ci_hash(struct dentry *dir, struct qstr *this)
··· 1556 .read = generic_read_dir, 1557 .readdir = jfs_readdir, 1558 .fsync = jfs_fsync, 1559 + .unlocked_ioctl = jfs_ioctl, 1560 + #ifdef CONFIG_COMPAT 1561 + .compat_ioctl = jfs_compat_ioctl, 1562 + #endif 1563 }; 1564 1565 static int jfs_ci_hash(struct dentry *dir, struct qstr *this)