aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-08-22 20:06:09 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-22 23:24:32 -0400
commitb7162792b5c0e0f6e91b8997f8e6bbc76ec5420a (patch)
tree214c0aec3cee41cf872e0c4940fa778f6c0f94e9
parent7539bbab8062aadc1db95a22b377146843cfa88f (diff)
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: David Howells <dhowells@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/idmap.c12
-rw-r--r--fs/nfs/super.c3
-rw-r--r--include/linux/nfs_idmap.h2
3 files changed, 11 insertions, 6 deletions
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index d05148ec9414..231c20ffc0ff 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -108,15 +108,17 @@ static struct rpc_pipe_ops idmap_upcall_ops = {
108 .destroy_msg = idmap_pipe_destroy_msg, 108 .destroy_msg = idmap_pipe_destroy_msg,
109}; 109};
110 110
111void 111int
112nfs_idmap_new(struct nfs_client *clp) 112nfs_idmap_new(struct nfs_client *clp)
113{ 113{
114 struct idmap *idmap; 114 struct idmap *idmap;
115 int error;
115 116
116 if (clp->cl_idmap != NULL) 117 if (clp->cl_idmap != NULL)
117 return; 118 return 0;
119
118 if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL) 120 if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL)
119 return; 121 return -ENOMEM;
120 122
121 snprintf(idmap->idmap_path, sizeof(idmap->idmap_path), 123 snprintf(idmap->idmap_path, sizeof(idmap->idmap_path),
122 "%s/idmap", clp->cl_rpcclient->cl_pathname); 124 "%s/idmap", clp->cl_rpcclient->cl_pathname);
@@ -124,8 +126,9 @@ nfs_idmap_new(struct nfs_client *clp)
124 idmap->idmap_dentry = rpc_mkpipe(idmap->idmap_path, 126 idmap->idmap_dentry = rpc_mkpipe(idmap->idmap_path,
125 idmap, &idmap_upcall_ops, 0); 127 idmap, &idmap_upcall_ops, 0);
126 if (IS_ERR(idmap->idmap_dentry)) { 128 if (IS_ERR(idmap->idmap_dentry)) {
129 error = PTR_ERR(idmap->idmap_dentry);
127 kfree(idmap); 130 kfree(idmap);
128 return; 131 return error;
129 } 132 }
130 133
131 mutex_init(&idmap->idmap_lock); 134 mutex_init(&idmap->idmap_lock);
@@ -135,6 +138,7 @@ nfs_idmap_new(struct nfs_client *clp)
135 idmap->idmap_group_hash.h_type = IDMAP_TYPE_GROUP; 138 idmap->idmap_group_hash.h_type = IDMAP_TYPE_GROUP;
136 139
137 clp->cl_idmap = idmap; 140 clp->cl_idmap = idmap;
141 return 0;
138} 142}
139 143
140void 144void
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index ab4c78ee840c..3ee85c4e65d8 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1136,7 +1136,8 @@ static struct rpc_clnt *nfs4_create_client(struct nfs_server *server,
1136 clnt->cl_softrtry = 1; 1136 clnt->cl_softrtry = 1;
1137 clp->cl_rpcclient = clnt; 1137 clp->cl_rpcclient = clnt;
1138 memcpy(clp->cl_ipaddr, server->ip_addr, sizeof(clp->cl_ipaddr)); 1138 memcpy(clp->cl_ipaddr, server->ip_addr, sizeof(clp->cl_ipaddr));
1139 nfs_idmap_new(clp); 1139 if (nfs_idmap_new(clp) < 0)
1140 goto out_fail;
1140 } 1141 }
1141 list_add_tail(&server->nfs4_siblings, &clp->cl_superblocks); 1142 list_add_tail(&server->nfs4_siblings, &clp->cl_superblocks);
1142 clnt = rpc_clone_client(clp->cl_rpcclient); 1143 clnt = rpc_clone_client(clp->cl_rpcclient);
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index 678fe68982ef..15a9f3b7289a 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -64,7 +64,7 @@ struct idmap_msg {
64/* Forward declaration to make this header independent of others */ 64/* Forward declaration to make this header independent of others */
65struct nfs_client; 65struct nfs_client;
66 66
67void nfs_idmap_new(struct nfs_client *); 67int nfs_idmap_new(struct nfs_client *);
68void nfs_idmap_delete(struct nfs_client *); 68void nfs_idmap_delete(struct nfs_client *);
69 69
70int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *); 70int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *);