aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/callback.c19
-rw-r--r--fs/nfs/nfs4proc.c6
-rw-r--r--fs/nfs/super.c4
-rw-r--r--include/linux/nfs_fs.h8
4 files changed, 27 insertions, 10 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 6a09760c5960..c2e9cfd9e5a4 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -40,6 +40,16 @@ unsigned short nfs_callback_tcpport;
40static const int nfs_set_port_min = 0; 40static const int nfs_set_port_min = 0;
41static const int nfs_set_port_max = 65535; 41static const int nfs_set_port_max = 65535;
42 42
43/*
44 * If the kernel has IPv6 support available, always listen for
45 * both AF_INET and AF_INET6 requests.
46 */
47#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
48static const sa_family_t nfs_callback_family = AF_INET6;
49#else
50static const sa_family_t nfs_callback_family = AF_INET;
51#endif
52
43static int param_set_port(const char *val, struct kernel_param *kp) 53static int param_set_port(const char *val, struct kernel_param *kp)
44{ 54{
45 char *endp; 55 char *endp;
@@ -106,7 +116,7 @@ int nfs_callback_up(void)
106 if (nfs_callback_info.users++ || nfs_callback_info.task != NULL) 116 if (nfs_callback_info.users++ || nfs_callback_info.task != NULL)
107 goto out; 117 goto out;
108 serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, 118 serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE,
109 AF_INET, NULL); 119 nfs_callback_family, NULL);
110 ret = -ENOMEM; 120 ret = -ENOMEM;
111 if (!serv) 121 if (!serv)
112 goto out_err; 122 goto out_err;
@@ -116,7 +126,8 @@ int nfs_callback_up(void)
116 if (ret <= 0) 126 if (ret <= 0)
117 goto out_err; 127 goto out_err;
118 nfs_callback_tcpport = ret; 128 nfs_callback_tcpport = ret;
119 dprintk("Callback port = 0x%x\n", nfs_callback_tcpport); 129 dprintk("NFS: Callback listener port = %u (af %u)\n",
130 nfs_callback_tcpport, nfs_callback_family);
120 131
121 nfs_callback_info.rqst = svc_prepare_thread(serv, &serv->sv_pools[0]); 132 nfs_callback_info.rqst = svc_prepare_thread(serv, &serv->sv_pools[0]);
122 if (IS_ERR(nfs_callback_info.rqst)) { 133 if (IS_ERR(nfs_callback_info.rqst)) {
@@ -149,8 +160,8 @@ out:
149 mutex_unlock(&nfs_callback_mutex); 160 mutex_unlock(&nfs_callback_mutex);
150 return ret; 161 return ret;
151out_err: 162out_err:
152 dprintk("Couldn't create callback socket or server thread; err = %d\n", 163 dprintk("NFS: Couldn't create callback socket or server thread; "
153 ret); 164 "err = %d\n", ret);
154 nfs_callback_info.users--; 165 nfs_callback_info.users--;
155 goto out; 166 goto out;
156} 167}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c910413eaeca..83e700a2b0c0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1659,8 +1659,10 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
1659 struct nfs_open_context *ctx; 1659 struct nfs_open_context *ctx;
1660 1660
1661 ctx = nfs_file_open_context(sattr->ia_file); 1661 ctx = nfs_file_open_context(sattr->ia_file);
1662 cred = ctx->cred; 1662 if (ctx) {
1663 state = ctx->state; 1663 cred = ctx->cred;
1664 state = ctx->state;
1665 }
1664 } 1666 }
1665 1667
1666 status = nfs4_do_setattr(inode, cred, fattr, sattr, state); 1668 status = nfs4_do_setattr(inode, cred, fattr, sattr, state);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 8b28b95c9e44..a3b0061dfd45 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2459,7 +2459,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
2459 compare_super = NULL; 2459 compare_super = NULL;
2460 2460
2461 /* Get a superblock - note that we may end up sharing one that already exists */ 2461 /* Get a superblock - note that we may end up sharing one that already exists */
2462 s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); 2462 s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata);
2463 if (IS_ERR(s)) { 2463 if (IS_ERR(s)) {
2464 error = PTR_ERR(s); 2464 error = PTR_ERR(s);
2465 goto out_err_nosb; 2465 goto out_err_nosb;
@@ -2544,7 +2544,7 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
2544 compare_super = NULL; 2544 compare_super = NULL;
2545 2545
2546 /* Get a superblock - note that we may end up sharing one that already exists */ 2546 /* Get a superblock - note that we may end up sharing one that already exists */
2547 s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); 2547 s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata);
2548 if (IS_ERR(s)) { 2548 if (IS_ERR(s)) {
2549 error = PTR_ERR(s); 2549 error = PTR_ERR(s);
2550 goto out_err_nosb; 2550 goto out_err_nosb;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index ac8d0233b05c..4eaa8347a0d9 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -367,8 +367,12 @@ static inline struct nfs_open_context *nfs_file_open_context(struct file *filp)
367 367
368static inline struct rpc_cred *nfs_file_cred(struct file *file) 368static inline struct rpc_cred *nfs_file_cred(struct file *file)
369{ 369{
370 if (file != NULL) 370 if (file != NULL) {
371 return nfs_file_open_context(file)->cred; 371 struct nfs_open_context *ctx =
372 nfs_file_open_context(file);
373 if (ctx)
374 return ctx->cred;
375 }
372 return NULL; 376 return NULL;
373} 377}
374 378