]> git.karo-electronics.de Git - linux-beck.git/commitdiff
NFS: Return an error when starting the idmapping pipe
authorDavid Howells <dhowells@redhat.com>
Wed, 23 Aug 2006 00:06:09 +0000 (20:06 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 23 Sep 2006 03:24:32 +0000 (23:24 -0400)
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>
fs/nfs/idmap.c
fs/nfs/super.c
include/linux/nfs_idmap.h

index d05148ec9414ccf3457ac305cdeb61652c87a91f..231c20ffc0ff7ad74eb45657a33be1fc91e27547 100644 (file)
@@ -108,15 +108,17 @@ static struct rpc_pipe_ops idmap_upcall_ops = {
         .destroy_msg    = idmap_pipe_destroy_msg,
 };
 
-void
+int
 nfs_idmap_new(struct nfs_client *clp)
 {
        struct idmap *idmap;
+       int error;
 
        if (clp->cl_idmap != NULL)
-               return;
+               return 0;
+
         if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL)
-                return;
+                return -ENOMEM;
 
        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 = rpc_mkpipe(idmap->idmap_path,
            idmap, &idmap_upcall_ops, 0);
         if (IS_ERR(idmap->idmap_dentry)) {
+               error = PTR_ERR(idmap->idmap_dentry);
                kfree(idmap);
-               return;
+               return error;
        }
 
         mutex_init(&idmap->idmap_lock);
@@ -135,6 +138,7 @@ nfs_idmap_new(struct nfs_client *clp)
        idmap->idmap_group_hash.h_type = IDMAP_TYPE_GROUP;
 
        clp->cl_idmap = idmap;
+       return 0;
 }
 
 void
index ab4c78ee840c17ad91070d9d0ba6d65573c2edfe..3ee85c4e65d86b49a80ee41bd680289cf319effe 100644 (file)
@@ -1136,7 +1136,8 @@ static struct rpc_clnt *nfs4_create_client(struct nfs_server *server,
                clnt->cl_softrtry = 1;
                clp->cl_rpcclient = 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 = rpc_clone_client(clp->cl_rpcclient);
index 678fe68982efe455794fdab298bb954a7dfeddb3..15a9f3b7289ab4722d042dc6712860b793f627c2 100644 (file)
@@ -64,7 +64,7 @@ struct idmap_msg {
 /* Forward declaration to make this header independent of others */
 struct nfs_client;
 
-void nfs_idmap_new(struct nfs_client *);
+int nfs_idmap_new(struct nfs_client *);
 void nfs_idmap_delete(struct nfs_client *);
 
 int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *);