diff options
author | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2017-04-07 14:15:05 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-04-20 13:39:33 -0400 |
commit | 2844b6aecf9ec797fde6787a59bca258d06377c3 (patch) | |
tree | a6fceddb7f12028c4a3f95c99c08e9b3b5009276 /fs/nfs/client.c | |
parent | 36718a669e0507d2590af2a3730d58402d1f03f7 (diff) |
NFS: Clean up nfs_init_client()
We always call nfs_mark_client_ready() even if nfs_create_rpc_client()
returns an error, so we can rearrange nfs_init_client() to mark the
client ready from a single place.
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r-- | fs/nfs/client.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 390ada8741bc..675142189181 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -624,27 +624,21 @@ struct nfs_client *nfs_init_client(struct nfs_client *clp, | |||
624 | { | 624 | { |
625 | int error; | 625 | int error; |
626 | 626 | ||
627 | if (clp->cl_cons_state == NFS_CS_READY) { | 627 | /* the client is already initialised */ |
628 | /* the client is already initialised */ | 628 | if (clp->cl_cons_state == NFS_CS_READY) |
629 | dprintk("<-- nfs_init_client() = 0 [already %p]\n", clp); | ||
630 | return clp; | 629 | return clp; |
631 | } | ||
632 | 630 | ||
633 | /* | 631 | /* |
634 | * Create a client RPC handle for doing FSSTAT with UNIX auth only | 632 | * Create a client RPC handle for doing FSSTAT with UNIX auth only |
635 | * - RFC 2623, sec 2.3.2 | 633 | * - RFC 2623, sec 2.3.2 |
636 | */ | 634 | */ |
637 | error = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX); | 635 | error = nfs_create_rpc_client(clp, cl_init, RPC_AUTH_UNIX); |
638 | if (error < 0) | 636 | nfs_mark_client_ready(clp, error == 0 ? NFS_CS_READY : error); |
639 | goto error; | 637 | if (error < 0) { |
640 | nfs_mark_client_ready(clp, NFS_CS_READY); | 638 | nfs_put_client(clp); |
639 | clp = ERR_PTR(error); | ||
640 | } | ||
641 | return clp; | 641 | return clp; |
642 | |||
643 | error: | ||
644 | nfs_mark_client_ready(clp, error); | ||
645 | nfs_put_client(clp); | ||
646 | dprintk("<-- nfs_init_client() = xerror %d\n", error); | ||
647 | return ERR_PTR(error); | ||
648 | } | 642 | } |
649 | EXPORT_SYMBOL_GPL(nfs_init_client); | 643 | EXPORT_SYMBOL_GPL(nfs_init_client); |
650 | 644 | ||