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.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index ac2899098147..fd9a872fada0 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -47,13 +47,13 @@ static int nfs_opendir(struct inode *, struct file *);
47static int nfs_closedir(struct inode *, struct file *); 47static int nfs_closedir(struct inode *, struct file *);
48static int nfs_readdir(struct file *, void *, filldir_t); 48static int nfs_readdir(struct file *, void *, filldir_t);
49static struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *); 49static struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *);
50static int nfs_create(struct inode *, struct dentry *, int, struct nameidata *); 50static int nfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
51static int nfs_mkdir(struct inode *, struct dentry *, int); 51static int nfs_mkdir(struct inode *, struct dentry *, umode_t);
52static int nfs_rmdir(struct inode *, struct dentry *); 52static int nfs_rmdir(struct inode *, struct dentry *);
53static int nfs_unlink(struct inode *, struct dentry *); 53static int nfs_unlink(struct inode *, struct dentry *);
54static int nfs_symlink(struct inode *, struct dentry *, const char *); 54static int nfs_symlink(struct inode *, struct dentry *, const char *);
55static int nfs_link(struct dentry *, struct inode *, struct dentry *); 55static int nfs_link(struct dentry *, struct inode *, struct dentry *);
56static int nfs_mknod(struct inode *, struct dentry *, int, dev_t); 56static int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
57static int nfs_rename(struct inode *, struct dentry *, 57static int nfs_rename(struct inode *, struct dentry *,
58 struct inode *, struct dentry *); 58 struct inode *, struct dentry *);
59static int nfs_fsync_dir(struct file *, loff_t, loff_t, int); 59static int nfs_fsync_dir(struct file *, loff_t, loff_t, int);
@@ -112,7 +112,7 @@ const struct inode_operations nfs3_dir_inode_operations = {
112#ifdef CONFIG_NFS_V4 112#ifdef CONFIG_NFS_V4
113 113
114static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *); 114static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *);
115static int nfs_open_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd); 115static int nfs_open_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd);
116const struct inode_operations nfs4_dir_inode_operations = { 116const struct inode_operations nfs4_dir_inode_operations = {
117 .create = nfs_open_create, 117 .create = nfs_open_create,
118 .lookup = nfs_atomic_lookup, 118 .lookup = nfs_atomic_lookup,
@@ -1368,18 +1368,7 @@ static fmode_t flags_to_mode(int flags)
1368 1368
1369static struct nfs_open_context *create_nfs_open_context(struct dentry *dentry, int open_flags) 1369static struct nfs_open_context *create_nfs_open_context(struct dentry *dentry, int open_flags)
1370{ 1370{
1371 struct nfs_open_context *ctx; 1371 return alloc_nfs_open_context(dentry, flags_to_mode(open_flags));
1372 struct rpc_cred *cred;
1373 fmode_t fmode = flags_to_mode(open_flags);
1374
1375 cred = rpc_lookup_cred();
1376 if (IS_ERR(cred))
1377 return ERR_CAST(cred);
1378 ctx = alloc_nfs_open_context(dentry, cred, fmode);
1379 put_rpccred(cred);
1380 if (ctx == NULL)
1381 return ERR_PTR(-ENOMEM);
1382 return ctx;
1383} 1372}
1384 1373
1385static int do_open(struct inode *inode, struct file *filp) 1374static int do_open(struct inode *inode, struct file *filp)
@@ -1584,8 +1573,8 @@ no_open:
1584 return nfs_lookup_revalidate(dentry, nd); 1573 return nfs_lookup_revalidate(dentry, nd);
1585} 1574}
1586 1575
1587static int nfs_open_create(struct inode *dir, struct dentry *dentry, int mode, 1576static int nfs_open_create(struct inode *dir, struct dentry *dentry,
1588 struct nameidata *nd) 1577 umode_t mode, struct nameidata *nd)
1589{ 1578{
1590 struct nfs_open_context *ctx = NULL; 1579 struct nfs_open_context *ctx = NULL;
1591 struct iattr attr; 1580 struct iattr attr;
@@ -1675,8 +1664,8 @@ out_error:
1675 * that the operation succeeded on the server, but an error in the 1664 * that the operation succeeded on the server, but an error in the
1676 * reply path made it appear to have failed. 1665 * reply path made it appear to have failed.
1677 */ 1666 */
1678static int nfs_create(struct inode *dir, struct dentry *dentry, int mode, 1667static int nfs_create(struct inode *dir, struct dentry *dentry,
1679 struct nameidata *nd) 1668 umode_t mode, struct nameidata *nd)
1680{ 1669{
1681 struct iattr attr; 1670 struct iattr attr;
1682 int error; 1671 int error;
@@ -1704,7 +1693,7 @@ out_err:
1704 * See comments for nfs_proc_create regarding failed operations. 1693 * See comments for nfs_proc_create regarding failed operations.
1705 */ 1694 */
1706static int 1695static int
1707nfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) 1696nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
1708{ 1697{
1709 struct iattr attr; 1698 struct iattr attr;
1710 int status; 1699 int status;
@@ -1730,7 +1719,7 @@ out_err:
1730/* 1719/*
1731 * See comments for nfs_proc_create regarding failed operations. 1720 * See comments for nfs_proc_create regarding failed operations.
1732 */ 1721 */
1733static int nfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 1722static int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1734{ 1723{
1735 struct iattr attr; 1724 struct iattr attr;
1736 int error; 1725 int error;