]> Git Repo - linux.git/commitdiff
Merge branch 'nfs-for-2.6.38' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
authorLinus Torvalds <[email protected]>
Tue, 11 Jan 2011 23:11:56 +0000 (15:11 -0800)
committerLinus Torvalds <[email protected]>
Tue, 11 Jan 2011 23:11:56 +0000 (15:11 -0800)
* 'nfs-for-2.6.38' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6: (89 commits)
  NFS fix the setting of exchange id flag
  NFS: Don't use vm_map_ram() in readdir
  NFSv4: Ensure continued open and lockowner name uniqueness
  NFS: Move cl_delegations to the nfs_server struct
  NFS: Introduce nfs_detach_delegations()
  NFS: Move cl_state_owners and related fields to the nfs_server struct
  NFS: Allow walking nfs_client.cl_superblocks list outside client.c
  pnfs: layout roc code
  pnfs: update nfs4_callback_recallany to handle layouts
  pnfs: add CB_LAYOUTRECALL handling
  pnfs: CB_LAYOUTRECALL xdr code
  pnfs: change lo refcounting to atomic_t
  pnfs: check that partial LAYOUTGET return is ignored
  pnfs: add layout to client list before sending rpc
  pnfs: serialize LAYOUTGET(openstateid)
  pnfs: layoutget rpc code cleanup
  pnfs: change how lsegs are removed from layout list
  pnfs: change layout state seqlock to a spinlock
  pnfs: add prefix to struct pnfs_layout_hdr fields
  pnfs: add prefix to struct pnfs_layout_segment fields
  ...

1  2 
fs/nfs/dir.c
fs/nfs/inode.c
fs/nfs/unlink.c
net/sunrpc/rpc_pipe.c

diff --combined fs/nfs/dir.c
index d33da530097acd350493bcbab2f315311f474b30,16ec096f6b2444c31711d1fd2615f830d10804fb..abe4f0c8dc5f927b8673d5f63764140dc874ff88
@@@ -33,8 -33,8 +33,8 @@@
  #include <linux/namei.h>
  #include <linux/mount.h>
  #include <linux/sched.h>
- #include <linux/vmalloc.h>
  #include <linux/kmemleak.h>
+ #include <linux/xattr.h>
  
  #include "delegation.h"
  #include "iostat.h"
@@@ -125,9 -125,10 +125,10 @@@ const struct inode_operations nfs4_dir_
        .permission     = nfs_permission,
        .getattr        = nfs_getattr,
        .setattr        = nfs_setattr,
-       .getxattr       = nfs4_getxattr,
-       .setxattr       = nfs4_setxattr,
-       .listxattr      = nfs4_listxattr,
+       .getxattr       = generic_getxattr,
+       .setxattr       = generic_setxattr,
+       .listxattr      = generic_listxattr,
+       .removexattr    = generic_removexattr,
  };
  
  #endif /* CONFIG_NFS_V4 */
@@@ -172,7 -173,7 +173,7 @@@ struct nfs_cache_array 
        struct nfs_cache_array_entry array[0];
  };
  
- typedef __be32 * (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, struct nfs_server *, int);
+ typedef int (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, int);
  typedef struct {
        struct file     *file;
        struct page     *page;
@@@ -378,14 -379,14 +379,14 @@@ error
        return error;
  }
  
- /* Fill in an entry based on the xdr code stored in desc->page */
- static
- int xdr_decode(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, struct xdr_stream *stream)
+ static int xdr_decode(nfs_readdir_descriptor_t *desc,
+                     struct nfs_entry *entry, struct xdr_stream *xdr)
  {
-       __be32 *p = desc->decode(stream, entry, NFS_SERVER(desc->file->f_path.dentry->d_inode), desc->plus);
-       if (IS_ERR(p))
-               return PTR_ERR(p);
+       int error;
  
+       error = desc->decode(xdr, entry, desc->plus);
+       if (error)
+               return error;
        entry->fattr->time_start = desc->timestamp;
        entry->fattr->gencount = desc->gencount;
        return 0;
@@@ -438,7 -439,7 +439,7 @@@ void nfs_prime_dcache(struct dentry *pa
        if (dentry == NULL)
                return;
  
 -      dentry->d_op = NFS_PROTO(dir)->dentry_ops;
 +      d_set_d_op(dentry, NFS_PROTO(dir)->dentry_ops);
        inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr);
        if (IS_ERR(inode))
                goto out;
@@@ -459,25 -460,26 +460,26 @@@ out
  /* Perform conversion from xdr to cache array */
  static
  int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry,
-                               void *xdr_page, struct page *page, unsigned int buflen)
+                               struct page **xdr_pages, struct page *page, unsigned int buflen)
  {
        struct xdr_stream stream;
-       struct xdr_buf buf;
-       __be32 *ptr = xdr_page;
+       struct xdr_buf buf = {
+               .pages = xdr_pages,
+               .page_len = buflen,
+               .buflen = buflen,
+               .len = buflen,
+       };
+       struct page *scratch;
        struct nfs_cache_array *array;
        unsigned int count = 0;
        int status;
  
-       buf.head->iov_base = xdr_page;
-       buf.head->iov_len = buflen;
-       buf.tail->iov_len = 0;
-       buf.page_base = 0;
-       buf.page_len = 0;
-       buf.buflen = buf.head->iov_len;
-       buf.len = buf.head->iov_len;
-       xdr_init_decode(&stream, &buf, ptr);
+       scratch = alloc_page(GFP_KERNEL);
+       if (scratch == NULL)
+               return -ENOMEM;
  
+       xdr_init_decode(&stream, &buf, NULL);
+       xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
  
        do {
                status = xdr_decode(desc, entry, &stream);
                } else
                        status = PTR_ERR(array);
        }
+       put_page(scratch);
        return status;
  }
  
@@@ -521,7 -525,6 +525,6 @@@ stati
  void nfs_readdir_free_large_page(void *ptr, struct page **pages,
                unsigned int npages)
  {
-       vm_unmap_ram(ptr, npages);
        nfs_readdir_free_pagearray(pages, npages);
  }
  
   * to nfs_readdir_free_large_page
   */
  static
void *nfs_readdir_large_page(struct page **pages, unsigned int npages)
int nfs_readdir_large_page(struct page **pages, unsigned int npages)
  {
-       void *ptr;
        unsigned int i;
  
        for (i = 0; i < npages; i++) {
                        goto out_freepages;
                pages[i] = page;
        }
+       return 0;
  
-       ptr = vm_map_ram(pages, npages, 0, PAGE_KERNEL);
-       if (!IS_ERR_OR_NULL(ptr))
-               return ptr;
  out_freepages:
        nfs_readdir_free_pagearray(pages, i);
-       return NULL;
+       return -ENOMEM;
  }
  
  static
@@@ -566,6 -566,7 +566,7 @@@ int nfs_readdir_xdr_to_array(nfs_readdi
        entry.eof = 0;
        entry.fh = nfs_alloc_fhandle();
        entry.fattr = nfs_alloc_fattr();
+       entry.server = NFS_SERVER(inode);
        if (entry.fh == NULL || entry.fattr == NULL)
                goto out;
  
        memset(array, 0, sizeof(struct nfs_cache_array));
        array->eof_index = -1;
  
-       pages_ptr = nfs_readdir_large_page(pages, array_size);
-       if (!pages_ptr)
+       status = nfs_readdir_large_page(pages, array_size);
+       if (status < 0)
                goto out_release_array;
        do {
                unsigned int pglen;
                if (status < 0)
                        break;
                pglen = status;
-               status = nfs_readdir_page_filler(desc, &entry, pages_ptr, page, pglen);
+               status = nfs_readdir_page_filler(desc, &entry, pages, page, pglen);
                if (status < 0) {
                        if (status == -ENOSPC)
                                status = 0;
@@@ -938,8 -939,7 +939,8 @@@ static int nfs_check_verifier(struct in
   * component of the path.
   * We check for this using LOOKUP_CONTINUE and LOOKUP_PARENT.
   */
 -static inline unsigned int nfs_lookup_check_intent(struct nameidata *nd, unsigned int mask)
 +static inline unsigned int nfs_lookup_check_intent(struct nameidata *nd,
 +                                              unsigned int mask)
  {
        if (nd->flags & (LOOKUP_CONTINUE|LOOKUP_PARENT))
                return 0;
@@@ -1019,7 -1019,7 +1020,7 @@@ int nfs_neg_need_reval(struct inode *di
   * If the parent directory is seen to have changed, we throw out the
   * cached dentry and do a new lookup.
   */
 -static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
 +static int nfs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)
  {
        struct inode *dir;
        struct inode *inode;
        struct nfs_fattr *fattr = NULL;
        int error;
  
 +      if (nd->flags & LOOKUP_RCU)
 +              return -ECHILD;
 +
        parent = dget_parent(dentry);
        dir = parent->d_inode;
        nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE);
@@@ -1121,7 -1118,7 +1122,7 @@@ out_error
  /*
   * This is called from dput() when d_count is going to 0.
   */
 -static int nfs_dentry_delete(struct dentry *dentry)
 +static int nfs_dentry_delete(const struct dentry *dentry)
  {
        dfprintk(VFS, "NFS: dentry_delete(%s/%s, %x)\n",
                dentry->d_parent->d_name.name, dentry->d_name.name,
@@@ -1192,7 -1189,7 +1193,7 @@@ static struct dentry *nfs_lookup(struc
        if (dentry->d_name.len > NFS_SERVER(dir)->namelen)
                goto out;
  
 -      dentry->d_op = NFS_PROTO(dir)->dentry_ops;
 +      d_set_d_op(dentry, NFS_PROTO(dir)->dentry_ops);
  
        /*
         * If we're doing an exclusive create, optimize away the lookup
                goto out_unblock_sillyrename;
        }
        inode = nfs_fhget(dentry->d_sb, fhandle, fattr);
-       res = (struct dentry *)inode;
+       res = ERR_CAST(inode);
        if (IS_ERR(res))
                goto out_unblock_sillyrename;
  
@@@ -1337,7 -1334,7 +1338,7 @@@ static struct dentry *nfs_atomic_lookup
                res = ERR_PTR(-ENAMETOOLONG);
                goto out;
        }
 -      dentry->d_op = NFS_PROTO(dir)->dentry_ops;
 +      d_set_d_op(dentry, NFS_PROTO(dir)->dentry_ops);
  
        /* Let vfs_create() deal with O_EXCL. Instantiate, but don't hash
         * the dentry. */
        if (nd->flags & LOOKUP_CREATE) {
                attr.ia_mode = nd->intent.open.create_mode;
                attr.ia_valid = ATTR_MODE;
-               if (!IS_POSIXACL(dir))
-                       attr.ia_mode &= ~current_umask();
+               attr.ia_mode &= ~current_umask();
        } else {
                open_flags &= ~(O_EXCL | O_CREAT);
                attr.ia_valid = 0;
@@@ -1722,9 -1718,11 +1722,9 @@@ static int nfs_unlink(struct inode *dir
        dfprintk(VFS, "NFS: unlink(%s/%ld, %s)\n", dir->i_sb->s_id,
                dir->i_ino, dentry->d_name.name);
  
 -      spin_lock(&dcache_lock);
        spin_lock(&dentry->d_lock);
 -      if (atomic_read(&dentry->d_count) > 1) {
 +      if (dentry->d_count > 1) {
                spin_unlock(&dentry->d_lock);
 -              spin_unlock(&dcache_lock);
                /* Start asynchronous writeout of the inode */
                write_inode_now(dentry->d_inode, 0);
                error = nfs_sillyrename(dir, dentry);
                need_rehash = 1;
        }
        spin_unlock(&dentry->d_lock);
 -      spin_unlock(&dcache_lock);
        error = nfs_safe_remove(dentry);
        if (!error || error == -ENOENT) {
                nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
@@@ -1869,7 -1868,7 +1869,7 @@@ static int nfs_rename(struct inode *old
        dfprintk(VFS, "NFS: rename(%s/%s -> %s/%s, ct=%d)\n",
                 old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
                 new_dentry->d_parent->d_name.name, new_dentry->d_name.name,
 -               atomic_read(&new_dentry->d_count));
 +               new_dentry->d_count);
  
        /*
         * For non-directories, check whether the target is busy and if so,
                        rehash = new_dentry;
                }
  
 -              if (atomic_read(&new_dentry->d_count) > 2) {
 +              if (new_dentry->d_count > 2) {
                        int err;
  
                        /* copy the target dentry's name */
@@@ -2189,14 -2188,11 +2189,14 @@@ int nfs_may_open(struct inode *inode, s
        return nfs_do_access(inode, cred, nfs_open_permission_mask(openflags));
  }
  
 -int nfs_permission(struct inode *inode, int mask)
 +int nfs_permission(struct inode *inode, int mask, unsigned int flags)
  {
        struct rpc_cred *cred;
        int res = 0;
  
 +      if (flags & IPERM_FLAG_RCU)
 +              return -ECHILD;
 +
        nfs_inc_stats(inode, NFSIOS_VFSACCESS);
  
        if ((mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0)
@@@ -2244,7 -2240,7 +2244,7 @@@ out
  out_notsup:
        res = nfs_revalidate_inode(NFS_SERVER(inode), inode);
        if (res == 0)
 -              res = generic_permission(inode, mask, NULL);
 +              res = generic_permission(inode, mask, flags, NULL);
        goto out;
  }
  
diff --combined fs/nfs/inode.c
index 017daa3bed38c01e472b3e942cfc6a159e77093e,790b786e1ae1ac5533d57f0e854ddd740197da03..ce00b704452c6bc0665422a066376694a82ae119
@@@ -1410,9 -1410,9 +1410,9 @@@ static int nfs_update_inode(struct inod
   */
  void nfs4_evict_inode(struct inode *inode)
  {
+       pnfs_destroy_layout(NFS_I(inode));
        truncate_inode_pages(&inode->i_data, 0);
        end_writeback(inode);
-       pnfs_destroy_layout(NFS_I(inode));
        /* If we are holding a delegation, return it! */
        nfs_inode_return_delegation_noreclaim(inode);
        /* First call standard NFS clear_inode() code */
@@@ -1438,18 -1438,11 +1438,18 @@@ struct inode *nfs_alloc_inode(struct su
        return &nfsi->vfs_inode;
  }
  
 -void nfs_destroy_inode(struct inode *inode)
 +static void nfs_i_callback(struct rcu_head *head)
  {
 +      struct inode *inode = container_of(head, struct inode, i_rcu);
 +      INIT_LIST_HEAD(&inode->i_dentry);
        kmem_cache_free(nfs_inode_cachep, NFS_I(inode));
  }
  
 +void nfs_destroy_inode(struct inode *inode)
 +{
 +      call_rcu(&inode->i_rcu, nfs_i_callback);
 +}
 +
  static inline void nfs4_init_once(struct nfs_inode *nfsi)
  {
  #ifdef CONFIG_NFS_V4
@@@ -1619,6 -1612,7 +1619,7 @@@ static void __exit exit_nfs_fs(void
  #ifdef CONFIG_PROC_FS
        rpc_proc_unregister("nfs");
  #endif
+       nfs_cleanup_cb_ident_idr();
        unregister_nfs_fs();
        nfs_fs_proc_exit();
        nfsiod_stop();
diff --combined fs/nfs/unlink.c
index 8fe9eb47a97f54780f824718a82b576968e65023,3bf1e53c4a3f2bded273cc664602fe410d6feb12..e313a51acdd18cd090427365fcf7dd209847be81
@@@ -429,7 -429,7 +429,7 @@@ nfs_async_rename(struct inode *old_dir
        data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (data == NULL)
                return ERR_PTR(-ENOMEM);
-       task_setup_data.callback_data = data,
+       task_setup_data.callback_data = data;
  
        data->cred = rpc_lookup_cred();
        if (IS_ERR(data->cred)) {
@@@ -496,7 -496,7 +496,7 @@@ nfs_sillyrename(struct inode *dir, stru
  
        dfprintk(VFS, "NFS: silly-rename(%s/%s, ct=%d)\n",
                dentry->d_parent->d_name.name, dentry->d_name.name,
 -              atomic_read(&dentry->d_count));
 +              dentry->d_count);
        nfs_inc_stats(dir, NFSIOS_SILLYRENAME);
  
        /*
diff --combined net/sunrpc/rpc_pipe.c
index 09f01f41e55abf79519ded2b2d9c996f51fa5bf2,5356d95343f30b8a6a0817e482fc39f9f3b85c6a..72bc5368396597f8555abf48f7eee3df3adbec44
@@@ -162,19 -162,11 +162,19 @@@ rpc_alloc_inode(struct super_block *sb
  }
  
  static void
 -rpc_destroy_inode(struct inode *inode)
 +rpc_i_callback(struct rcu_head *head)
  {
 +      struct inode *inode = container_of(head, struct inode, i_rcu);
 +      INIT_LIST_HEAD(&inode->i_dentry);
        kmem_cache_free(rpc_inode_cachep, RPC_I(inode));
  }
  
 +static void
 +rpc_destroy_inode(struct inode *inode)
 +{
 +      call_rcu(&inode->i_rcu, rpc_i_callback);
 +}
 +
  static int
  rpc_pipe_open(struct inode *inode, struct file *filp)
  {
@@@ -438,7 -430,7 +438,7 @@@ void rpc_put_mount(void
  }
  EXPORT_SYMBOL_GPL(rpc_put_mount);
  
 -static int rpc_delete_dentry(struct dentry *dentry)
 +static int rpc_delete_dentry(const struct dentry *dentry)
  {
        return 1;
  }
@@@ -474,7 -466,7 +474,7 @@@ static int __rpc_create_common(struct i
  {
        struct inode *inode;
  
-       BUG_ON(!d_unhashed(dentry));
+       d_drop(dentry);
        inode = rpc_get_inode(dir->i_sb, mode);
        if (!inode)
                goto out_err;
@@@ -591,7 -583,7 +591,7 @@@ static struct dentry *__rpc_lookup_crea
                }
        }
        if (!dentry->d_inode)
 -              dentry->d_op = &rpc_dentry_operations;
 +              d_set_d_op(dentry, &rpc_dentry_operations);
  out_err:
        return dentry;
  }
This page took 0.097453 seconds and 4 git commands to generate.