Lines Matching +full:cell +full:- +full:count

1 // SPDX-License-Identifier: GPL-2.0-or-later
17 bool afs_begin_vlserver_operation(struct afs_vl_cursor *vc, struct afs_cell *cell, in afs_begin_vlserver_operation() argument
21 vc->cell = cell; in afs_begin_vlserver_operation()
22 vc->key = key; in afs_begin_vlserver_operation()
23 vc->error = -EDESTADDRREQ; in afs_begin_vlserver_operation()
24 vc->ac.error = SHRT_MAX; in afs_begin_vlserver_operation()
27 vc->error = -EINTR; in afs_begin_vlserver_operation()
28 vc->flags |= AFS_VL_CURSOR_STOP; in afs_begin_vlserver_operation()
41 struct afs_cell *cell = vc->cell; in afs_start_vl_iteration() local
44 if (cell->dns_source == DNS_RECORD_UNAVAILABLE || in afs_start_vl_iteration()
45 cell->dns_expiry <= ktime_get_real_seconds()) { in afs_start_vl_iteration()
46 dns_lookup_count = smp_load_acquire(&cell->dns_lookup_count); in afs_start_vl_iteration()
47 set_bit(AFS_CELL_FL_DO_LOOKUP, &cell->flags); in afs_start_vl_iteration()
48 afs_queue_cell(cell, afs_cell_trace_get_queue_dns); in afs_start_vl_iteration()
50 if (cell->dns_source == DNS_RECORD_UNAVAILABLE) { in afs_start_vl_iteration()
52 &cell->dns_lookup_count, in afs_start_vl_iteration()
53 smp_load_acquire(&cell->dns_lookup_count) in afs_start_vl_iteration()
55 vc->error = -ERESTARTSYS; in afs_start_vl_iteration()
61 if (cell->dns_source == DNS_RECORD_UNAVAILABLE) { in afs_start_vl_iteration()
62 vc->error = -EDESTADDRREQ; in afs_start_vl_iteration()
67 read_lock(&cell->vl_servers_lock); in afs_start_vl_iteration()
68 vc->server_list = afs_get_vlserverlist( in afs_start_vl_iteration()
69 rcu_dereference_protected(cell->vl_servers, in afs_start_vl_iteration()
70 lockdep_is_held(&cell->vl_servers_lock))); in afs_start_vl_iteration()
71 read_unlock(&cell->vl_servers_lock); in afs_start_vl_iteration()
72 if (!vc->server_list->nr_servers) in afs_start_vl_iteration()
75 vc->untried = (1UL << vc->server_list->nr_servers) - 1; in afs_start_vl_iteration()
76 vc->index = -1; in afs_start_vl_iteration()
90 int error = vc->ac.error, i; in afs_select_vlserver()
93 vc->untried, vc->index, in afs_select_vlserver()
94 vc->ac.tried, vc->ac.index, in afs_select_vlserver()
95 error, vc->ac.abort_code); in afs_select_vlserver()
97 if (vc->flags & AFS_VL_CURSOR_STOP) { in afs_select_vlserver()
102 vc->nr_iterations++; in afs_select_vlserver()
112 vc->error = error; in afs_select_vlserver()
113 vc->flags |= AFS_VL_CURSOR_STOP; in afs_select_vlserver()
114 _leave(" = f [okay/local %d]", vc->ac.error); in afs_select_vlserver()
117 case -ECONNABORTED: in afs_select_vlserver()
121 switch (vc->ac.abort_code) { in afs_select_vlserver()
126 vc->error = -EREMOTEIO; in afs_select_vlserver()
127 //write_lock(&vc->cell->vl_servers_lock); in afs_select_vlserver()
128 //vc->server_list->weird_mask |= 1 << vc->index; in afs_select_vlserver()
129 //write_unlock(&vc->cell->vl_servers_lock); in afs_select_vlserver()
133 vc->error = afs_abort_to_error(vc->ac.abort_code); in afs_select_vlserver()
137 case -ERFKILL: in afs_select_vlserver()
138 case -EADDRNOTAVAIL: in afs_select_vlserver()
139 case -ENETUNREACH: in afs_select_vlserver()
140 case -EHOSTUNREACH: in afs_select_vlserver()
141 case -EHOSTDOWN: in afs_select_vlserver()
142 case -ECONNREFUSED: in afs_select_vlserver()
143 case -ETIMEDOUT: in afs_select_vlserver()
144 case -ETIME: in afs_select_vlserver()
146 vc->error = error; in afs_select_vlserver()
149 case -ECONNRESET: in afs_select_vlserver()
151 vc->error = error; in afs_select_vlserver()
152 vc->flags |= AFS_VL_CURSOR_RETRY; in afs_select_vlserver()
155 case -EOPNOTSUPP: in afs_select_vlserver()
162 afs_end_cursor(&vc->ac); in afs_select_vlserver()
163 afs_put_vlserverlist(vc->cell->net, vc->server_list); in afs_select_vlserver()
164 vc->server_list = NULL; in afs_select_vlserver()
165 if (vc->flags & AFS_VL_CURSOR_RETRIED) in afs_select_vlserver()
167 vc->flags |= AFS_VL_CURSOR_RETRIED; in afs_select_vlserver()
174 error = afs_send_vl_probes(vc->cell->net, vc->key, vc->server_list); in afs_select_vlserver()
179 _debug("pick [%lx]", vc->untried); in afs_select_vlserver()
181 error = afs_wait_for_vl_probes(vc->server_list, vc->untried); in afs_select_vlserver()
186 vc->index = vc->server_list->preferred; in afs_select_vlserver()
187 if (test_bit(vc->index, &vc->untried)) in afs_select_vlserver()
190 vc->index = -1; in afs_select_vlserver()
192 for (i = 0; i < vc->server_list->nr_servers; i++) { in afs_select_vlserver()
193 struct afs_vlserver *s = vc->server_list->servers[i].server; in afs_select_vlserver()
195 if (!test_bit(i, &vc->untried) || in afs_select_vlserver()
196 !test_bit(AFS_VLSERVER_FL_RESPONDING, &s->flags)) in afs_select_vlserver()
198 if (s->probe.rtt < rtt) { in afs_select_vlserver()
199 vc->index = i; in afs_select_vlserver()
200 rtt = s->probe.rtt; in afs_select_vlserver()
204 if (vc->index == -1) in afs_select_vlserver()
208 _debug("use %d", vc->index); in afs_select_vlserver()
209 __clear_bit(vc->index, &vc->untried); in afs_select_vlserver()
215 ASSERTCMP(vc->ac.alist, ==, NULL); in afs_select_vlserver()
216 vlserver = vc->server_list->servers[vc->index].server; in afs_select_vlserver()
217 vc->server = vlserver; in afs_select_vlserver()
219 _debug("USING VLSERVER: %s", vlserver->name); in afs_select_vlserver()
221 read_lock(&vlserver->lock); in afs_select_vlserver()
222 alist = rcu_dereference_protected(vlserver->addresses, in afs_select_vlserver()
223 lockdep_is_held(&vlserver->lock)); in afs_select_vlserver()
225 read_unlock(&vlserver->lock); in afs_select_vlserver()
227 memset(&vc->ac, 0, sizeof(vc->ac)); in afs_select_vlserver()
229 if (!vc->ac.alist) in afs_select_vlserver()
230 vc->ac.alist = alist; in afs_select_vlserver()
234 vc->ac.index = -1; in afs_select_vlserver()
237 ASSERT(vc->ac.alist); in afs_select_vlserver()
241 if (!afs_iterate_addresses(&vc->ac)) in afs_select_vlserver()
244 _debug("VL address %d/%d", vc->ac.index, vc->ac.alist->nr_addrs); in afs_select_vlserver()
246 _leave(" = t %pISpc", &vc->ac.alist->addrs[vc->ac.index].transport); in afs_select_vlserver()
251 afs_end_cursor(&vc->ac); in afs_select_vlserver()
258 if (vc->flags & AFS_VL_CURSOR_RETRY) in afs_select_vlserver()
261 e.error = -EDESTADDRREQ; in afs_select_vlserver()
263 for (i = 0; i < vc->server_list->nr_servers; i++) { in afs_select_vlserver()
264 struct afs_vlserver *s = vc->server_list->servers[i].server; in afs_select_vlserver()
266 if (test_bit(AFS_VLSERVER_FL_RESPONDING, &s->flags)) in afs_select_vlserver()
268 afs_prioritise_error(&e, READ_ONCE(s->probe.error), in afs_select_vlserver()
269 s->probe.abort_code); in afs_select_vlserver()
275 vc->error = error; in afs_select_vlserver()
277 vc->flags |= AFS_VL_CURSOR_STOP; in afs_select_vlserver()
278 afs_end_cursor(&vc->ac); in afs_select_vlserver()
279 _leave(" = f [failed %d]", vc->error); in afs_select_vlserver()
288 static int count; in afs_vl_dump_edestaddrreq() local
291 if (!IS_ENABLED(CONFIG_AFS_DEBUG_CURSOR) || count > 3) in afs_vl_dump_edestaddrreq()
293 count++; in afs_vl_dump_edestaddrreq()
298 vc->untried, vc->index, vc->nr_iterations, vc->flags, vc->error); in afs_vl_dump_edestaddrreq()
300 if (vc->server_list) { in afs_vl_dump_edestaddrreq()
301 const struct afs_vlserver_list *sl = vc->server_list; in afs_vl_dump_edestaddrreq()
303 sl->nr_servers, sl->index); in afs_vl_dump_edestaddrreq()
304 for (i = 0; i < sl->nr_servers; i++) { in afs_vl_dump_edestaddrreq()
305 const struct afs_vlserver *s = sl->servers[i].server; in afs_vl_dump_edestaddrreq()
307 s->name, s->port, s->flags, s->probe.error); in afs_vl_dump_edestaddrreq()
308 if (s->addresses) { in afs_vl_dump_edestaddrreq()
310 rcu_dereference(s->addresses); in afs_vl_dump_edestaddrreq()
311 pr_notice("VC: - nr=%u/%u/%u pf=%u\n", in afs_vl_dump_edestaddrreq()
312 a->nr_ipv4, a->nr_addrs, a->max_addrs, in afs_vl_dump_edestaddrreq()
313 a->preferred); in afs_vl_dump_edestaddrreq()
314 pr_notice("VC: - R=%lx F=%lx\n", in afs_vl_dump_edestaddrreq()
315 a->responded, a->failed); in afs_vl_dump_edestaddrreq()
316 if (a == vc->ac.alist) in afs_vl_dump_edestaddrreq()
317 pr_notice("VC: - current\n"); in afs_vl_dump_edestaddrreq()
323 vc->ac.tried, vc->ac.index, vc->ac.abort_code, vc->ac.error, in afs_vl_dump_edestaddrreq()
324 vc->ac.responded, vc->ac.nr_iterations); in afs_vl_dump_edestaddrreq()
333 struct afs_net *net = vc->cell->net; in afs_end_vlserver_operation()
335 if (vc->error == -EDESTADDRREQ || in afs_end_vlserver_operation()
336 vc->error == -EADDRNOTAVAIL || in afs_end_vlserver_operation()
337 vc->error == -ENETUNREACH || in afs_end_vlserver_operation()
338 vc->error == -EHOSTUNREACH) in afs_end_vlserver_operation()
341 afs_end_cursor(&vc->ac); in afs_end_vlserver_operation()
342 afs_put_vlserverlist(net, vc->server_list); in afs_end_vlserver_operation()
344 if (vc->error == -ECONNABORTED) in afs_end_vlserver_operation()
345 vc->error = afs_abort_to_error(vc->ac.abort_code); in afs_end_vlserver_operation()
347 return vc->error; in afs_end_vlserver_operation()