Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 13 Oct 2014 09:28:42 +0000 (11:28 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 13 Oct 2014 09:28:42 +0000 (11:28 +0200)
Pull vfs updates from Al Viro:
 "The big thing in this pile is Eric's unmount-on-rmdir series; we
  finally have everything we need for that.  The final piece of prereqs
  is delayed mntput() - now filesystem shutdown always happens on
  shallow stack.

  Other than that, we have several new primitives for iov_iter (Matt
  Wilcox, culled from his XIP-related series) pushing the conversion to
  ->read_iter()/ ->write_iter() a bit more, a bunch of fs/dcache.c
  cleanups and fixes (including the external name refcounting, which
  gives consistent behaviour of d_move() wrt procfs symlinks for long
  and short names alike) and assorted cleanups and fixes all over the
  place.

  This is just the first pile; there's a lot of stuff from various
  people that ought to go in this window.  Starting with
  unionmount/overlayfs mess...  ;-/"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (60 commits)
  fs/file_table.c: Update alloc_file() comment
  vfs: Deduplicate code shared by xattr system calls operating on paths
  reiserfs: remove pointless forward declaration of struct nameidata
  don't need that forward declaration of struct nameidata in dcache.h anymore
  take dname_external() into fs/dcache.c
  let path_init() failures treated the same way as subsequent link_path_walk()
  fix misuses of f_count() in ppp and netlink
  ncpfs: use list_for_each_entry() for d_subdirs walk
  vfs: move getname() from callers to do_mount()
  gfs2_atomic_open(): skip lookups on hashed dentry
  [infiniband] remove pointless assignments
  gadgetfs: saner API for gadgetfs_create_file()
  f_fs: saner API for ffs_sb_create_file()
  jfs: don't hash direct inode
  [s390] remove pointless assignment of ->f_op in vmlogrdr ->open()
  ecryptfs: ->f_op is never NULL
  android: ->f_op is never NULL
  nouveau: __iomem misannotations
  missing annotation in fs/file.c
  fs: namespace: suppress 'may be used uninitialized' warnings
  ...

16 files changed:
1  2 
Documentation/filesystems/vfs.txt
drivers/net/ppp/ppp_generic.c
drivers/staging/vme/devices/vme_user.c
drivers/usb/gadget/function/f_fs.c
drivers/usb/gadget/legacy/inode.c
fs/btrfs/ioctl.c
fs/buffer.c
fs/cifs/file.c
fs/ecryptfs/file.c
fs/file_table.c
fs/gfs2/inode.c
fs/internal.h
fs/namei.c
fs/proc/base.c
fs/super.c
include/linux/fs.h

@@@ -237,7 -237,7 +237,7 @@@ noted. This means that most methods ca
  only called from a process context (i.e. not from an interrupt handler
  or bottom half).
  
-   alloc_inode: this method is called by inode_alloc() to allocate memory
+   alloc_inode: this method is called by alloc_inode() to allocate memory
        for struct inode and initialize it.  If this function is not
        defined, a simple 'struct inode' is allocated.  Normally
        alloc_inode will be used to allocate a larger structure which
@@@ -826,7 -826,7 +826,7 @@@ struct file_operations 
        int (*flock) (struct file *, int, struct file_lock *);
        ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, size_t, unsigned int);
        ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int);
 -      int (*setlease)(struct file *, long arg, struct file_lock **);
 +      int (*setlease)(struct file *, long arg, struct file_lock **, void **);
        long (*fallocate)(struct file *, int mode, loff_t offset, loff_t len);
        int (*show_fdinfo)(struct seq_file *m, struct file *f);
  };
@@@ -895,9 -895,8 +895,9 @@@ otherwise noted
    splice_read: called by the VFS to splice data from file to a pipe. This
               method is used by the splice(2) system call
  
 -  setlease: called by the VFS to set or release a file lock lease.
 -          setlease has the file_lock_lock held and must not sleep.
 +  setlease: called by the VFS to set or release a file lock lease. setlease
 +          implementations should call generic_setlease to record or remove
 +          the lease in the inode after setting it.
  
    fallocate: called by the VFS to preallocate blocks or punch a hole.
  
@@@ -594,7 -594,7 +594,7 @@@ static long ppp_ioctl(struct file *file
                        if (file == ppp->owner)
                                ppp_shutdown_interface(ppp);
                }
-               if (atomic_long_read(&file->f_count) <= 2) {
+               if (atomic_long_read(&file->f_count) < 2) {
                        ppp_release(NULL, file);
                        err = 0;
                } else
@@@ -1103,7 -1103,7 +1103,7 @@@ static void ppp_setup(struct net_devic
        dev->type = ARPHRD_PPP;
        dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
        dev->features |= NETIF_F_NETNS_LOCAL;
 -      dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
 +      netif_keep_dst(dev);
  }
  
  /*
@@@ -410,41 -410,19 +410,19 @@@ static ssize_t vme_user_write(struct fi
  
  static loff_t vme_user_llseek(struct file *file, loff_t off, int whence)
  {
-       loff_t absolute = -1;
        unsigned int minor = MINOR(file_inode(file)->i_rdev);
        size_t image_size;
+       loff_t res;
  
        if (minor == CONTROL_MINOR)
                return -EINVAL;
  
        mutex_lock(&image[minor].mutex);
        image_size = vme_get_size(image[minor].resource);
-       switch (whence) {
-       case SEEK_SET:
-               absolute = off;
-               break;
-       case SEEK_CUR:
-               absolute = file->f_pos + off;
-               break;
-       case SEEK_END:
-               absolute = image_size + off;
-               break;
-       default:
-               mutex_unlock(&image[minor].mutex);
-               return -EINVAL;
-       }
-       if ((absolute < 0) || (absolute >= image_size)) {
-               mutex_unlock(&image[minor].mutex);
-               return -EINVAL;
-       }
-       file->f_pos = absolute;
+       res = fixed_size_llseek(file, off, whence, image_size);
        mutex_unlock(&image[minor].mutex);
  
-       return absolute;
+       return res;
  }
  
  /*
@@@ -482,9 -460,11 +460,9 @@@ static int vme_user_ioctl(struct inode 
                                return -EFAULT;
                        }
  
 -                      retval = vme_irq_generate(vme_user_bridge,
 +                      return vme_irq_generate(vme_user_bridge,
                                                  irq_req.level,
                                                  irq_req.statid);
 -
 -                      return retval;
                }
                break;
        case MASTER_MINOR:
@@@ -164,10 -164,9 +164,9 @@@ struct ffs_desc_helper 
  static int  __must_check ffs_epfiles_create(struct ffs_data *ffs);
  static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count);
  
- static struct inode *__must_check
+ static struct dentry *
  ffs_sb_create_file(struct super_block *sb, const char *name, void *data,
-                  const struct file_operations *fops,
-                  struct dentry **dentry_p);
+                  const struct file_operations *fops);
  
  /* Devices management *******************************************************/
  
@@@ -1032,29 -1031,6 +1031,29 @@@ static long ffs_epfile_ioctl(struct fil
                case FUNCTIONFS_ENDPOINT_REVMAP:
                        ret = epfile->ep->num;
                        break;
 +              case FUNCTIONFS_ENDPOINT_DESC:
 +              {
 +                      int desc_idx;
 +                      struct usb_endpoint_descriptor *desc;
 +
 +                      switch (epfile->ffs->gadget->speed) {
 +                      case USB_SPEED_SUPER:
 +                              desc_idx = 2;
 +                              break;
 +                      case USB_SPEED_HIGH:
 +                              desc_idx = 1;
 +                              break;
 +                      default:
 +                              desc_idx = 0;
 +                      }
 +                      desc = epfile->ep->descs[desc_idx];
 +
 +                      spin_unlock_irq(&epfile->ffs->eps_lock);
 +                      ret = copy_to_user((void *)value, desc, sizeof(*desc));
 +                      if (ret)
 +                              ret = -EFAULT;
 +                      return ret;
 +              }
                default:
                        ret = -ENOTTY;
                }
@@@ -1119,10 -1095,9 +1118,9 @@@ ffs_sb_make_inode(struct super_block *s
  }
  
  /* Create "regular" file */
- static struct inode *ffs_sb_create_file(struct super_block *sb,
+ static struct dentry *ffs_sb_create_file(struct super_block *sb,
                                        const char *name, void *data,
-                                       const struct file_operations *fops,
-                                       struct dentry **dentry_p)
+                                       const struct file_operations *fops)
  {
        struct ffs_data *ffs = sb->s_fs_info;
        struct dentry   *dentry;
        }
  
        d_add(dentry, inode);
-       if (dentry_p)
-               *dentry_p = dentry;
-       return inode;
+       return dentry;
  }
  
  /* Super block */
@@@ -1189,7 -1161,7 +1184,7 @@@ static int ffs_sb_fill(struct super_blo
  
        /* EP0 file */
        if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs,
-                                        &ffs_ep0_operations, NULL)))
+                                        &ffs_ep0_operations)))
                return -ENOMEM;
  
        return 0;
@@@ -1557,13 -1529,11 +1552,14 @@@ static int ffs_epfiles_create(struct ff
                epfile->ffs = ffs;
                mutex_init(&epfile->mutex);
                init_waitqueue_head(&epfile->wait);
 -              sprintf(epfiles->name, "ep%u",  i);
 +              if (ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)
 +                      sprintf(epfiles->name, "ep%02x", ffs->eps_addrmap[i]);
 +              else
 +                      sprintf(epfiles->name, "ep%u", i);
-               if (!unlikely(ffs_sb_create_file(ffs->sb, epfiles->name, epfile,
-                                                &ffs_epfile_operations,
-                                                &epfile->dentry))) {
+               epfile->dentry = ffs_sb_create_file(ffs->sb, epfiles->name,
+                                                epfile,
+                                                &ffs_epfile_operations);
+               if (unlikely(!epfile->dentry)) {
                        ffs_epfiles_destroy(epfiles, i - 1);
                        return -ENOMEM;
                }
@@@ -2109,12 -2079,10 +2105,12 @@@ static int __ffs_data_got_descs(struct 
                break;
        case FUNCTIONFS_DESCRIPTORS_MAGIC_V2:
                flags = get_unaligned_le32(data + 8);
 +              ffs->user_flags = flags;
                if (flags & ~(FUNCTIONFS_HAS_FS_DESC |
                              FUNCTIONFS_HAS_HS_DESC |
                              FUNCTIONFS_HAS_SS_DESC |
 -                            FUNCTIONFS_HAS_MS_OS_DESC)) {
 +                            FUNCTIONFS_HAS_MS_OS_DESC |
 +                            FUNCTIONFS_VIRTUAL_ADDR)) {
                        ret = -ENOSYS;
                        goto error;
                }
@@@ -2374,8 -2342,7 +2370,8 @@@ static void __ffs_event_add(struct ffs_
                break;
  
        default:
 -              BUG();
 +              WARN(1, "%d: unknown event, this should not happen\n", type);
 +              return;
        }
  
        {
@@@ -2422,8 -2389,7 +2418,8 @@@ static int __ffs_func_bind_do_descs(enu
        struct usb_endpoint_descriptor *ds = (void *)desc;
        struct ffs_function *func = priv;
        struct ffs_ep *ffs_ep;
 -      unsigned ep_desc_id, idx;
 +      unsigned ep_desc_id;
 +      int idx;
        static const char *speed_names[] = { "full", "high", "super" };
  
        if (type != FFS_DESCRIPTOR)
        } else {
                struct usb_request *req;
                struct usb_ep *ep;
 +              u8 bEndpointAddress;
  
 +              /*
 +               * We back up bEndpointAddress because autoconfig overwrites
 +               * it with physical endpoint address.
 +               */
 +              bEndpointAddress = ds->bEndpointAddress;
                pr_vdebug("autoconfig\n");
                ep = usb_ep_autoconfig(func->gadget, ds);
                if (unlikely(!ep))
                ffs_ep->req = req;
                func->eps_revmap[ds->bEndpointAddress &
                                 USB_ENDPOINT_NUMBER_MASK] = idx + 1;
 +              /*
 +               * If we use virtual address mapping, we restore
 +               * original bEndpointAddress value.
 +               */
 +              if (func->ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)
 +                      ds->bEndpointAddress = bEndpointAddress;
        }
        ffs_dump_mem(": Rewritten ep desc", ds, ds->bLength);
  
@@@ -2942,8 -2896,6 +2938,8 @@@ static int ffs_func_setup(struct usb_fu
                ret = ffs_func_revmap_ep(func, le16_to_cpu(creq->wIndex));
                if (unlikely(ret < 0))
                        return ret;
 +              if (func->ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)
 +                      ret = func->ffs->eps_addrmap[ret];
                break;
  
        default:
@@@ -198,7 -198,6 +198,6 @@@ struct ep_data 
        struct list_head                epfiles;
        wait_queue_head_t               wait;
        struct dentry                   *dentry;
-       struct inode                    *inode;
  };
  
  static inline void get_ep (struct ep_data *data)
@@@ -1618,10 -1617,9 +1617,9 @@@ static void destroy_ep_files (struct de
  }
  
  
- static struct inode *
+ static struct dentry *
  gadgetfs_create_file (struct super_block *sb, char const *name,
-               void *data, const struct file_operations *fops,
-               struct dentry **dentry_p);
+               void *data, const struct file_operations *fops);
  
  static int activate_ep_files (struct dev_data *dev)
  {
                if (!data->req)
                        goto enomem1;
  
-               data->inode = gadgetfs_create_file (dev->sb, data->name,
-                               data, &ep_config_operations,
-                               &data->dentry);
-               if (!data->inode)
+               data->dentry = gadgetfs_create_file (dev->sb, data->name,
+                               data, &ep_config_operations);
+               if (!data->dentry)
                        goto enomem2;
                list_add_tail (&data->epfiles, &dev->epfiles);
        }
@@@ -1775,7 -1772,6 +1772,7 @@@ static struct usb_gadget_driver gadgetf
        .bind           = gadgetfs_bind,
        .unbind         = gadgetfs_unbind,
        .setup          = gadgetfs_setup,
 +      .reset          = gadgetfs_disconnect,
        .disconnect     = gadgetfs_disconnect,
        .suspend        = gadgetfs_suspend,
  
@@@ -2012,10 -2008,9 +2009,9 @@@ gadgetfs_make_inode (struct super_bloc
  /* creates in fs root directory, so non-renamable and non-linkable.
   * so inode and dentry are paired, until device reconfig.
   */
- static struct inode *
+ static struct dentry *
  gadgetfs_create_file (struct super_block *sb, char const *name,
-               void *data, const struct file_operations *fops,
-               struct dentry **dentry_p)
+               void *data, const struct file_operations *fops)
  {
        struct dentry   *dentry;
        struct inode    *inode;
                return NULL;
        }
        d_add (dentry, inode);
-       *dentry_p = dentry;
-       return inode;
+       return dentry;
  }
  
  static const struct super_operations gadget_fs_operations = {
@@@ -2080,9 -2074,8 +2075,8 @@@ gadgetfs_fill_super (struct super_bloc
                goto Enomem;
  
        dev->sb = sb;
-       if (!gadgetfs_create_file (sb, CHIP,
-                               dev, &dev_init_operations,
-                               &dev->dentry)) {
+       dev->dentry = gadgetfs_create_file(sb, CHIP, dev, &dev_init_operations);
+       if (!dev->dentry) {
                put_dev(dev);
                goto Enomem;
        }
diff --combined fs/btrfs/ioctl.c
@@@ -332,9 -332,6 +332,9 @@@ static int btrfs_ioctl_setflags(struct 
                        goto out_drop;
  
        } else {
 +              ret = btrfs_set_prop(inode, "btrfs.compression", NULL, 0, 0);
 +              if (ret && ret != -ENODATA)
 +                      goto out_drop;
                ip->flags &= ~(BTRFS_INODE_COMPRESS | BTRFS_INODE_NOCOMPRESS);
        }
  
@@@ -480,7 -477,8 +480,7 @@@ static noinline int create_subvol(struc
        if (ret)
                goto fail;
  
 -      leaf = btrfs_alloc_free_block(trans, root, root->leafsize,
 -                                    0, objectid, NULL, 0, 0, 0);
 +      leaf = btrfs_alloc_tree_block(trans, root, 0, objectid, NULL, 0, 0, 0);
        if (IS_ERR(leaf)) {
                ret = PTR_ERR(leaf);
                goto fail;
        btrfs_set_stack_inode_generation(inode_item, 1);
        btrfs_set_stack_inode_size(inode_item, 3);
        btrfs_set_stack_inode_nlink(inode_item, 1);
 -      btrfs_set_stack_inode_nbytes(inode_item, root->leafsize);
 +      btrfs_set_stack_inode_nbytes(inode_item, root->nodesize);
        btrfs_set_stack_inode_mode(inode_item, S_IFDIR | 0755);
  
        btrfs_set_root_flags(&root_item, 0);
  
        key.objectid = objectid;
        key.offset = 0;
 -      btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
 +      key.type = BTRFS_ROOT_ITEM_KEY;
        ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key,
                                &root_item);
        if (ret)
@@@ -884,7 -882,7 +884,7 @@@ out_unlock
   * file you want to defrag, we return 0 to let you know to skip this
   * part of the file
   */
 -static int check_defrag_in_cache(struct inode *inode, u64 offset, int thresh)
 +static int check_defrag_in_cache(struct inode *inode, u64 offset, u32 thresh)
  {
        struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
        struct extent_map *em = NULL;
   */
  static int find_new_extents(struct btrfs_root *root,
                            struct inode *inode, u64 newer_than,
 -                          u64 *off, int thresh)
 +                          u64 *off, u32 thresh)
  {
        struct btrfs_path *path;
        struct btrfs_key min_key;
        min_key.offset = *off;
  
        while (1) {
 -              path->keep_locks = 1;
                ret = btrfs_search_forward(root, &min_key, path, newer_than);
                if (ret != 0)
                        goto none;
 -              path->keep_locks = 0;
 -              btrfs_unlock_up_safe(path, 1);
  process_slot:
                if (min_key.objectid != ino)
                        goto none;
@@@ -1028,7 -1029,7 +1028,7 @@@ static bool defrag_check_next_extent(st
        return ret;
  }
  
 -static int should_defrag_range(struct inode *inode, u64 start, int thresh,
 +static int should_defrag_range(struct inode *inode, u64 start, u32 thresh,
                               u64 *last_len, u64 *skip, u64 *defrag_end,
                               int compress)
  {
@@@ -1258,7 -1259,7 +1258,7 @@@ int btrfs_defrag_file(struct inode *ino
        int ret;
        int defrag_count = 0;
        int compress_type = BTRFS_COMPRESS_ZLIB;
 -      int extent_thresh = range->extent_thresh;
 +      u32 extent_thresh = range->extent_thresh;
        unsigned long max_cluster = (256 * 1024) >> PAGE_CACHE_SHIFT;
        unsigned long cluster = max_cluster;
        u64 new_align = ~((u64)128 * 1024 - 1);
                inode->i_mapping->writeback_index = i;
  
        while (i <= last_index && defrag_count < max_to_defrag &&
 -             (i < (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >>
 -              PAGE_CACHE_SHIFT)) {
 +             (i < DIV_ROUND_UP(i_size_read(inode), PAGE_CACHE_SIZE))) {
                /*
                 * make sure we stop running if someone unmounts
                 * the FS
                         * the should_defrag function tells us how much to skip
                         * bump our counter by the suggested amount
                         */
 -                      next = (skip + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 +                      next = DIV_ROUND_UP(skip, PAGE_CACHE_SIZE);
                        i = max(i + 1, next);
                        continue;
                }
@@@ -1552,7 -1554,7 +1552,7 @@@ static noinline int btrfs_ioctl_resize(
                goto out_free;
        }
  
 -      old_size = device->total_bytes;
 +      old_size = btrfs_device_get_total_bytes(device);
  
        if (mod < 0) {
                if (new_size > old_size) {
@@@ -2087,6 -2089,8 +2087,6 @@@ static noinline int search_ioctl(struc
        key.type = sk->min_type;
        key.offset = sk->min_offset;
  
 -      path->keep_locks = 1;
 -
        while (1) {
                ret = btrfs_search_forward(root, &key, path, sk->min_transid);
                if (ret != 0) {
@@@ -2419,9 -2423,7 +2419,7 @@@ static noinline int btrfs_ioctl_snap_de
                goto out_dput;
        }
  
-       err = d_invalidate(dentry);
-       if (err)
-               goto out_unlock;
+       d_invalidate(dentry);
  
        down_write(&root->fs_info->subvol_sem);
  
@@@ -2506,7 -2508,6 +2504,6 @@@ out_release
        btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
  out_up_write:
        up_write(&root->fs_info->subvol_sem);
- out_unlock:
        if (err) {
                spin_lock(&dest->root_item_lock);
                root_flags = btrfs_root_flags(&dest->root_item);
                ASSERT(dest->send_in_progress == 0);
  
                /* the last ref */
 -              if (dest->cache_inode) {
 -                      iput(dest->cache_inode);
 -                      dest->cache_inode = NULL;
 +              if (dest->ino_cache_inode) {
 +                      iput(dest->ino_cache_inode);
 +                      dest->ino_cache_inode = NULL;
                }
        }
  out_dput:
@@@ -2630,9 -2631,6 +2627,9 @@@ static long btrfs_ioctl_add_dev(struct 
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        ret = btrfs_init_new_device(root, vol_args->name);
  
 +      if (!ret)
 +              btrfs_info(root->fs_info, "disk added %s",vol_args->name);
 +
        kfree(vol_args);
  out:
        mutex_unlock(&root->fs_info->volume_mutex);
@@@ -2672,9 -2670,6 +2669,9 @@@ static long btrfs_ioctl_rm_dev(struct f
        mutex_unlock(&root->fs_info->volume_mutex);
        atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
  
 +      if (!ret)
 +              btrfs_info(root->fs_info, "disk deleted %s",vol_args->name);
 +
  out:
        kfree(vol_args);
  err_drop:
@@@ -2739,8 -2734,8 +2736,8 @@@ static long btrfs_ioctl_dev_info(struc
        }
  
        di_args->devid = dev->devid;
 -      di_args->bytes_used = dev->bytes_used;
 -      di_args->total_bytes = dev->total_bytes;
 +      di_args->bytes_used = btrfs_device_get_bytes_used(dev);
 +      di_args->total_bytes = btrfs_device_get_total_bytes(dev);
        memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid));
        if (dev->name) {
                struct rcu_string *name;
@@@ -3166,7 -3161,7 +3163,7 @@@ static void clone_update_extent_map(str
                                        em->start + em->len - 1, 0);
        }
  
 -      if (unlikely(ret))
 +      if (ret)
                set_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
                        &BTRFS_I(inode)->runtime_flags);
  }
@@@ -3201,7 -3196,7 +3198,7 @@@ static int btrfs_clone(struct inode *sr
        u64 last_dest_end = destoff;
  
        ret = -ENOMEM;
 -      buf = vmalloc(btrfs_level_size(root, 0));
 +      buf = vmalloc(root->nodesize);
        if (!buf)
                return ret;
  
@@@ -3254,11 -3249,11 +3251,11 @@@ process_slot
                slot = path->slots[0];
  
                btrfs_item_key_to_cpu(leaf, &key, slot);
 -              if (btrfs_key_type(&key) > BTRFS_EXTENT_DATA_KEY ||
 +              if (key.type > BTRFS_EXTENT_DATA_KEY ||
                    key.objectid != btrfs_ino(src))
                        break;
  
 -              if (btrfs_key_type(&key) == BTRFS_EXTENT_DATA_KEY) {
 +              if (key.type == BTRFS_EXTENT_DATA_KEY) {
                        struct btrfs_file_extent_item *extent;
                        int type;
                        u32 size;
@@@ -5285,12 -5280,6 +5282,12 @@@ long btrfs_ioctl(struct file *file, uns
                if (ret)
                        return ret;
                ret = btrfs_sync_fs(file->f_dentry->d_sb, 1);
 +              /*
 +               * The transaction thread may want to do more work,
 +               * namely it pokes the cleaner ktread that will start
 +               * processing uncleaned subvols.
 +               */
 +              wake_up_process(root->fs_info->transaction_kthread);
                return ret;
        }
        case BTRFS_IOC_START_SYNC:
diff --combined fs/buffer.c
@@@ -1253,7 -1253,7 +1253,7 @@@ static struct buffer_head *__bread_slow
   * a local interrupt disable for that.
   */
  
 -#define BH_LRU_SIZE   8
 +#define BH_LRU_SIZE   16
  
  struct bh_lru {
        struct buffer_head *bhs[BH_LRU_SIZE];
@@@ -2318,6 -2318,11 +2318,11 @@@ static int cont_expand_zero(struct fil
                err = 0;
  
                balance_dirty_pages_ratelimited(mapping);
+               if (unlikely(fatal_signal_pending(current))) {
+                       err = -EINTR;
+                       goto out;
+               }
        }
  
        /* page covers the boundary, find the boundary offset */
@@@ -2956,7 -2961,7 +2961,7 @@@ static void end_bio_bh_io_sync(struct b
  
  /*
   * This allows us to do IO even on the odd last sectors
 - * of a device, even if the bh block size is some multiple
 + * of a device, even if the block size is some multiple
   * of the physical sector size.
   *
   * We'll just truncate the bio to the size of the device,
   * errors, this only handles the "we need to be able to
   * do IO at the final sector" case.
   */
 -static void guard_bh_eod(int rw, struct bio *bio, struct buffer_head *bh)
 +void guard_bio_eod(int rw, struct bio *bio)
  {
        sector_t maxsector;
 -      unsigned bytes;
 +      struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
 +      unsigned truncated_bytes;
  
        maxsector = i_size_read(bio->bi_bdev->bd_inode) >> 9;
        if (!maxsector)
                return;
  
        maxsector -= bio->bi_iter.bi_sector;
 -      bytes = bio->bi_iter.bi_size;
 -      if (likely((bytes >> 9) <= maxsector))
 +      if (likely((bio->bi_iter.bi_size >> 9) <= maxsector))
                return;
  
 -      /* Uhhuh. We've got a bh that straddles the device size! */
 -      bytes = maxsector << 9;
 +      /* Uhhuh. We've got a bio that straddles the device size! */
 +      truncated_bytes = bio->bi_iter.bi_size - (maxsector << 9);
  
        /* Truncate the bio.. */
 -      bio->bi_iter.bi_size bytes;
 -      bio->bi_io_vec[0].bv_len = bytes;
 +      bio->bi_iter.bi_size -= truncated_bytes;
 +      bvec->bv_len -= truncated_bytes;
  
        /* ..and clear the end of the buffer for reads */
        if ((rw & RW_MASK) == READ) {
 -              void *kaddr = kmap_atomic(bh->b_page);
 -              memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes);
 -              kunmap_atomic(kaddr);
 -              flush_dcache_page(bh->b_page);
 +              zero_user(bvec->bv_page, bvec->bv_offset + bvec->bv_len,
 +                              truncated_bytes);
        }
  }
  
@@@ -3039,7 -3046,7 +3044,7 @@@ int _submit_bh(int rw, struct buffer_he
        bio->bi_flags |= bio_flags;
  
        /* Take care of bh's that straddle the end of the device */
 -      guard_bh_eod(rw, bio, bh);
 +      guard_bio_eod(rw, bio);
  
        if (buffer_meta(bh))
                rw |= REQ_META;
diff --combined fs/cifs/file.c
@@@ -1650,8 -1650,8 +1650,8 @@@ cifs_write(struct cifsFileInfo *open_fi
  
        cifs_sb = CIFS_SB(dentry->d_sb);
  
-       cifs_dbg(FYI, "write %zd bytes to offset %lld of %s\n",
-                write_size, *offset, dentry->d_name.name);
+       cifs_dbg(FYI, "write %zd bytes to offset %lld of %pd\n",
+                write_size, *offset, dentry);
  
        tcon = tlink_tcon(open_file->tlink);
        server = tcon->ses->server;
@@@ -2273,8 -2273,8 +2273,8 @@@ int cifs_strict_fsync(struct file *file
  
        xid = get_xid();
  
-       cifs_dbg(FYI, "Sync file - name: %s datasync: 0x%x\n",
-                file->f_path.dentry->d_name.name, datasync);
+       cifs_dbg(FYI, "Sync file - name: %pD datasync: 0x%x\n",
+                file, datasync);
  
        if (!CIFS_CACHE_READ(CIFS_I(inode))) {
                rc = cifs_zap_mapping(inode);
@@@ -2315,8 -2315,8 +2315,8 @@@ int cifs_fsync(struct file *file, loff_
  
        xid = get_xid();
  
-       cifs_dbg(FYI, "Sync file - name: %s datasync: 0x%x\n",
-                file->f_path.dentry->d_name.name, datasync);
+       cifs_dbg(FYI, "Sync file - name: %pD datasync: 0x%x\n",
+                file, datasync);
  
        tcon = tlink_tcon(smbfile->tlink);
        if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) {
@@@ -3568,9 -3568,15 +3568,9 @@@ static int cifs_readpages(struct file *
                                lru_cache_add_file(page);
                                unlock_page(page);
                                page_cache_release(page);
 -                              if (rc == -EAGAIN)
 -                                      list_add_tail(&page->lru, &tmplist);
                        }
 +                      /* Fallback to the readpage in error/reconnect cases */
                        kref_put(&rdata->refcount, cifs_readdata_release);
 -                      if (rc == -EAGAIN) {
 -                              /* Re-add pages to the page_list and retry */
 -                              list_splice(&tmplist, page_list);
 -                              continue;
 -                      }
                        break;
                }
  
diff --combined fs/ecryptfs/file.c
@@@ -229,8 -229,8 +229,8 @@@ static int ecryptfs_open(struct inode *
        if (rc) {
                printk(KERN_ERR "%s: Error attempting to initialize "
                        "the lower file for the dentry with name "
 -                      "[%s]; rc = [%d]\n", __func__,
 -                      ecryptfs_dentry->d_name.name, rc);
 +                      "[%pd]; rc = [%d]\n", __func__,
 +                      ecryptfs_dentry, rc);
                goto out_free;
        }
        if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE)
@@@ -327,7 -327,7 +327,7 @@@ ecryptfs_compat_ioctl(struct file *file
        struct file *lower_file = ecryptfs_file_to_lower(file);
        long rc = -ENOIOCTLCMD;
  
-       if (lower_file->f_op && lower_file->f_op->compat_ioctl)
+       if (lower_file->f_op->compat_ioctl)
                rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
        return rc;
  }
diff --combined fs/file_table.c
@@@ -150,18 -150,10 +150,10 @@@ over
  
  /**
   * alloc_file - allocate and initialize a 'struct file'
-  * @mnt: the vfsmount on which the file will reside
-  * @dentry: the dentry representing the new file
+  *
+  * @path: the (dentry, vfsmount) pair for the new file
   * @mode: the mode with which the new file will be opened
   * @fop: the 'struct file_operations' for the new file
-  *
-  * Use this instead of get_empty_filp() to get a new
-  * 'struct file'.  Do so because of the same initialization
-  * pitfalls reasons listed for init_file().  This is a
-  * preferred interface to using init_file().
-  *
-  * If all the callers of init_file() are eliminated, its
-  * code should be moved into this function.
   */
  struct file *alloc_file(struct path *path, fmode_t mode,
                const struct file_operations *fop)
@@@ -331,5 -323,5 +323,5 @@@ void __init files_init(unsigned long me
  
        n = (mempages * (PAGE_SIZE / 1024)) / 10;
        files_stat.max_files = max_t(unsigned long, n, NR_FILE);
 -      percpu_counter_init(&nr_files, 0);
 +      percpu_counter_init(&nr_files, 0, GFP_KERNEL);
  } 
diff --combined fs/gfs2/inode.c
@@@ -600,7 -600,7 +600,7 @@@ static int gfs2_create_inode(struct ino
        int error, free_vfs_inode = 0;
        u32 aflags = 0;
        unsigned blocks = 1;
 -      struct gfs2_diradd da = { .bh = NULL, };
 +      struct gfs2_diradd da = { .bh = NULL, .save_loc = 1, };
  
        if (!name->len || name->len > GFS2_FNAMESIZE)
                return -ENAMETOOLONG;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        gfs2_set_inode_blocks(inode, 1);
        munge_mode_uid_gid(dip, inode);
 +      check_and_update_goal(dip);
        ip->i_goal = dip->i_goal;
        ip->i_diskflags = 0;
        ip->i_eattr = 0;
@@@ -900,7 -899,7 +900,7 @@@ static int gfs2_link(struct dentry *old
        struct gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_holder ghs[2];
        struct buffer_head *dibh;
 -      struct gfs2_diradd da = { .bh = NULL, };
 +      struct gfs2_diradd da = { .bh = NULL, .save_loc = 1, };
        int error;
  
        if (S_ISDIR(inode->i_mode))
@@@ -1245,6 -1244,9 +1245,9 @@@ static int gfs2_atomic_open(struct inod
        struct dentry *d;
        bool excl = !!(flags & O_EXCL);
  
+       if (!d_unhashed(dentry))
+               goto skip_lookup;
        d = __gfs2_lookup(dir, dentry, file, opened);
        if (IS_ERR(d))
                return PTR_ERR(d);
        }
  
        BUG_ON(d != NULL);
+ skip_lookup:
        if (!(flags & O_CREAT))
                return -ENOENT;
  
@@@ -1338,7 -1342,7 +1343,7 @@@ static int gfs2_rename(struct inode *od
        struct gfs2_rgrpd *nrgd;
        unsigned int num_gh;
        int dir_rename = 0;
 -      struct gfs2_diradd da = { .nr_blocks = 0, };
 +      struct gfs2_diradd da = { .nr_blocks = 0, .save_loc = 0, };
        unsigned int x;
        int error;
  
diff --combined fs/internal.h
@@@ -34,11 -34,6 +34,11 @@@ static inline int __sync_blockdev(struc
  }
  #endif
  
 +/*
 + * buffer.c
 + */
 +extern void guard_bio_eod(int rw, struct bio *bio);
 +
  /*
   * char_dev.c
   */
@@@ -56,7 -51,7 +56,7 @@@ extern int vfs_path_lookup(struct dentr
   * namespace.c
   */
  extern int copy_mount_options(const void __user *, unsigned long *);
- extern int copy_mount_string(const void __user *, char **);
+ extern char *copy_mount_string(const void __user *);
  
  extern struct vfsmount *lookup_mnt(struct path *);
  extern int finish_automount(struct vfsmount *, struct path *);
diff --combined fs/namei.c
@@@ -1306,7 -1306,8 +1306,8 @@@ static struct dentry *lookup_dcache(str
                                if (error < 0) {
                                        dput(dentry);
                                        return ERR_PTR(error);
-                               } else if (!d_invalidate(dentry)) {
+                               } else {
+                                       d_invalidate(dentry);
                                        dput(dentry);
                                        dentry = NULL;
                                }
@@@ -1435,10 -1436,9 +1436,9 @@@ unlazy
                        dput(dentry);
                        return status;
                }
-               if (!d_invalidate(dentry)) {
-                       dput(dentry);
-                       goto need_lookup;
-               }
+               d_invalidate(dentry);
+               dput(dentry);
+               goto need_lookup;
        }
  
        path->mnt = mnt;
@@@ -1950,7 -1950,7 +1950,7 @@@ static int path_lookupat(int dfd, cons
        err = path_init(dfd, name, flags | LOOKUP_PARENT, nd, &base);
  
        if (unlikely(err))
-               return err;
+               goto out;
  
        current->total_link_count = 0;
        err = link_path_walk(name, nd);
                }
        }
  
+ out:
        if (base)
                fput(base);
  
@@@ -2301,7 -2302,7 +2302,7 @@@ path_mountpoint(int dfd, const char *na
  
        err = path_init(dfd, name, flags | LOOKUP_PARENT, &nd, &base);
        if (unlikely(err))
-               return err;
+               goto out;
  
        current->total_link_count = 0;
        err = link_path_walk(name, &nd);
@@@ -3074,7 -3075,7 +3075,7 @@@ opened
        error = open_check_o_direct(file);
        if (error)
                goto exit_fput;
 -      error = ima_file_check(file, op->acc_mode);
 +      error = ima_file_check(file, op->acc_mode, *opened);
        if (error)
                goto exit_fput;
  
@@@ -3565,7 -3566,7 +3566,7 @@@ int vfs_rmdir(struct inode *dir, struc
        mutex_lock(&dentry->d_inode->i_mutex);
  
        error = -EBUSY;
-       if (d_mountpoint(dentry))
+       if (is_local_mountpoint(dentry))
                goto out;
  
        error = security_inode_rmdir(dir, dentry);
  
        dentry->d_inode->i_flags |= S_DEAD;
        dont_mount(dentry);
+       detach_mounts(dentry);
  
  out:
        mutex_unlock(&dentry->d_inode->i_mutex);
@@@ -3681,7 -3683,7 +3683,7 @@@ int vfs_unlink(struct inode *dir, struc
                return -EPERM;
  
        mutex_lock(&target->i_mutex);
-       if (d_mountpoint(dentry))
+       if (is_local_mountpoint(dentry))
                error = -EBUSY;
        else {
                error = security_inode_unlink(dir, dentry);
                        if (error)
                                goto out;
                        error = dir->i_op->unlink(dir, dentry);
-                       if (!error)
+                       if (!error) {
                                dont_mount(dentry);
+                               detach_mounts(dentry);
+                       }
                }
        }
  out:
@@@ -4126,7 -4130,7 +4130,7 @@@ int vfs_rename(struct inode *old_dir, s
                mutex_lock(&target->i_mutex);
  
        error = -EBUSY;
-       if (d_mountpoint(old_dentry) || d_mountpoint(new_dentry))
+       if (is_local_mountpoint(old_dentry) || is_local_mountpoint(new_dentry))
                goto out;
  
        if (max_links && new_dir != old_dir) {
                if (is_dir)
                        target->i_flags |= S_DEAD;
                dont_mount(new_dentry);
+               detach_mounts(new_dentry);
        }
        if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) {
                if (!(flags & RENAME_EXCHANGE))
diff --combined fs/proc/base.c
@@@ -376,6 -376,37 +376,6 @@@ static const struct file_operations pro
  
  #endif
  
 -#ifdef CONFIG_CGROUPS
 -static int cgroup_open(struct inode *inode, struct file *file)
 -{
 -      struct pid *pid = PROC_I(inode)->pid;
 -      return single_open(file, proc_cgroup_show, pid);
 -}
 -
 -static const struct file_operations proc_cgroup_operations = {
 -      .open           = cgroup_open,
 -      .read           = seq_read,
 -      .llseek         = seq_lseek,
 -      .release        = single_release,
 -};
 -#endif
 -
 -#ifdef CONFIG_PROC_PID_CPUSET
 -
 -static int cpuset_open(struct inode *inode, struct file *file)
 -{
 -      struct pid *pid = PROC_I(inode)->pid;
 -      return single_open(file, proc_cpuset_show, pid);
 -}
 -
 -static const struct file_operations proc_cpuset_operations = {
 -      .open           = cpuset_open,
 -      .read           = seq_read,
 -      .llseek         = seq_lseek,
 -      .release        = single_release,
 -};
 -#endif
 -
  static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
                          struct pid *pid, struct task_struct *task)
  {
@@@ -601,35 -632,29 +601,35 @@@ static const struct file_operations pro
        .release        = single_release,
  };
  
 -static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
 +
 +struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode)
  {
 -      struct task_struct *task = get_proc_task(file_inode(file));
 -      struct mm_struct *mm;
 +      struct task_struct *task = get_proc_task(inode);
 +      struct mm_struct *mm = ERR_PTR(-ESRCH);
  
 -      if (!task)
 -              return -ESRCH;
 +      if (task) {
 +              mm = mm_access(task, mode);
 +              put_task_struct(task);
  
 -      mm = mm_access(task, mode);
 -      put_task_struct(task);
 +              if (!IS_ERR_OR_NULL(mm)) {
 +                      /* ensure this mm_struct can't be freed */
 +                      atomic_inc(&mm->mm_count);
 +                      /* but do not pin its memory */
 +                      mmput(mm);
 +              }
 +      }
 +
 +      return mm;
 +}
 +
 +static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
 +{
 +      struct mm_struct *mm = proc_mem_open(inode, mode);
  
        if (IS_ERR(mm))
                return PTR_ERR(mm);
  
 -      if (mm) {
 -              /* ensure this mm_struct can't be freed */
 -              atomic_inc(&mm->mm_count);
 -              /* but do not pin its memory */
 -              mmput(mm);
 -      }
 -
        file->private_data = mm;
 -
        return 0;
  }
  
@@@ -1565,7 -1590,6 +1565,6 @@@ int pid_revalidate(struct dentry *dentr
                put_task_struct(task);
                return 1;
        }
-       d_drop(dentry);
        return 0;
  }
  
@@@ -1702,9 -1726,6 +1701,6 @@@ out
        put_task_struct(task);
  
  out_notask:
-       if (status <= 0)
-               d_drop(dentry);
        return status;
  }
  
@@@ -2548,10 -2569,10 +2544,10 @@@ static const struct pid_entry tgid_base
        REG("latency",  S_IRUGO, proc_lstats_operations),
  #endif
  #ifdef CONFIG_PROC_PID_CPUSET
 -      REG("cpuset",     S_IRUGO, proc_cpuset_operations),
 +      ONE("cpuset",     S_IRUGO, proc_cpuset_show),
  #endif
  #ifdef CONFIG_CGROUPS
 -      REG("cgroup",  S_IRUGO, proc_cgroup_operations),
 +      ONE("cgroup",  S_IRUGO, proc_cgroup_show),
  #endif
        ONE("oom_score",  S_IRUGO, proc_oom_score),
        REG("oom_adj",    S_IRUGO|S_IWUSR, proc_oom_adj_operations),
@@@ -2618,8 -2639,7 +2614,7 @@@ static void proc_flush_task_mnt(struct 
        /* no ->d_hash() rejects on procfs */
        dentry = d_hash_and_lookup(mnt->mnt_root, &name);
        if (dentry) {
-               shrink_dcache_parent(dentry);
-               d_drop(dentry);
+               d_invalidate(dentry);
                dput(dentry);
        }
  
        name.len = snprintf(buf, sizeof(buf), "%d", pid);
        dentry = d_hash_and_lookup(dir, &name);
        if (dentry) {
-               shrink_dcache_parent(dentry);
-               d_drop(dentry);
+               d_invalidate(dentry);
                dput(dentry);
        }
  
@@@ -2894,10 -2913,10 +2888,10 @@@ static const struct pid_entry tid_base_
        REG("latency",  S_IRUGO, proc_lstats_operations),
  #endif
  #ifdef CONFIG_PROC_PID_CPUSET
 -      REG("cpuset",    S_IRUGO, proc_cpuset_operations),
 +      ONE("cpuset",    S_IRUGO, proc_cpuset_show),
  #endif
  #ifdef CONFIG_CGROUPS
 -      REG("cgroup",  S_IRUGO, proc_cgroup_operations),
 +      ONE("cgroup",  S_IRUGO, proc_cgroup_show),
  #endif
        ONE("oom_score", S_IRUGO, proc_oom_score),
        REG("oom_adj",   S_IRUGO|S_IWUSR, proc_oom_adj_operations),
diff --combined fs/super.c
@@@ -80,6 -80,8 +80,8 @@@ static unsigned long super_cache_scan(s
        inodes = list_lru_count_node(&sb->s_inode_lru, sc->nid);
        dentries = list_lru_count_node(&sb->s_dentry_lru, sc->nid);
        total_objects = dentries + inodes + fs_objects + 1;
+       if (!total_objects)
+               total_objects = 1;
  
        /* proportion the scan between the caches */
        dentries = mult_frac(sc->nr_to_scan, dentries, total_objects);
@@@ -175,8 -177,7 +177,8 @@@ static struct super_block *alloc_super(
                goto fail;
  
        for (i = 0; i < SB_FREEZE_LEVELS; i++) {
 -              if (percpu_counter_init(&s->s_writers.counter[i], 0) < 0)
 +              if (percpu_counter_init(&s->s_writers.counter[i], 0,
 +                                      GFP_KERNEL) < 0)
                        goto fail;
                lockdep_init_map(&s->s_writers.lock_map[i], sb_writers_name[i],
                                 &type->s_writers_key[i], 0);
diff --combined include/linux/fs.h
@@@ -851,7 -851,13 +851,7 @@@ static inline struct file *get_file(str
   */
  #define FILE_LOCK_DEFERRED 1
  
 -/*
 - * The POSIX file lock owner is determined by
 - * the "struct files_struct" in the thread group
 - * (or NULL for no owner - BSD locks).
 - *
 - * Lockd stuffs a "host" pointer into this.
 - */
 +/* legacy typedef, should eventually be removed */
  typedef void *fl_owner_t;
  
  struct file_lock_operations {
  struct lock_manager_operations {
        int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
        unsigned long (*lm_owner_key)(struct file_lock *);
 +      void (*lm_get_owner)(struct file_lock *, struct file_lock *);
 +      void (*lm_put_owner)(struct file_lock *);
        void (*lm_notify)(struct file_lock *);  /* unblock callback */
 -      int (*lm_grant)(struct file_lock *, struct file_lock *, int);
 -      void (*lm_break)(struct file_lock *);
 -      int (*lm_change)(struct file_lock **, int);
 +      int (*lm_grant)(struct file_lock *, int);
 +      bool (*lm_break)(struct file_lock *);
 +      int (*lm_change)(struct file_lock **, int, struct list_head *);
 +      void (*lm_setup)(struct file_lock *, void **);
  };
  
  struct lock_manager {
@@@ -963,7 -966,7 +963,7 @@@ void locks_free_lock(struct file_lock *
  extern void locks_init_lock(struct file_lock *);
  extern struct file_lock * locks_alloc_lock(void);
  extern void locks_copy_lock(struct file_lock *, struct file_lock *);
 -extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
 +extern void locks_copy_conflock(struct file_lock *, struct file_lock *);
  extern void locks_remove_posix(struct file *, fl_owner_t);
  extern void locks_remove_file(struct file *);
  extern void locks_release_private(struct file_lock *);
@@@ -977,9 -980,11 +977,9 @@@ extern int vfs_cancel_lock(struct file 
  extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
  extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
  extern void lease_get_mtime(struct inode *, struct timespec *time);
 -extern int generic_setlease(struct file *, long, struct file_lock **);
 -extern int vfs_setlease(struct file *, long, struct file_lock **);
 -extern int lease_modify(struct file_lock **, int);
 -extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
 -extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
 +extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
 +extern int vfs_setlease(struct file *, long, struct file_lock **, void **);
 +extern int lease_modify(struct file_lock **, int, struct list_head *);
  #else /* !CONFIG_FILE_LOCKING */
  static inline int fcntl_getlk(struct file *file, unsigned int cmd,
                              struct flock __user *user)
@@@ -1008,12 -1013,12 +1008,12 @@@ static inline int fcntl_setlk64(unsigne
  #endif
  static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
  {
 -      return 0;
 +      return -EINVAL;
  }
  
  static inline int fcntl_getlease(struct file *filp)
  {
 -      return 0;
 +      return F_UNLCK;
  }
  
  static inline void locks_init_lock(struct file_lock *fl)
        return;
  }
  
 -static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl)
 +static inline void locks_copy_conflock(struct file_lock *new, struct file_lock *fl)
  {
        return;
  }
@@@ -1095,22 -1100,33 +1095,22 @@@ static inline void lease_get_mtime(stru
  }
  
  static inline int generic_setlease(struct file *filp, long arg,
 -                                  struct file_lock **flp)
 +                                  struct file_lock **flp, void **priv)
  {
        return -EINVAL;
  }
  
  static inline int vfs_setlease(struct file *filp, long arg,
 -                             struct file_lock **lease)
 +                             struct file_lock **lease, void **priv)
  {
        return -EINVAL;
  }
  
 -static inline int lease_modify(struct file_lock **before, int arg)
 +static inline int lease_modify(struct file_lock **before, int arg,
 +                             struct list_head *dispose)
  {
        return -EINVAL;
  }
 -
 -static inline int lock_may_read(struct inode *inode, loff_t start,
 -                              unsigned long len)
 -{
 -      return 1;
 -}
 -
 -static inline int lock_may_write(struct inode *inode, loff_t start,
 -                               unsigned long len)
 -{
 -      return 1;
 -}
  #endif /* !CONFIG_FILE_LOCKING */
  
  
@@@ -1135,8 -1151,8 +1135,8 @@@ extern void fasync_free(struct fasync_s
  /* can be called from interrupts */
  extern void kill_fasync(struct fasync_struct **, int, int);
  
 -extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
 -extern int f_setown(struct file *filp, unsigned long arg, int force);
 +extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
 +extern void f_setown(struct file *filp, unsigned long arg, int force);
  extern void f_delown(struct file *filp);
  extern pid_t f_getown(struct file *filp);
  extern int send_sigurg(struct fown_struct *fown);
@@@ -1490,7 -1506,7 +1490,7 @@@ struct file_operations 
        int (*flock) (struct file *, int, struct file_lock *);
        ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
        ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
 -      int (*setlease)(struct file *, long, struct file_lock **);
 +      int (*setlease)(struct file *, long, struct file_lock **, void **);
        long (*fallocate)(struct file *file, int mode, loff_t offset,
                          loff_t len);
        int (*show_fdinfo)(struct seq_file *m, struct file *f);
@@@ -1839,7 -1855,8 +1839,8 @@@ extern struct vfsmount *kern_mount_data
  extern void kern_unmount(struct vfsmount *mnt);
  extern int may_umount_tree(struct vfsmount *);
  extern int may_umount(struct vfsmount *);
- extern long do_mount(const char *, const char *, const char *, unsigned long, void *);
+ extern long do_mount(const char *, const char __user *,
+                    const char *, unsigned long, void *);
  extern struct vfsmount *collect_mounts(struct path *);
  extern void drop_collected_mounts(struct vfsmount *);
  extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
@@@ -1858,7 -1875,7 +1859,7 @@@ extern int current_umask(void)
  extern void ihold(struct inode * inode);
  extern void iput(struct inode *);
  
- static inline struct inode *file_inode(struct file *f)
+ static inline struct inode *file_inode(const struct file *f)
  {
        return f->f_inode;
  }
@@@ -2595,7 -2612,6 +2596,7 @@@ extern int simple_write_end(struct fil
                        struct page *page, void *fsdata);
  extern int always_delete_dentry(const struct dentry *);
  extern struct inode *alloc_anon_inode(struct super_block *);
 +extern int simple_nosetlease(struct file *, long, struct file_lock **, void **);
  extern const struct dentry_operations simple_dentry_operations;
  
  extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);