aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 0108cf4f3403..16ec096f6b24 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -34,6 +34,7 @@
34#include <linux/mount.h> 34#include <linux/mount.h>
35#include <linux/sched.h> 35#include <linux/sched.h>
36#include <linux/kmemleak.h> 36#include <linux/kmemleak.h>
37#include <linux/xattr.h>
37 38
38#include "delegation.h" 39#include "delegation.h"
39#include "iostat.h" 40#include "iostat.h"
@@ -124,9 +125,10 @@ const struct inode_operations nfs4_dir_inode_operations = {
124 .permission = nfs_permission, 125 .permission = nfs_permission,
125 .getattr = nfs_getattr, 126 .getattr = nfs_getattr,
126 .setattr = nfs_setattr, 127 .setattr = nfs_setattr,
127 .getxattr = nfs4_getxattr, 128 .getxattr = generic_getxattr,
128 .setxattr = nfs4_setxattr, 129 .setxattr = generic_setxattr,
129 .listxattr = nfs4_listxattr, 130 .listxattr = generic_listxattr,
131 .removexattr = generic_removexattr,
130}; 132};
131 133
132#endif /* CONFIG_NFS_V4 */ 134#endif /* CONFIG_NFS_V4 */
@@ -171,7 +173,7 @@ struct nfs_cache_array {
171 struct nfs_cache_array_entry array[0]; 173 struct nfs_cache_array_entry array[0];
172}; 174};
173 175
174typedef __be32 * (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, struct nfs_server *, int); 176typedef int (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, int);
175typedef struct { 177typedef struct {
176 struct file *file; 178 struct file *file;
177 struct page *page; 179 struct page *page;
@@ -377,14 +379,14 @@ error:
377 return error; 379 return error;
378} 380}
379 381
380/* Fill in an entry based on the xdr code stored in desc->page */ 382static int xdr_decode(nfs_readdir_descriptor_t *desc,
381static 383 struct nfs_entry *entry, struct xdr_stream *xdr)
382int xdr_decode(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, struct xdr_stream *stream)
383{ 384{
384 __be32 *p = desc->decode(stream, entry, NFS_SERVER(desc->file->f_path.dentry->d_inode), desc->plus); 385 int error;
385 if (IS_ERR(p))
386 return PTR_ERR(p);
387 386
387 error = desc->decode(xdr, entry, desc->plus);
388 if (error)
389 return error;
388 entry->fattr->time_start = desc->timestamp; 390 entry->fattr->time_start = desc->timestamp;
389 entry->fattr->gencount = desc->gencount; 391 entry->fattr->gencount = desc->gencount;
390 return 0; 392 return 0;
@@ -564,6 +566,7 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page,
564 entry.eof = 0; 566 entry.eof = 0;
565 entry.fh = nfs_alloc_fhandle(); 567 entry.fh = nfs_alloc_fhandle();
566 entry.fattr = nfs_alloc_fattr(); 568 entry.fattr = nfs_alloc_fattr();
569 entry.server = NFS_SERVER(inode);
567 if (entry.fh == NULL || entry.fattr == NULL) 570 if (entry.fh == NULL || entry.fattr == NULL)
568 goto out; 571 goto out;
569 572
@@ -1215,7 +1218,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
1215 goto out_unblock_sillyrename; 1218 goto out_unblock_sillyrename;
1216 } 1219 }
1217 inode = nfs_fhget(dentry->d_sb, fhandle, fattr); 1220 inode = nfs_fhget(dentry->d_sb, fhandle, fattr);
1218 res = (struct dentry *)inode; 1221 res = ERR_CAST(inode);
1219 if (IS_ERR(res)) 1222 if (IS_ERR(res))
1220 goto out_unblock_sillyrename; 1223 goto out_unblock_sillyrename;
1221 1224
@@ -1349,8 +1352,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
1349 if (nd->flags & LOOKUP_CREATE) { 1352 if (nd->flags & LOOKUP_CREATE) {
1350 attr.ia_mode = nd->intent.open.create_mode; 1353 attr.ia_mode = nd->intent.open.create_mode;
1351 attr.ia_valid = ATTR_MODE; 1354 attr.ia_valid = ATTR_MODE;
1352 if (!IS_POSIXACL(dir)) 1355 attr.ia_mode &= ~current_umask();
1353 attr.ia_mode &= ~current_umask();
1354 } else { 1356 } else {
1355 open_flags &= ~(O_EXCL | O_CREAT); 1357 open_flags &= ~(O_EXCL | O_CREAT);
1356 attr.ia_valid = 0; 1358 attr.ia_valid = 0;