Lines Matching refs:server

23 				  struct afs_server *server, bool fast)  in afs_schedule_fs_probe()  argument
30 atj = server->probed_at; in afs_schedule_fs_probe()
41 static void afs_finished_fs_probe(struct afs_net *net, struct afs_server *server) in afs_finished_fs_probe() argument
43 bool responded = server->probe.responded; in afs_finished_fs_probe()
47 list_add_tail(&server->probe_link, &net->fs_probe_slow); in afs_finished_fs_probe()
49 server->rtt = UINT_MAX; in afs_finished_fs_probe()
50 clear_bit(AFS_SERVER_FL_RESPONDING, &server->flags); in afs_finished_fs_probe()
51 list_add_tail(&server->probe_link, &net->fs_probe_fast); in afs_finished_fs_probe()
55 afs_schedule_fs_probe(net, server, !responded); in afs_finished_fs_probe()
61 static void afs_done_one_fs_probe(struct afs_net *net, struct afs_server *server) in afs_done_one_fs_probe() argument
65 if (atomic_dec_and_test(&server->probe_outstanding)) in afs_done_one_fs_probe()
66 afs_finished_fs_probe(net, server); in afs_done_one_fs_probe()
68 wake_up_all(&server->probe_wq); in afs_done_one_fs_probe()
76 struct afs_server *server, in afs_fs_probe_not_done() argument
85 spin_lock(&server->probe_lock); in afs_fs_probe_not_done()
87 server->probe.local_failure = true; in afs_fs_probe_not_done()
88 if (server->probe.error == 0) in afs_fs_probe_not_done()
89 server->probe.error = -ENOMEM; in afs_fs_probe_not_done()
93 spin_unlock(&server->probe_lock); in afs_fs_probe_not_done()
94 return afs_done_one_fs_probe(net, server); in afs_fs_probe_not_done()
104 struct afs_server *server = call->server; in afs_fileserver_probe_result() local
109 _enter("%pU,%u", &server->uuid, index); in afs_fileserver_probe_result()
111 spin_lock(&server->probe_lock); in afs_fileserver_probe_result()
115 server->probe.error = 0; in afs_fileserver_probe_result()
118 if (!server->probe.responded) { in afs_fileserver_probe_result()
119 server->probe.abort_code = call->abort_code; in afs_fileserver_probe_result()
120 server->probe.error = ret; in afs_fileserver_probe_result()
126 server->probe.local_failure = true; in afs_fileserver_probe_result()
141 if (!server->probe.responded && in afs_fileserver_probe_result()
142 (server->probe.error == 0 || in afs_fileserver_probe_result()
143 server->probe.error == -ETIMEDOUT || in afs_fileserver_probe_result()
144 server->probe.error == -ETIME)) in afs_fileserver_probe_result()
145 server->probe.error = ret; in afs_fileserver_probe_result()
154 server->probe.is_yfs = true; in afs_fileserver_probe_result()
155 set_bit(AFS_SERVER_FL_IS_YFS, &server->flags); in afs_fileserver_probe_result()
158 server->probe.not_yfs = true; in afs_fileserver_probe_result()
159 if (!server->probe.is_yfs) { in afs_fileserver_probe_result()
160 clear_bit(AFS_SERVER_FL_IS_YFS, &server->flags); in afs_fileserver_probe_result()
165 set_bit(AFS_SERVER_FL_HAS_FS64, &server->flags); in afs_fileserver_probe_result()
167 clear_bit(AFS_SERVER_FL_HAS_FS64, &server->flags); in afs_fileserver_probe_result()
171 if (rtt_us < server->probe.rtt) { in afs_fileserver_probe_result()
172 server->probe.rtt = rtt_us; in afs_fileserver_probe_result()
173 server->rtt = rtt_us; in afs_fileserver_probe_result()
178 server->probe.responded = true; in afs_fileserver_probe_result()
180 set_bit(AFS_SERVER_FL_RESPONDING, &server->flags); in afs_fileserver_probe_result()
182 spin_unlock(&server->probe_lock); in afs_fileserver_probe_result()
185 &server->uuid, index, &alist->addrs[index].transport, in afs_fileserver_probe_result()
188 return afs_done_one_fs_probe(call->net, server); in afs_fileserver_probe_result()
195 void afs_fs_probe_fileserver(struct afs_net *net, struct afs_server *server, in afs_fs_probe_fileserver() argument
202 _enter("%pU", &server->uuid); in afs_fs_probe_fileserver()
204 read_lock(&server->fs_lock); in afs_fs_probe_fileserver()
205 ac.alist = rcu_dereference_protected(server->addresses, in afs_fs_probe_fileserver()
206 lockdep_is_held(&server->fs_lock)); in afs_fs_probe_fileserver()
208 read_unlock(&server->fs_lock); in afs_fs_probe_fileserver()
210 server->probed_at = jiffies; in afs_fs_probe_fileserver()
211 atomic_set(&server->probe_outstanding, all ? ac.alist->nr_addrs : 1); in afs_fs_probe_fileserver()
212 memset(&server->probe, 0, sizeof(server->probe)); in afs_fs_probe_fileserver()
213 server->probe.rtt = UINT_MAX; in afs_fs_probe_fileserver()
221 if (!afs_fs_get_capabilities(net, server, &ac, key)) in afs_fs_probe_fileserver()
222 afs_fs_probe_not_done(net, server, &ac); in afs_fs_probe_fileserver()
224 if (!afs_fs_get_capabilities(net, server, &ac, key)) in afs_fs_probe_fileserver()
225 afs_fs_probe_not_done(net, server, &ac); in afs_fs_probe_fileserver()
237 struct afs_server *server; in afs_wait_for_fs_probes() local
247 server = slist->servers[i].server; in afs_wait_for_fs_probes()
248 if (!atomic_read(&server->probe_outstanding)) in afs_wait_for_fs_probes()
250 if (server->probe.responded) in afs_wait_for_fs_probes()
263 server = slist->servers[i].server; in afs_wait_for_fs_probes()
265 add_wait_queue(&server->probe_wq, &waits[i]); in afs_wait_for_fs_probes()
275 server = slist->servers[i].server; in afs_wait_for_fs_probes()
276 if (server->probe.responded) in afs_wait_for_fs_probes()
278 if (atomic_read(&server->probe_outstanding)) in afs_wait_for_fs_probes()
293 server = slist->servers[i].server; in afs_wait_for_fs_probes()
294 rtt_s = READ_ONCE(server->rtt); in afs_wait_for_fs_probes()
295 if (test_bit(AFS_SERVER_FL_RESPONDING, &server->flags) && in afs_wait_for_fs_probes()
301 remove_wait_queue(&server->probe_wq, &waits[i]); in afs_wait_for_fs_probes()
330 static void afs_dispatch_fs_probe(struct afs_net *net, struct afs_server *server, bool all) in afs_dispatch_fs_probe() argument
338 list_del_init(&server->probe_link); in afs_dispatch_fs_probe()
340 afs_get_server(server, afs_server_trace_get_probe); in afs_dispatch_fs_probe()
343 afs_fs_probe_fileserver(net, server, key, all); in afs_dispatch_fs_probe()
344 afs_put_server(net, server, afs_server_trace_put_probe); in afs_dispatch_fs_probe()
351 void afs_probe_fileserver(struct afs_net *net, struct afs_server *server) in afs_probe_fileserver() argument
354 if (!list_empty(&server->probe_link)) in afs_probe_fileserver()
355 return afs_dispatch_fs_probe(net, server, true); in afs_probe_fileserver()
365 struct afs_server *fast, *slow, *server; in afs_fs_probe_dispatcher() local
385 fast = slow = server = NULL; in afs_fs_probe_dispatcher()
410 server = fast ?: slow; in afs_fs_probe_dispatcher()
411 if (server) in afs_fs_probe_dispatcher()
412 _debug("probe %pU", &server->uuid); in afs_fs_probe_dispatcher()
414 if (server && (first_pass || !need_resched())) { in afs_fs_probe_dispatcher()
415 afs_dispatch_fs_probe(net, server, server == fast); in afs_fs_probe_dispatcher()
422 if (server) { in afs_fs_probe_dispatcher()
439 int afs_wait_for_one_fs_probe(struct afs_server *server, bool is_intr) in afs_wait_for_one_fs_probe() argument
444 if (atomic_read(&server->probe_outstanding) == 0) in afs_wait_for_one_fs_probe()
449 prepare_to_wait_event(&server->probe_wq, &wait, in afs_wait_for_one_fs_probe()
452 server->probe.responded || in afs_wait_for_one_fs_probe()
453 atomic_read(&server->probe_outstanding) == 0 || in afs_wait_for_one_fs_probe()
459 finish_wait(&server->probe_wq, &wait); in afs_wait_for_one_fs_probe()
462 if (server->probe.responded) in afs_wait_for_one_fs_probe()