aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-06-17 21:02:10 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-06-17 21:02:10 -0400
commita21bdd9b960ccce421b63aa0e3efda4fcdc26f10 (patch)
tree5ce808e08fb64140389aa96e2940f1c53468dd12 /fs/nfs
parentc381ad2cf2d5dcd3991bcc8a18fddd9d5c66ccaa (diff)
NFS: Return error code from nfs_callback_up() to user space
If the kernel cannot start the NFSv4 callback service during a mount request, it returns -ENOMEM to user space, resulting in this message: mount.nfs4: Cannot allocate memory Adjust nfs_alloc_client() and nfs_get_client() to pass NFSv4 callback start-up errors back to user space so a less mysterious error message can be displayed by the mount command. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/client.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 75c9cd2aa119..0e9a1f9743b0 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -114,6 +114,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
114{ 114{
115 struct nfs_client *clp; 115 struct nfs_client *clp;
116 struct rpc_cred *cred; 116 struct rpc_cred *cred;
117 int err = -ENOMEM;
117 118
118 if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL) 119 if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
119 goto error_0; 120 goto error_0;
@@ -121,7 +122,8 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
121 clp->rpc_ops = cl_init->rpc_ops; 122 clp->rpc_ops = cl_init->rpc_ops;
122 123
123 if (cl_init->rpc_ops->version == 4) { 124 if (cl_init->rpc_ops->version == 4) {
124 if (nfs_callback_up() < 0) 125 err = nfs_callback_up();
126 if (err < 0)
125 goto error_2; 127 goto error_2;
126 __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state); 128 __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
127 } 129 }
@@ -133,6 +135,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
133 clp->cl_addrlen = cl_init->addrlen; 135 clp->cl_addrlen = cl_init->addrlen;
134 136
135 if (cl_init->hostname) { 137 if (cl_init->hostname) {
138 err = -ENOMEM;
136 clp->cl_hostname = kstrdup(cl_init->hostname, GFP_KERNEL); 139 clp->cl_hostname = kstrdup(cl_init->hostname, GFP_KERNEL);
137 if (!clp->cl_hostname) 140 if (!clp->cl_hostname)
138 goto error_3; 141 goto error_3;
@@ -165,7 +168,7 @@ error_3:
165error_2: 168error_2:
166 kfree(clp); 169 kfree(clp);
167error_0: 170error_0:
168 return NULL; 171 return ERR_PTR(err);
169} 172}
170 173
171static void nfs4_shutdown_client(struct nfs_client *clp) 174static void nfs4_shutdown_client(struct nfs_client *clp)
@@ -456,9 +459,10 @@ static struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_in
456 spin_unlock(&nfs_client_lock); 459 spin_unlock(&nfs_client_lock);
457 460
458 new = nfs_alloc_client(cl_init); 461 new = nfs_alloc_client(cl_init);
459 } while (new); 462 } while (!IS_ERR(new));
460 463
461 return ERR_PTR(-ENOMEM); 464 dprintk("--> nfs_get_client() = %ld [failed]\n", PTR_ERR(new));
465 return new;
462 466
463 /* install a new client and return with it unready */ 467 /* install a new client and return with it unready */
464install_client: 468install_client: