Lines Matching full:server

218 static void pnfs_init_server(struct nfs_server *server)  in pnfs_init_server()  argument
220 rpc_init_wait_queue(&server->roc_rpcwaitq, "pNFS ROC"); in pnfs_init_server()
232 static void pnfs_init_server(struct nfs_server *server) in pnfs_init_server() argument
452 * Mark a server as ready or failed
566 static void nfs_destroy_server(struct nfs_server *server) in nfs_destroy_server() argument
568 if (server->nlm_host) in nfs_destroy_server()
569 nlmclnt_done(server->nlm_host); in nfs_destroy_server()
575 static int nfs_start_lockd(struct nfs_server *server) in nfs_start_lockd() argument
578 struct nfs_client *clp = server->nfs_client; in nfs_start_lockd()
584 .noresvport = server->flags & NFS_MOUNT_NORESVPORT ? in nfs_start_lockd()
588 .cred = server->cred, in nfs_start_lockd()
593 if ((server->flags & NFS_MOUNT_LOCAL_FLOCK) && in nfs_start_lockd()
594 (server->flags & NFS_MOUNT_LOCAL_FCNTL)) in nfs_start_lockd()
611 server->nlm_host = host; in nfs_start_lockd()
612 server->destroy = nfs_destroy_server; in nfs_start_lockd()
613 nfs_sysfs_link_rpc_client(server, nlmclnt_rpc_clnt(host), NULL); in nfs_start_lockd()
620 int nfs_init_server_rpcclient(struct nfs_server *server, in nfs_init_server_rpcclient() argument
624 struct nfs_client *clp = server->nfs_client; in nfs_init_server_rpcclient()
626 server->client = rpc_clone_client_set_auth(clp->cl_rpcclient, in nfs_init_server_rpcclient()
628 if (IS_ERR(server->client)) { in nfs_init_server_rpcclient()
630 return PTR_ERR(server->client); in nfs_init_server_rpcclient()
633 memcpy(&server->client->cl_timeout_default, in nfs_init_server_rpcclient()
635 sizeof(server->client->cl_timeout_default)); in nfs_init_server_rpcclient()
636 server->client->cl_timeout = &server->client->cl_timeout_default; in nfs_init_server_rpcclient()
637 server->client->cl_softrtry = 0; in nfs_init_server_rpcclient()
638 if (server->flags & NFS_MOUNT_SOFTERR) in nfs_init_server_rpcclient()
639 server->client->cl_softerr = 1; in nfs_init_server_rpcclient()
640 if (server->flags & NFS_MOUNT_SOFT) in nfs_init_server_rpcclient()
641 server->client->cl_softrtry = 1; in nfs_init_server_rpcclient()
643 nfs_sysfs_link_rpc_client(server, server->client, NULL); in nfs_init_server_rpcclient()
682 static int nfs_init_server(struct nfs_server *server, in nfs_init_server() argument
695 .cred = server->cred, in nfs_init_server()
713 server->nfs_client = clp; in nfs_init_server()
714 nfs_sysfs_add_server(server); in nfs_init_server()
715 nfs_sysfs_link_rpc_client(server, clp->cl_rpcclient, "_state"); in nfs_init_server()
718 server->flags = ctx->flags; in nfs_init_server()
719 server->options = ctx->options; in nfs_init_server()
720 server->caps |= NFS_CAP_HARDLINKS | NFS_CAP_SYMLINKS; in nfs_init_server()
724 server->fattr_valid = NFS_ATTR_FATTR_V2; in nfs_init_server()
727 server->fattr_valid = NFS_ATTR_FATTR_V3; in nfs_init_server()
730 server->fattr_valid = NFS_ATTR_FATTR_V4; in nfs_init_server()
734 server->rsize = nfs_io_size(ctx->rsize, clp->cl_proto); in nfs_init_server()
736 server->wsize = nfs_io_size(ctx->wsize, clp->cl_proto); in nfs_init_server()
738 server->acregmin = ctx->acregmin * HZ; in nfs_init_server()
739 server->acregmax = ctx->acregmax * HZ; in nfs_init_server()
740 server->acdirmin = ctx->acdirmin * HZ; in nfs_init_server()
741 server->acdirmax = ctx->acdirmax * HZ; in nfs_init_server()
744 error = nfs_start_lockd(server); in nfs_init_server()
748 server->port = ctx->nfs_server.port; in nfs_init_server()
749 server->auth_info = ctx->auth_info; in nfs_init_server()
751 error = nfs_init_server_rpcclient(server, &timeparms, in nfs_init_server()
758 memcpy(&server->mountd_address, &ctx->mount_server.address, in nfs_init_server()
760 server->mountd_addrlen = ctx->mount_server.addrlen; in nfs_init_server()
762 server->mountd_version = ctx->mount_server.version; in nfs_init_server()
763 server->mountd_port = ctx->mount_server.port; in nfs_init_server()
764 server->mountd_protocol = ctx->mount_server.protocol; in nfs_init_server()
766 server->namelen = ctx->namlen; in nfs_init_server()
770 server->nfs_client = NULL; in nfs_init_server()
776 * Load up the server record from information gained in an fsinfo record
778 static void nfs_server_set_fsinfo(struct nfs_server *server, in nfs_server_set_fsinfo() argument
781 struct nfs_client *clp = server->nfs_client; in nfs_server_set_fsinfo()
785 if (server->rsize == 0) in nfs_server_set_fsinfo()
786 server->rsize = nfs_io_size(fsinfo->rtpref, clp->cl_proto); in nfs_server_set_fsinfo()
787 if (server->wsize == 0) in nfs_server_set_fsinfo()
788 server->wsize = nfs_io_size(fsinfo->wtpref, clp->cl_proto); in nfs_server_set_fsinfo()
790 if (fsinfo->rtmax >= 512 && server->rsize > fsinfo->rtmax) in nfs_server_set_fsinfo()
791 server->rsize = nfs_io_size(fsinfo->rtmax, clp->cl_proto); in nfs_server_set_fsinfo()
792 if (fsinfo->wtmax >= 512 && server->wsize > fsinfo->wtmax) in nfs_server_set_fsinfo()
793 server->wsize = nfs_io_size(fsinfo->wtmax, clp->cl_proto); in nfs_server_set_fsinfo()
795 raw_max_rpc_payload = rpc_max_payload(server->client); in nfs_server_set_fsinfo()
798 if (server->rsize > max_rpc_payload) in nfs_server_set_fsinfo()
799 server->rsize = max_rpc_payload; in nfs_server_set_fsinfo()
800 if (server->rsize > NFS_MAX_FILE_IO_SIZE) in nfs_server_set_fsinfo()
801 server->rsize = NFS_MAX_FILE_IO_SIZE; in nfs_server_set_fsinfo()
802 server->rpages = (server->rsize + PAGE_SIZE - 1) >> PAGE_SHIFT; in nfs_server_set_fsinfo()
804 if (server->wsize > max_rpc_payload) in nfs_server_set_fsinfo()
805 server->wsize = max_rpc_payload; in nfs_server_set_fsinfo()
806 if (server->wsize > NFS_MAX_FILE_IO_SIZE) in nfs_server_set_fsinfo()
807 server->wsize = NFS_MAX_FILE_IO_SIZE; in nfs_server_set_fsinfo()
808 server->wpages = (server->wsize + PAGE_SIZE - 1) >> PAGE_SHIFT; in nfs_server_set_fsinfo()
810 server->wtmult = nfs_block_bits(fsinfo->wtmult, NULL); in nfs_server_set_fsinfo()
812 server->dtsize = nfs_block_size(fsinfo->dtpref, NULL); in nfs_server_set_fsinfo()
813 if (server->dtsize > NFS_MAX_FILE_IO_SIZE) in nfs_server_set_fsinfo()
814 server->dtsize = NFS_MAX_FILE_IO_SIZE; in nfs_server_set_fsinfo()
815 if (server->dtsize > server->rsize) in nfs_server_set_fsinfo()
816 server->dtsize = server->rsize; in nfs_server_set_fsinfo()
818 if (server->flags & NFS_MOUNT_NOAC) { in nfs_server_set_fsinfo()
819 server->acregmin = server->acregmax = 0; in nfs_server_set_fsinfo()
820 server->acdirmin = server->acdirmax = 0; in nfs_server_set_fsinfo()
823 server->maxfilesize = fsinfo->maxfilesize; in nfs_server_set_fsinfo()
825 server->time_delta = fsinfo->time_delta; in nfs_server_set_fsinfo()
826 server->change_attr_type = fsinfo->change_attr_type; in nfs_server_set_fsinfo()
828 server->clone_blksize = fsinfo->clone_blksize; in nfs_server_set_fsinfo()
830 rpc_setbufsize(server->client, server->wsize + 100, server->rsize + 100); in nfs_server_set_fsinfo()
836 server->gxasize = min_t(unsigned int, raw_max_rpc_payload, in nfs_server_set_fsinfo()
838 server->sxasize = min_t(unsigned int, raw_max_rpc_payload, in nfs_server_set_fsinfo()
840 server->lxasize = min_t(unsigned int, raw_max_rpc_payload, in nfs_server_set_fsinfo()
844 server->caps |= NFS_CAP_XATTR; in nfs_server_set_fsinfo()
851 static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs_fattr *fatt… in nfs_probe_fsinfo() argument
854 struct nfs_client *clp = server->nfs_client; in nfs_probe_fsinfo()
858 error = clp->rpc_ops->set_capabilities(server, mntfh); in nfs_probe_fsinfo()
866 error = clp->rpc_ops->fsinfo(server, mntfh, &fsinfo); in nfs_probe_fsinfo()
870 nfs_server_set_fsinfo(server, &fsinfo); in nfs_probe_fsinfo()
873 if (server->namelen == 0) { in nfs_probe_fsinfo()
879 if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0) in nfs_probe_fsinfo()
880 server->namelen = pathinfo.max_namelen; in nfs_probe_fsinfo()
884 (server->caps & NFS_CAP_FS_LOCATIONS && in nfs_probe_fsinfo()
885 (server->flags & NFS_MOUNT_TRUNK_DISCOVERY))) { in nfs_probe_fsinfo()
886 error = clp->rpc_ops->discover_trunking(server, mntfh); in nfs_probe_fsinfo()
900 int nfs_probe_server(struct nfs_server *server, struct nfs_fh *mntfh) in nfs_probe_server() argument
909 /* Sanity: the probe won't work if the destination server in nfs_probe_server()
911 error = nfs_probe_fsinfo(server, mntfh, fattr); in nfs_probe_server()
919 * Copy useful information when duplicating a server record
937 void nfs_server_insert_lists(struct nfs_server *server) in nfs_server_insert_lists() argument
939 struct nfs_client *clp = server->nfs_client; in nfs_server_insert_lists()
943 list_add_tail_rcu(&server->client_link, &clp->cl_superblocks); in nfs_server_insert_lists()
944 list_add_tail(&server->master_link, &nn->nfs_volume_list); in nfs_server_insert_lists()
951 void nfs_server_remove_lists(struct nfs_server *server) in nfs_server_remove_lists() argument
953 struct nfs_client *clp = server->nfs_client; in nfs_server_remove_lists()
960 list_del_rcu(&server->client_link); in nfs_server_remove_lists()
963 list_del(&server->master_link); in nfs_server_remove_lists()
973 * Allocate and initialise a server record
977 struct nfs_server *server; in nfs_alloc_server() local
979 server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL); in nfs_alloc_server()
980 if (!server) in nfs_alloc_server()
983 server->s_sysfs_id = ida_alloc(&s_sysfs_ids, GFP_KERNEL); in nfs_alloc_server()
984 if (server->s_sysfs_id < 0) { in nfs_alloc_server()
985 kfree(server); in nfs_alloc_server()
989 server->client = server->client_acl = ERR_PTR(-EINVAL); in nfs_alloc_server()
992 INIT_LIST_HEAD(&server->client_link); in nfs_alloc_server()
993 INIT_LIST_HEAD(&server->master_link); in nfs_alloc_server()
994 INIT_LIST_HEAD(&server->delegations); in nfs_alloc_server()
995 INIT_LIST_HEAD(&server->layouts); in nfs_alloc_server()
996 INIT_LIST_HEAD(&server->state_owners_lru); in nfs_alloc_server()
997 INIT_LIST_HEAD(&server->ss_copies); in nfs_alloc_server()
998 INIT_LIST_HEAD(&server->ss_src_copies); in nfs_alloc_server()
1000 atomic_set(&server->active, 0); in nfs_alloc_server()
1002 server->io_stats = nfs_alloc_iostats(); in nfs_alloc_server()
1003 if (!server->io_stats) { in nfs_alloc_server()
1004 kfree(server); in nfs_alloc_server()
1008 server->change_attr_type = NFS4_CHANGE_TYPE_IS_UNDEFINED; in nfs_alloc_server()
1010 init_waitqueue_head(&server->write_congestion_wait); in nfs_alloc_server()
1011 atomic_long_set(&server->writeback, 0); in nfs_alloc_server()
1013 atomic64_set(&server->owner_ctr, 0); in nfs_alloc_server()
1015 pnfs_init_server(server); in nfs_alloc_server()
1016 rpc_init_wait_queue(&server->uoc_rpcwaitq, "NFS UOC"); in nfs_alloc_server()
1018 return server; in nfs_alloc_server()
1024 struct nfs_server *server = container_of(p, struct nfs_server, rcu); in delayed_free() local
1026 nfs_free_iostats(server->io_stats); in delayed_free()
1027 kfree(server); in delayed_free()
1031 * Free up a server record
1033 void nfs_free_server(struct nfs_server *server) in nfs_free_server() argument
1035 nfs_server_remove_lists(server); in nfs_free_server()
1037 if (server->destroy != NULL) in nfs_free_server()
1038 server->destroy(server); in nfs_free_server()
1040 if (!IS_ERR(server->client_acl)) in nfs_free_server()
1041 rpc_shutdown_client(server->client_acl); in nfs_free_server()
1042 if (!IS_ERR(server->client)) in nfs_free_server()
1043 rpc_shutdown_client(server->client); in nfs_free_server()
1045 nfs_put_client(server->nfs_client); in nfs_free_server()
1047 if (server->kobj.state_initialized) { in nfs_free_server()
1048 nfs_sysfs_remove_server(server); in nfs_free_server()
1049 kobject_put(&server->kobj); in nfs_free_server()
1051 ida_free(&s_sysfs_ids, server->s_sysfs_id); in nfs_free_server()
1053 put_cred(server->cred); in nfs_free_server()
1055 call_rcu(&server->rcu, delayed_free); in nfs_free_server()
1061 * - keyed on server and FSID
1066 struct nfs_server *server; in nfs_create_server() local
1070 server = nfs_alloc_server(); in nfs_create_server()
1071 if (!server) in nfs_create_server()
1074 server->cred = get_cred(fc->cred); in nfs_create_server()
1082 error = nfs_init_server(server, fc); in nfs_create_server()
1087 error = nfs_probe_fsinfo(server, ctx->mntfh, fattr); in nfs_create_server()
1090 if (server->nfs_client->rpc_ops->version == 3) { in nfs_create_server()
1091 if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN) in nfs_create_server()
1092 server->namelen = NFS3_MAXNAMLEN; in nfs_create_server()
1094 server->caps |= NFS_CAP_READDIRPLUS; in nfs_create_server()
1096 if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN) in nfs_create_server()
1097 server->namelen = NFS2_MAXNAMLEN; in nfs_create_server()
1101 error = ctx->nfs_mod->rpc_ops->getattr(server, ctx->mntfh, in nfs_create_server()
1108 memcpy(&server->fsid, &fattr->fsid, sizeof(server->fsid)); in nfs_create_server()
1110 dprintk("Server FSID: %llx:%llx\n", in nfs_create_server()
1111 (unsigned long long) server->fsid.major, in nfs_create_server()
1112 (unsigned long long) server->fsid.minor); in nfs_create_server()
1114 nfs_server_insert_lists(server); in nfs_create_server()
1115 server->mount_time = jiffies; in nfs_create_server()
1117 return server; in nfs_create_server()
1121 nfs_free_server(server); in nfs_create_server()
1127 * Clone an NFS2, NFS3 or NFS4 server record
1134 struct nfs_server *server; in nfs_clone_server() local
1137 server = nfs_alloc_server(); in nfs_clone_server()
1138 if (!server) in nfs_clone_server()
1141 server->cred = get_cred(source->cred); in nfs_clone_server()
1144 server->nfs_client = source->nfs_client; in nfs_clone_server()
1145 server->destroy = source->destroy; in nfs_clone_server()
1146 refcount_inc(&server->nfs_client->cl_count); in nfs_clone_server()
1147 nfs_server_copy_userdata(server, source); in nfs_clone_server()
1149 server->fsid = fattr->fsid; in nfs_clone_server()
1151 nfs_sysfs_add_server(server); in nfs_clone_server()
1153 nfs_sysfs_link_rpc_client(server, in nfs_clone_server()
1154 server->nfs_client->cl_rpcclient, "_state"); in nfs_clone_server()
1156 error = nfs_init_server_rpcclient(server, in nfs_clone_server()
1162 /* probe the filesystem info for this server filesystem */ in nfs_clone_server()
1163 error = nfs_probe_server(server, fh); in nfs_clone_server()
1167 if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN) in nfs_clone_server()
1168 server->namelen = NFS4_MAXNAMLEN; in nfs_clone_server()
1170 error = nfs_start_lockd(server); in nfs_clone_server()
1174 nfs_server_insert_lists(server); in nfs_clone_server()
1175 server->mount_time = jiffies; in nfs_clone_server()
1177 return server; in nfs_clone_server()
1180 nfs_free_server(server); in nfs_clone_server()
1238 * set up the iterator to start reading from the server list and return the first item
1251 * move to next server
1281 seq_puts(m, "NV SERVER PORT USE HOSTNAME\n"); in nfs_server_list_show()
1343 struct nfs_server *server; in nfs_volume_list_show() local
1351 seq_puts(m, "NV SERVER PORT DEV FSID" in nfs_volume_list_show()
1356 server = list_entry(v, struct nfs_server, master_link); in nfs_volume_list_show()
1357 clp = server->nfs_client; in nfs_volume_list_show()
1360 MAJOR(server->s_dev), MINOR(server->s_dev)); in nfs_volume_list_show()
1363 (unsigned long long) server->fsid.major, in nfs_volume_list_show()
1364 (unsigned long long) server->fsid.minor); in nfs_volume_list_show()
1373 nfs_server_fscache_state(server)); in nfs_volume_list_show()