aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/inode.c10
-rw-r--r--include/linux/nfs_fs.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index a77ee95b7efb..8d5b6691ae3d 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -973,7 +973,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
973 return err; 973 return err;
974} 974}
975 975
976struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred) 976static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, struct dentry *dentry, struct rpc_cred *cred)
977{ 977{
978 struct nfs_open_context *ctx; 978 struct nfs_open_context *ctx;
979 979
@@ -981,6 +981,7 @@ struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rp
981 if (ctx != NULL) { 981 if (ctx != NULL) {
982 atomic_set(&ctx->count, 1); 982 atomic_set(&ctx->count, 1);
983 ctx->dentry = dget(dentry); 983 ctx->dentry = dget(dentry);
984 ctx->vfsmnt = mntget(mnt);
984 ctx->cred = get_rpccred(cred); 985 ctx->cred = get_rpccred(cred);
985 ctx->state = NULL; 986 ctx->state = NULL;
986 ctx->lockowner = current->files; 987 ctx->lockowner = current->files;
@@ -1011,6 +1012,7 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
1011 if (ctx->cred != NULL) 1012 if (ctx->cred != NULL)
1012 put_rpccred(ctx->cred); 1013 put_rpccred(ctx->cred);
1013 dput(ctx->dentry); 1014 dput(ctx->dentry);
1015 mntput(ctx->vfsmnt);
1014 kfree(ctx); 1016 kfree(ctx);
1015 } 1017 }
1016} 1018}
@@ -1019,7 +1021,7 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
1019 * Ensure that mmap has a recent RPC credential for use when writing out 1021 * Ensure that mmap has a recent RPC credential for use when writing out
1020 * shared pages 1022 * shared pages
1021 */ 1023 */
1022void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx) 1024static void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
1023{ 1025{
1024 struct inode *inode = filp->f_dentry->d_inode; 1026 struct inode *inode = filp->f_dentry->d_inode;
1025 struct nfs_inode *nfsi = NFS_I(inode); 1027 struct nfs_inode *nfsi = NFS_I(inode);
@@ -1051,7 +1053,7 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c
1051 return ctx; 1053 return ctx;
1052} 1054}
1053 1055
1054void nfs_file_clear_open_context(struct file *filp) 1056static void nfs_file_clear_open_context(struct file *filp)
1055{ 1057{
1056 struct inode *inode = filp->f_dentry->d_inode; 1058 struct inode *inode = filp->f_dentry->d_inode;
1057 struct nfs_open_context *ctx = (struct nfs_open_context *)filp->private_data; 1059 struct nfs_open_context *ctx = (struct nfs_open_context *)filp->private_data;
@@ -1076,7 +1078,7 @@ int nfs_open(struct inode *inode, struct file *filp)
1076 cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0); 1078 cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0);
1077 if (IS_ERR(cred)) 1079 if (IS_ERR(cred))
1078 return PTR_ERR(cred); 1080 return PTR_ERR(cred);
1079 ctx = alloc_nfs_open_context(filp->f_dentry, cred); 1081 ctx = alloc_nfs_open_context(filp->f_vfsmnt, filp->f_dentry, cred);
1080 put_rpccred(cred); 1082 put_rpccred(cred);
1081 if (ctx == NULL) 1083 if (ctx == NULL)
1082 return -ENOMEM; 1084 return -ENOMEM;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index b4dc6e2e10c9..1161725d75e1 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -78,6 +78,7 @@ struct nfs_access_entry {
78struct nfs4_state; 78struct nfs4_state;
79struct nfs_open_context { 79struct nfs_open_context {
80 atomic_t count; 80 atomic_t count;
81 struct vfsmount *vfsmnt;
81 struct dentry *dentry; 82 struct dentry *dentry;
82 struct rpc_cred *cred; 83 struct rpc_cred *cred;
83 struct nfs4_state *state; 84 struct nfs4_state *state;
@@ -311,12 +312,9 @@ extern void nfs_begin_attr_update(struct inode *);
311extern void nfs_end_attr_update(struct inode *); 312extern void nfs_end_attr_update(struct inode *);
312extern void nfs_begin_data_update(struct inode *); 313extern void nfs_begin_data_update(struct inode *);
313extern void nfs_end_data_update(struct inode *); 314extern void nfs_end_data_update(struct inode *);
314extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred);
315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
316extern void put_nfs_open_context(struct nfs_open_context *ctx); 316extern void put_nfs_open_context(struct nfs_open_context *ctx);
317extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
318extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 317extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
319extern void nfs_file_clear_open_context(struct file *filp);
320 318
321/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 319/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
322extern u32 root_nfs_parse_addr(char *name); /*__init*/ 320extern u32 root_nfs_parse_addr(char *name); /*__init*/