]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/nfs/client.c
NFS: Clean up address comparison in __nfs_find_client()
[mirror_ubuntu-bionic-kernel.git] / fs / nfs / client.c
index 70587f383f10708ba33b5f0d7b3492fc20359487..8b5f9b9685ddf1cb1e67f1c0fa16114dd2b2bfa6 100644 (file)
@@ -220,8 +220,7 @@ static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr, int
                if (clp->cl_nfsversion != nfsversion)
                        continue;
 
-               if (memcmp(&clp->cl_addr.sin_addr, &addr->sin_addr,
-                          sizeof(clp->cl_addr.sin_addr)) != 0)
+               if (clp->cl_addr.sin_addr.s_addr != addr->sin_addr.s_addr)
                        continue;
 
                if (!match_port || clp->cl_addr.sin_port == addr->sin_port)
@@ -410,9 +409,6 @@ static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
  */
 static void nfs_destroy_server(struct nfs_server *server)
 {
-       if (!IS_ERR(server->client_acl))
-               rpc_shutdown_client(server->client_acl);
-
        if (!(server->flags & NFS_MOUNT_NONLM))
                lockd_down();   /* release rpc.lockd */
 }
@@ -732,6 +728,9 @@ static struct nfs_server *nfs_alloc_server(void)
        INIT_LIST_HEAD(&server->client_link);
        INIT_LIST_HEAD(&server->master_link);
 
+       init_waitqueue_head(&server->active_wq);
+       atomic_set(&server->active, 0);
+
        server->io_stats = nfs_alloc_iostats();
        if (!server->io_stats) {
                kfree(server);
@@ -755,6 +754,9 @@ void nfs_free_server(struct nfs_server *server)
 
        if (server->destroy != NULL)
                server->destroy(server);
+
+       if (!IS_ERR(server->client_acl))
+               rpc_shutdown_client(server->client_acl);
        if (!IS_ERR(server->client))
                rpc_shutdown_client(server->client);