Commit b7162792 authored by David Howells's avatar David Howells Committed by Trond Myklebust

NFS: Return an error when starting the idmapping pipe

Return an error when starting the idmapping pipe so that we can detect it
failing.
Signed-Off-By: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 7539bbab
...@@ -108,15 +108,17 @@ static struct rpc_pipe_ops idmap_upcall_ops = { ...@@ -108,15 +108,17 @@ static struct rpc_pipe_ops idmap_upcall_ops = {
.destroy_msg = idmap_pipe_destroy_msg, .destroy_msg = idmap_pipe_destroy_msg,
}; };
void int
nfs_idmap_new(struct nfs_client *clp) nfs_idmap_new(struct nfs_client *clp)
{ {
struct idmap *idmap; struct idmap *idmap;
int error;
if (clp->cl_idmap != NULL) if (clp->cl_idmap != NULL)
return; return 0;
if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL) if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL)
return; return -ENOMEM;
snprintf(idmap->idmap_path, sizeof(idmap->idmap_path), snprintf(idmap->idmap_path, sizeof(idmap->idmap_path),
"%s/idmap", clp->cl_rpcclient->cl_pathname); "%s/idmap", clp->cl_rpcclient->cl_pathname);
...@@ -124,8 +126,9 @@ nfs_idmap_new(struct nfs_client *clp) ...@@ -124,8 +126,9 @@ nfs_idmap_new(struct nfs_client *clp)
idmap->idmap_dentry = rpc_mkpipe(idmap->idmap_path, idmap->idmap_dentry = rpc_mkpipe(idmap->idmap_path,
idmap, &idmap_upcall_ops, 0); idmap, &idmap_upcall_ops, 0);
if (IS_ERR(idmap->idmap_dentry)) { if (IS_ERR(idmap->idmap_dentry)) {
error = PTR_ERR(idmap->idmap_dentry);
kfree(idmap); kfree(idmap);
return; return error;
} }
mutex_init(&idmap->idmap_lock); mutex_init(&idmap->idmap_lock);
...@@ -135,6 +138,7 @@ nfs_idmap_new(struct nfs_client *clp) ...@@ -135,6 +138,7 @@ nfs_idmap_new(struct nfs_client *clp)
idmap->idmap_group_hash.h_type = IDMAP_TYPE_GROUP; idmap->idmap_group_hash.h_type = IDMAP_TYPE_GROUP;
clp->cl_idmap = idmap; clp->cl_idmap = idmap;
return 0;
} }
void void
......
...@@ -1136,7 +1136,8 @@ static struct rpc_clnt *nfs4_create_client(struct nfs_server *server, ...@@ -1136,7 +1136,8 @@ static struct rpc_clnt *nfs4_create_client(struct nfs_server *server,
clnt->cl_softrtry = 1; clnt->cl_softrtry = 1;
clp->cl_rpcclient = clnt; clp->cl_rpcclient = clnt;
memcpy(clp->cl_ipaddr, server->ip_addr, sizeof(clp->cl_ipaddr)); memcpy(clp->cl_ipaddr, server->ip_addr, sizeof(clp->cl_ipaddr));
nfs_idmap_new(clp); if (nfs_idmap_new(clp) < 0)
goto out_fail;
} }
list_add_tail(&server->nfs4_siblings, &clp->cl_superblocks); list_add_tail(&server->nfs4_siblings, &clp->cl_superblocks);
clnt = rpc_clone_client(clp->cl_rpcclient); clnt = rpc_clone_client(clp->cl_rpcclient);
......
...@@ -64,7 +64,7 @@ struct idmap_msg { ...@@ -64,7 +64,7 @@ struct idmap_msg {
/* Forward declaration to make this header independent of others */ /* Forward declaration to make this header independent of others */
struct nfs_client; struct nfs_client;
void nfs_idmap_new(struct nfs_client *); int nfs_idmap_new(struct nfs_client *);
void nfs_idmap_delete(struct nfs_client *); void nfs_idmap_delete(struct nfs_client *);
int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *); int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment