]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 14 Aug 2010 00:52:35 +0000 (17:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 14 Aug 2010 00:52:35 +0000 (17:52 -0700)
* 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
  bkl: Remove locked .ioctl file operation
  v4l: Remove reference to bkl ioctl in compat ioctl handling
  logfs: kill BKL

Documentation/filesystems/Locking
Documentation/filesystems/vfs.txt
drivers/media/video/v4l2-compat-ioctl32.c
fs/bad_inode.c
fs/compat_ioctl.c
fs/ioctl.c
fs/logfs/dir.c
fs/logfs/file.c
fs/logfs/logfs.h
fs/proc/inode.c
include/linux/fs.h

index bbcc15651a21c1e1dac6c390d0fc17e93dda66be..2db4283efa8dbf99e0e6576edc8d0a054d3b299d 100644 (file)
@@ -374,8 +374,6 @@ prototypes:
        ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
        int (*readdir) (struct file *, void *, filldir_t);
        unsigned int (*poll) (struct file *, struct poll_table_struct *);
-       int (*ioctl) (struct inode *, struct file *, unsigned int,
-                       unsigned long);
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
        int (*mmap) (struct file *, struct vm_area_struct *);
@@ -409,8 +407,7 @@ write:                      no
 aio_write:             no
 readdir:               no
 poll:                  no
-ioctl:                 yes     (see below)
-unlocked_ioctl:                no      (see below)
+unlocked_ioctl:                no
 compat_ioctl:          no
 mmap:                  no
 open:                  no
@@ -453,9 +450,6 @@ move ->readdir() to inode_operations and use a separate method for directory
 anything that resembles union-mount we won't have a struct file for all
 components. And there are other reasons why the current interface is a mess...
 
-->ioctl() on regular files is superceded by the ->unlocked_ioctl() that
-doesn't take the BKL.
-
 ->read on directories probably must go away - we should just enforce -EISDIR
 in sys_read() and friends.
 
index 94677e7dcb1311ac504c7f171fd6139deecddb5a..ed7e5efc06d8fe33dc54a2122a059fdbec874092 100644 (file)
@@ -727,7 +727,6 @@ struct file_operations {
        ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
        int (*readdir) (struct file *, void *, filldir_t);
        unsigned int (*poll) (struct file *, struct poll_table_struct *);
-       int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
        int (*mmap) (struct file *, struct vm_area_struct *);
@@ -768,10 +767,7 @@ otherwise noted.
        activity on this file and (optionally) go to sleep until there
        is activity. Called by the select(2) and poll(2) system calls
 
-  ioctl: called by the ioctl(2) system call
-
-  unlocked_ioctl: called by the ioctl(2) system call. Filesystems that do not
-       require the BKL should use this method instead of the ioctl() above.
+  unlocked_ioctl: called by the ioctl(2) system call.
 
   compat_ioctl: called by the ioctl(2) system call when 32 bit system calls
         are used on 64 bit kernels.
index d2f20c2acae2e99b7dd52c623f2158e6abcabc55..073f01390cdd0a00de7e34dc7cd30360b72912c4 100644 (file)
@@ -228,11 +228,6 @@ static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
        if (file->f_op->unlocked_ioctl)
                ret = file->f_op->unlocked_ioctl(file, cmd, arg);
-       else if (file->f_op->ioctl) {
-               lock_kernel();
-               ret = file->f_op->ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
-               unlock_kernel();
-       }
 
        return ret;
 }
@@ -973,7 +968,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
 {
        long ret = -ENOIOCTLCMD;
 
-       if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl)
+       if (!file->f_op->unlocked_ioctl)
                return ret;
 
        switch (cmd) {
index 52e59bf4aa5f512f365d509768984fa95b7d62f0..f024d8aaddefff929ec7d557fdfc6449ab7825b8 100644 (file)
@@ -55,12 +55,6 @@ static unsigned int bad_file_poll(struct file *filp, poll_table *wait)
        return POLLERR;
 }
 
-static int bad_file_ioctl (struct inode *inode, struct file *filp,
-                       unsigned int cmd, unsigned long arg)
-{
-       return -EIO;
-}
-
 static long bad_file_unlocked_ioctl(struct file *file, unsigned cmd,
                        unsigned long arg)
 {
@@ -159,7 +153,6 @@ static const struct file_operations bad_file_ops =
        .aio_write      = bad_file_aio_write,
        .readdir        = bad_file_readdir,
        .poll           = bad_file_poll,
-       .ioctl          = bad_file_ioctl,
        .unlocked_ioctl = bad_file_unlocked_ioctl,
        .compat_ioctl   = bad_file_compat_ioctl,
        .mmap           = bad_file_mmap,
index 70227e0dc01d4caa1165b3371a6d28e6a8690a61..03e59aa318eb0a2c9801857a9d343fa008fdc7a2 100644 (file)
@@ -1699,8 +1699,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
                                goto out_fput;
                }
 
-               if (!filp->f_op ||
-                   (!filp->f_op->ioctl && !filp->f_op->unlocked_ioctl))
+               if (!filp->f_op || !filp->f_op->unlocked_ioctl)
                        goto do_ioctl;
                break;
        }
index 2d140a713861badfb1c9b936c683805dab30853a..f855ea4fc88895a13b53b075b9a3fb0dbcb53d8b 100644 (file)
@@ -29,7 +29,6 @@
  * @arg:       command-specific argument for ioctl
  *
  * Invokes filesystem specific ->unlocked_ioctl, if one exists; otherwise
- * invokes filesystem specific ->ioctl method.  If neither method exists,
  * returns -ENOTTY.
  *
  * Returns 0 on success, -errno on error.
@@ -39,21 +38,12 @@ static long vfs_ioctl(struct file *filp, unsigned int cmd,
 {
        int error = -ENOTTY;
 
-       if (!filp->f_op)
+       if (!filp->f_op || !filp->f_op->unlocked_ioctl)
                goto out;
 
-       if (filp->f_op->unlocked_ioctl) {
-               error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
-               if (error == -ENOIOCTLCMD)
-                       error = -EINVAL;
-               goto out;
-       } else if (filp->f_op->ioctl) {
-               lock_kernel();
-               error = filp->f_op->ioctl(filp->f_path.dentry->d_inode,
-                                         filp, cmd, arg);
-               unlock_kernel();
-       }
-
+       error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
+       if (error == -ENOIOCTLCMD)
+               error = -EINVAL;
  out:
        return error;
 }
index 675cc49197feb177bcb67e0f0aefa66deed9cabd..9777eb5b552248410bd3331f97fb89e853149866 100644 (file)
@@ -824,7 +824,7 @@ const struct inode_operations logfs_dir_iops = {
 };
 const struct file_operations logfs_dir_fops = {
        .fsync          = logfs_fsync,
-       .ioctl          = logfs_ioctl,
+       .unlocked_ioctl = logfs_ioctl,
        .readdir        = logfs_readdir,
        .read           = generic_read_dir,
 };
index 4dd0f7c06e394e1a43b323f95f29784718a0ab9c..e86376b87af11d26034188df8d3c2da2bc469587 100644 (file)
@@ -181,9 +181,9 @@ static int logfs_releasepage(struct page *page, gfp_t only_xfs_uses_this)
 }
 
 
-int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-               unsigned long arg)
+long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
+       struct inode *inode = file->f_path.dentry->d_inode;
        struct logfs_inode *li = logfs_inode(inode);
        unsigned int oldflags, flags;
        int err;
@@ -255,7 +255,7 @@ const struct file_operations logfs_reg_fops = {
        .aio_read       = generic_file_aio_read,
        .aio_write      = generic_file_aio_write,
        .fsync          = logfs_fsync,
-       .ioctl          = logfs_ioctl,
+       .unlocked_ioctl = logfs_ioctl,
        .llseek         = generic_file_llseek,
        .mmap           = generic_file_readonly_mmap,
        .open           = generic_file_open,
index 5e3b720779516d8ec6d8c74794c57c861a5436d5..b8786264d243fcd49d31f9d3fe670657264e46d4 100644 (file)
@@ -504,8 +504,7 @@ extern const struct inode_operations logfs_reg_iops;
 extern const struct file_operations logfs_reg_fops;
 extern const struct address_space_operations logfs_reg_aops;
 int logfs_readpage(struct file *file, struct page *page);
-int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-               unsigned long arg);
+long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 int logfs_fsync(struct file *file, int datasync);
 
 /* gc.c */
index 23561cda7245432bc132a8e7f5c50c62dc75aa84..9c2b5f484879ad37a1633a6023524e2cb0151a3f 100644 (file)
@@ -214,8 +214,7 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
 {
        struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
        long rv = -ENOTTY;
-       long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long);
-       int (*ioctl)(struct inode *, struct file *, unsigned int, unsigned long);
+       long (*ioctl)(struct file *, unsigned int, unsigned long);
 
        spin_lock(&pde->pde_unload_lock);
        if (!pde->proc_fops) {
@@ -223,19 +222,11 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
                return rv;
        }
        pde->pde_users++;
-       unlocked_ioctl = pde->proc_fops->unlocked_ioctl;
-       ioctl = pde->proc_fops->ioctl;
+       ioctl = pde->proc_fops->unlocked_ioctl;
        spin_unlock(&pde->pde_unload_lock);
 
-       if (unlocked_ioctl) {
-               rv = unlocked_ioctl(file, cmd, arg);
-               if (rv == -ENOIOCTLCMD)
-                       rv = -EINVAL;
-       } else if (ioctl) {
-               WARN_ONCE(1, "Procfs ioctl handlers must use unlocked_ioctl, "
-                         "%pf will be called without the Bkl held\n", ioctl);
-               rv = ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
-       }
+       if (ioctl)
+               rv = ioctl(file, cmd, arg);
 
        pde_users_dec(pde);
        return rv;
index 5f0ca2fbb2a0e07fafeff21fa5f936ae59d15f54..9a96b4d83fc126a92adb9c87f7f1e5ae62bc0056 100644 (file)
@@ -1483,8 +1483,8 @@ struct block_device_operations;
 
 /*
  * NOTE:
- * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl
- * can be called without the big kernel lock held in all filesystems.
+ * all file operations except setlease can be called without
+ * the big kernel lock held in all filesystems.
  */
 struct file_operations {
        struct module *owner;
@@ -1495,7 +1495,6 @@ struct file_operations {
        ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
        int (*readdir) (struct file *, void *, filldir_t);
        unsigned int (*poll) (struct file *, struct poll_table_struct *);
-       int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
        int (*mmap) (struct file *, struct vm_area_struct *);