From: David Howells Subject: [PATCH 07/30] NFS: Return an error when starting the idmapping pipe [try #11] Date: Thu, 27 Jul 2006 21:52:42 +0100 Message-ID: <20060727205242.8443.12357.stgit@warthog.cambridge.redhat.com> References: <20060727205222.8443.29381.stgit@warthog.cambridge.redhat.com> Reply-To: Linux filesystem caching discussion list Content-Type: text/plain; charset=utf-8; format=fixed Content-Transfer-Encoding: quoted-printable Cc: linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com, nfsv4@linux-nfs.org, linux-kernel@vger.kernel.org Return-path: To: torvalds@osdl.org, akpm@osdl.org, steved@redhat.com, trond.myklebust@fys.uio.no In-Reply-To: <20060727205222.8443.29381.stgit@warthog.cambridge.redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cachefs-bounces@redhat.com Errors-To: linux-cachefs-bounces@redhat.com List-Id: linux-fsdevel.vger.kernel.org Return an error when starting the idmapping pipe so that we can detect it failing. Signed-Off-By: David Howells Signed-off-by: Trond Myklebust --- fs/nfs/idmap.c | 12 ++++++++---- fs/nfs/super.c | 3 ++- include/linux/nfs_idmap.h | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index b151053..cd80d89 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c @@ -108,15 +108,17 @@ static struct rpc_pipe_ops idmap_upcall_ .destroy_msg =3D idmap_pipe_destroy_msg, }; =20 -void +int nfs_idmap_new(struct nfs_client *clp) { struct idmap *idmap; + int error; =20 if (clp->cl_idmap !=3D NULL) - return; + return 0; + if ((idmap =3D kzalloc(sizeof(*idmap), GFP_KERNEL)) =3D=3D NULL) - return; + return -ENOMEM; =20 snprintf(idmap->idmap_path, sizeof(idmap->idmap_path), "%s/idmap", clp->cl_rpcclient->cl_pathname); @@ -124,8 +126,9 @@ nfs_idmap_new(struct nfs_client *clp) idmap->idmap_dentry =3D rpc_mkpipe(idmap->idmap_path, idmap, &idmap_upcall_ops, 0); if (IS_ERR(idmap->idmap_dentry)) { + error =3D PTR_ERR(idmap->idmap_dentry); kfree(idmap); - return; + return error; } =20 mutex_init(&idmap->idmap_lock); @@ -135,6 +138,7 @@ nfs_idmap_new(struct nfs_client *clp) idmap->idmap_group_hash.h_type =3D IDMAP_TYPE_GROUP; =20 clp->cl_idmap =3D idmap; + return 0; } =20 void diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 509fa99..0fbb75e 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1131,7 +1131,8 @@ static struct rpc_clnt *nfs4_create_clie clnt->cl_softrtry =3D 1; clp->cl_rpcclient =3D clnt; 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); clnt =3D rpc_clone_client(clp->cl_rpcclient); diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h index 678fe68..15a9f3b 100644 --- a/include/linux/nfs_idmap.h +++ b/include/linux/nfs_idmap.h @@ -64,7 +64,7 @@ #ifdef __KERNEL__ /* Forward declaration to make this header independent of others */ struct nfs_client; =20 -void nfs_idmap_new(struct nfs_client *); +int nfs_idmap_new(struct nfs_client *); void nfs_idmap_delete(struct nfs_client *); =20 int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32= *);