Lines Matching +full:out +full:- +full:volume +full:- +full:limit

1 // SPDX-License-Identifier: GPL-2.0-or-later
22 if (op->server_states) { in afs_clear_server_states()
23 for (i = 0; i < op->server_list->nr_servers; i++) in afs_clear_server_states()
24 afs_put_endpoint_state(op->server_states[i].endpoint_state, in afs_clear_server_states()
26 kfree(op->server_states); in afs_clear_server_states()
43 read_lock(&op->volume->servers_lock); in afs_start_fs_iteration()
44 op->server_list = afs_get_serverlist( in afs_start_fs_iteration()
45 rcu_dereference_protected(op->volume->servers, in afs_start_fs_iteration()
46 lockdep_is_held(&op->volume->servers_lock))); in afs_start_fs_iteration()
47 read_unlock(&op->volume->servers_lock); in afs_start_fs_iteration()
49 op->server_states = kcalloc(op->server_list->nr_servers, sizeof(op->server_states[0]), in afs_start_fs_iteration()
51 if (!op->server_states) { in afs_start_fs_iteration()
58 for (i = 0; i < op->server_list->nr_servers; i++) { in afs_start_fs_iteration()
60 struct afs_server_state *s = &op->server_states[i]; in afs_start_fs_iteration()
62 server = op->server_list->servers[i].server; in afs_start_fs_iteration()
63 estate = rcu_dereference(server->endpoint_state); in afs_start_fs_iteration()
64 s->endpoint_state = afs_get_endpoint_state(estate, in afs_start_fs_iteration()
66 s->probe_seq = estate->probe_seq; in afs_start_fs_iteration()
67 s->untried_addrs = (1UL << estate->addresses->nr_addrs) - 1; in afs_start_fs_iteration()
68 init_waitqueue_entry(&s->probe_waiter, current); in afs_start_fs_iteration()
69 afs_get_address_preferences(op->net, estate->addresses); in afs_start_fs_iteration()
74 op->untried_servers = (1UL << op->server_list->nr_servers) - 1; in afs_start_fs_iteration()
75 op->server_index = -1; in afs_start_fs_iteration()
77 cb_server = vnode->cb_server; in afs_start_fs_iteration()
80 for (i = 0; i < op->server_list->nr_servers; i++) { in afs_start_fs_iteration()
81 server = op->server_list->servers[i].server; in afs_start_fs_iteration()
83 op->server_index = i; in afs_start_fs_iteration()
92 if (op->flags & AFS_OPERATION_CUR_ONLY) { in afs_start_fs_iteration()
93 afs_op_set_error(op, -ESTALE); in afs_start_fs_iteration()
99 write_seqlock(&vnode->cb_lock); in afs_start_fs_iteration()
100 ASSERTCMP(cb_server, ==, vnode->cb_server); in afs_start_fs_iteration()
101 vnode->cb_server = NULL; in afs_start_fs_iteration()
102 if (atomic64_xchg(&vnode->cb_expires_at, AFS_NO_CB_PROMISE) != AFS_NO_CB_PROMISE) in afs_start_fs_iteration()
103 vnode->cb_break++; in afs_start_fs_iteration()
104 write_sequnlock(&vnode->cb_lock); in afs_start_fs_iteration()
112 * Post volume busy note.
125 pr_notice("kAFS: Volume %llu '%s' on server %pU is %s\n", in afs_busy()
126 op->volume->vid, op->volume->name, &op->server->uuid, m); in afs_busy()
135 if (!(op->flags & AFS_OPERATION_UNINTR)) { in afs_sleep_and_retry()
138 afs_op_set_error(op, -ERESTARTSYS); in afs_sleep_and_retry()
156 struct afs_vnode *vnode = op->file[0].vnode; in afs_select_fileserver()
158 s32 abort_code = op->call_abort_code; in afs_select_fileserver()
160 int error = op->call_error, addr_index, i, j; in afs_select_fileserver()
162 op->nr_iterations++; in afs_select_fileserver()
165 op->debug_id, op->nr_iterations, op->volume->vid, in afs_select_fileserver()
166 op->server_index, op->untried_servers, in afs_select_fileserver()
167 op->addr_index, op->addr_tried, in afs_select_fileserver()
170 if (op->flags & AFS_OPERATION_STOP) { in afs_select_fileserver()
176 if (op->nr_iterations == 0) in afs_select_fileserver()
179 WRITE_ONCE(op->estate->addresses->addrs[op->addr_index].last_error, error); in afs_select_fileserver()
180 trace_afs_rotate(op, afs_rotate_trace_iter, op->call_error); in afs_select_fileserver()
183 switch (op->call_error) { in afs_select_fileserver()
186 &op->server_list->servers[op->server_index].flags); in afs_select_fileserver()
188 &op->server_list->servers[op->server_index].flags); in afs_select_fileserver()
189 op->cumul_error.responded = true; in afs_select_fileserver()
210 op->flags |= AFS_OPERATION_STOP; in afs_select_fileserver()
215 case -ECONNABORTED: in afs_select_fileserver()
217 * might involve the server being busy or the volume having been moved. in afs_select_fileserver()
225 op->cumul_error.responded = true; in afs_select_fileserver()
228 /* This fileserver doesn't know about the volume. in afs_select_fileserver()
229 * - May indicate that the VL is wrong - retry once and compare in afs_select_fileserver()
231 * - May indicate that the fileserver couldn't attach to the vol. in afs_select_fileserver()
232 * - The volume might have been temporarily removed so that it can in afs_select_fileserver()
233 * be replaced by a volume restore. "vos" might have ended one in afs_select_fileserver()
235 * - The volume might not be blessed or might not be in-service in afs_select_fileserver()
238 if (op->flags & AFS_OPERATION_VNOVOL) { in afs_select_fileserver()
239 afs_op_accumulate_error(op, -EREMOTEIO, abort_code); in afs_select_fileserver()
243 write_lock(&op->volume->servers_lock); in afs_select_fileserver()
244 op->server_list->vnovol_mask |= 1 << op->server_index; in afs_select_fileserver()
245 write_unlock(&op->volume->servers_lock); in afs_select_fileserver()
247 set_bit(AFS_VOLUME_NEEDS_UPDATE, &op->volume->flags); in afs_select_fileserver()
248 error = afs_check_volume_status(op->volume, op); in afs_select_fileserver()
254 if (test_bit(AFS_VOLUME_DELETED, &op->volume->flags)) { in afs_select_fileserver()
255 afs_op_set_error(op, -ENOMEDIUM); in afs_select_fileserver()
262 if (rcu_access_pointer(op->volume->servers) == op->server_list) { in afs_select_fileserver()
263 afs_op_accumulate_error(op, -EREMOTEIO, abort_code); in afs_select_fileserver()
268 op->flags |= AFS_OPERATION_VNOVOL; in afs_select_fileserver()
277 afs_op_accumulate_error(op, -EREMOTEIO, abort_code); in afs_select_fileserver()
282 * if the volume was neither in-service nor administratively in afs_select_fileserver()
289 * RX_CALL_TIMEOUT (-3). The error was intended to be sent if the in afs_select_fileserver()
293 * manager to temporarily (up to 15 minutes) mark the volume in afs_select_fileserver()
308 afs_op_accumulate_error(op, -ETIMEDOUT, abort_code); in afs_select_fileserver()
317 /* The volume is in use by the volserver or another volume utility in afs_select_fileserver()
318 * for an operation that might alter the contents. The volume is in afs_select_fileserver()
323 &op->server_list->servers[op->server_index].flags)) { in afs_select_fileserver()
326 &op->server_list->servers[op->server_index].flags); in afs_select_fileserver()
328 if (op->flags & AFS_OPERATION_NO_VSLEEP) { in afs_select_fileserver()
329 afs_op_set_error(op, -EADV); in afs_select_fileserver()
336 /* The volume is in use by the volserver or another volume in afs_select_fileserver()
338 * contents of the volume. VBUSY does not need to be returned in afs_select_fileserver()
349 if (op->flags & AFS_OPERATION_NO_VSLEEP) { in afs_select_fileserver()
350 afs_op_set_error(op, -EBUSY); in afs_select_fileserver()
354 &op->server_list->servers[op->server_index].flags)) { in afs_select_fileserver()
357 &op->server_list->servers[op->server_index].flags); in afs_select_fileserver()
360 if (op->flags & AFS_OPERATION_CUR_ONLY) { in afs_select_fileserver()
369 op->flags |= AFS_OPERATION_VBUSY; in afs_select_fileserver()
373 /* The volume migrated to another server. We consider in afs_select_fileserver()
377 * We also limit the number of VMOVED hops we will in afs_select_fileserver()
380 if (op->flags & AFS_OPERATION_VMOVED) { in afs_select_fileserver()
381 afs_op_set_error(op, -EREMOTEIO); in afs_select_fileserver()
384 op->flags |= AFS_OPERATION_VMOVED; in afs_select_fileserver()
386 set_bit(AFS_VOLUME_WAIT, &op->volume->flags); in afs_select_fileserver()
387 set_bit(AFS_VOLUME_NEEDS_UPDATE, &op->volume->flags); in afs_select_fileserver()
388 error = afs_check_volume_status(op->volume, op); in afs_select_fileserver()
395 * out of sync with the fileservers. This is hopefully in afs_select_fileserver()
403 if (rcu_access_pointer(op->volume->servers) == op->server_list) { in afs_select_fileserver()
404 afs_op_accumulate_error(op, -ENOMEDIUM, abort_code); in afs_select_fileserver()
412 afs_op_accumulate_error(op, -EREMOTEIO, abort_code); in afs_select_fileserver()
413 if (op->volume->type != AFSVL_RWVOL) in afs_select_fileserver()
423 afs_op_set_error(op, -ENOSPC); in afs_select_fileserver()
428 /* Volume is full. Only applies to RWVOLs. in afs_select_fileserver()
432 afs_op_set_error(op, -EDQUOT); in afs_select_fileserver()
439 &op->server_list->servers[op->server_index].flags); in afs_select_fileserver()
441 &op->server_list->servers[op->server_index].flags); in afs_select_fileserver()
445 case -ETIMEDOUT: in afs_select_fileserver()
446 case -ETIME: in afs_select_fileserver()
447 if (afs_op_error(op) != -EDESTADDRREQ) in afs_select_fileserver()
450 case -ERFKILL: in afs_select_fileserver()
451 case -EADDRNOTAVAIL: in afs_select_fileserver()
452 case -ENETUNREACH: in afs_select_fileserver()
453 case -EHOSTUNREACH: in afs_select_fileserver()
454 case -EHOSTDOWN: in afs_select_fileserver()
455 case -ECONNREFUSED: in afs_select_fileserver()
460 case -ENETRESET: in afs_select_fileserver()
462 op->type ? op->type->name : "???", op->debug_id); in afs_select_fileserver()
464 case -ECONNRESET: in afs_select_fileserver()
473 op->estate = NULL; in afs_select_fileserver()
474 op->server = NULL; in afs_select_fileserver()
476 op->server_states = NULL; in afs_select_fileserver()
477 afs_put_serverlist(op->net, op->server_list); in afs_select_fileserver()
478 op->server_list = NULL; in afs_select_fileserver()
481 ASSERTCMP(op->estate, ==, NULL); in afs_select_fileserver()
482 /* See if we need to do an update of the volume record. Note that the in afs_select_fileserver()
483 * volume may have moved or even have been deleted. in afs_select_fileserver()
485 error = afs_check_volume_status(op->volume, op); in afs_select_fileserver()
495 _debug("__ VOL %llx __", op->volume->vid); in afs_select_fileserver()
498 _debug("pick [%lx]", op->untried_servers); in afs_select_fileserver()
499 ASSERTCMP(op->estate, ==, NULL); in afs_select_fileserver()
501 error = afs_wait_for_fs_probes(op, op->server_states, in afs_select_fileserver()
502 !(op->flags & AFS_OPERATION_UNINTR)); in afs_select_fileserver()
523 if (op->server) { in afs_select_fileserver()
524 _debug("server %u", op->server_index); in afs_select_fileserver()
525 if (test_bit(op->server_index, &op->untried_servers)) in afs_select_fileserver()
527 op->server = NULL; in afs_select_fileserver()
532 op->server_index = -1; in afs_select_fileserver()
533 best_prio = -1; in afs_select_fileserver()
534 for (i = 0; i < op->server_list->nr_servers; i++) { in afs_select_fileserver()
536 struct afs_server_entry *se = &op->server_list->servers[i]; in afs_select_fileserver()
538 struct afs_server *s = se->server; in afs_select_fileserver()
540 if (!test_bit(i, &op->untried_servers) || in afs_select_fileserver()
541 test_bit(AFS_SE_EXCLUDED, &se->flags) || in afs_select_fileserver()
542 !test_bit(AFS_SERVER_FL_RESPONDING, &s->flags)) in afs_select_fileserver()
544 es = op->server_states[i].endpoint_state; in afs_select_fileserver()
545 sal = es->addresses; in afs_select_fileserver()
547 afs_get_address_preferences_rcu(op->net, sal); in afs_select_fileserver()
548 for (j = 0; j < sal->nr_addrs; j++) { in afs_select_fileserver()
549 if (es->failed_set & (1 << j)) in afs_select_fileserver()
551 if (!sal->addrs[j].peer) in afs_select_fileserver()
553 if (sal->addrs[j].prio > best_prio) { in afs_select_fileserver()
554 op->server_index = i; in afs_select_fileserver()
555 best_prio = sal->addrs[j].prio; in afs_select_fileserver()
561 if (op->server_index == -1) in afs_select_fileserver()
566 _debug("use %d prio %u", op->server_index, best_prio); in afs_select_fileserver()
567 __clear_bit(op->server_index, &op->untried_servers); in afs_select_fileserver()
573 ASSERTCMP(op->estate, ==, NULL); in afs_select_fileserver()
574 server = op->server_list->servers[op->server_index].server; in afs_select_fileserver()
576 if (!afs_check_server_record(op, server, op->key)) in afs_select_fileserver()
579 _debug("USING SERVER: %pU", &server->uuid); in afs_select_fileserver()
581 op->flags |= AFS_OPERATION_RETRY_SERVER; in afs_select_fileserver()
582 op->server = server; in afs_select_fileserver()
583 if (vnode->cb_server != server) { in afs_select_fileserver()
584 vnode->cb_server = server; in afs_select_fileserver()
585 vnode->cb_v_check = atomic_read(&vnode->volume->cb_v_break); in afs_select_fileserver()
586 atomic64_set(&vnode->cb_expires_at, AFS_NO_CB_PROMISE); in afs_select_fileserver()
590 op->addr_tried = 0; in afs_select_fileserver()
591 op->addr_index = -1; in afs_select_fileserver()
597 op->estate = op->server_states[op->server_index].endpoint_state; in afs_select_fileserver()
598 set = READ_ONCE(op->estate->responsive_set); in afs_select_fileserver()
599 failed = READ_ONCE(op->estate->failed_set); in afs_select_fileserver()
600 _debug("iterate ES=%x rs=%lx fs=%lx", op->estate->probe_seq, set, failed); in afs_select_fileserver()
601 set &= ~(failed | op->addr_tried); in afs_select_fileserver()
606 alist = op->estate->addresses; in afs_select_fileserver()
607 best_prio = -1; in afs_select_fileserver()
609 for (i = 0; i < alist->nr_addrs; i++) { in afs_select_fileserver()
612 if (alist->addrs[i].prio > best_prio) { in afs_select_fileserver()
614 best_prio = alist->addrs[i].prio; in afs_select_fileserver()
618 alist->preferred = addr_index; in afs_select_fileserver()
620 op->addr_index = addr_index; in afs_select_fileserver()
621 set_bit(addr_index, &op->addr_tried); in afs_select_fileserver()
623 op->volsync.creation = TIME64_MIN; in afs_select_fileserver()
624 op->volsync.update = TIME64_MIN; in afs_select_fileserver()
625 op->call_responded = false; in afs_select_fileserver()
627 op->server_index, addr_index, alist->nr_addrs, in afs_select_fileserver()
628 rxrpc_kernel_remote_addr(alist->addrs[op->addr_index].peer)); in afs_select_fileserver()
633 error = afs_wait_for_one_fs_probe(op->server, op->estate, op->addr_tried, in afs_select_fileserver()
634 !(op->flags & AFS_OPERATION_UNINTR)); in afs_select_fileserver()
640 /* We've now had a failure to respond on all of a server's addresses - in afs_select_fileserver()
644 afs_probe_fileserver(op->net, op->server); in afs_select_fileserver()
645 if (op->flags & AFS_OPERATION_RETRY_SERVER) { in afs_select_fileserver()
646 error = afs_wait_for_one_fs_probe(op->server, op->estate, op->addr_tried, in afs_select_fileserver()
647 !(op->flags & AFS_OPERATION_UNINTR)); in afs_select_fileserver()
650 op->flags &= ~AFS_OPERATION_RETRY_SERVER; in afs_select_fileserver()
656 case -ERESTARTSYS: in afs_select_fileserver()
659 case -ETIME: in afs_select_fileserver()
660 case -EDESTADDRREQ: in afs_select_fileserver()
668 op->estate = NULL; in afs_select_fileserver()
676 if (op->flags & AFS_OPERATION_VBUSY) { in afs_select_fileserver()
678 op->flags &= ~AFS_OPERATION_VBUSY; in afs_select_fileserver()
683 for (i = 0; i < op->server_list->nr_servers; i++) { in afs_select_fileserver()
686 estate = op->server_states[i].endpoint_state; in afs_select_fileserver()
687 error = READ_ONCE(estate->error); in afs_select_fileserver()
689 afs_op_accumulate_error(op, error, estate->abort_code); in afs_select_fileserver()
695 op->flags |= AFS_OPERATION_STOP; in afs_select_fileserver()
696 op->estate = NULL; in afs_select_fileserver()
717 op->file[0].cb_break_before, in afs_dump_edestaddrreq()
718 op->file[1].cb_break_before, op->flags, op->cumul_error.error); in afs_dump_edestaddrreq()
720 op->untried_servers, op->server_index, op->nr_iterations); in afs_dump_edestaddrreq()
722 op->call_error, op->call_abort_code, op->call_responded); in afs_dump_edestaddrreq()
724 if (op->server_list) { in afs_dump_edestaddrreq()
725 const struct afs_server_list *sl = op->server_list; in afs_dump_edestaddrreq()
728 sl->nr_servers, sl->vnovol_mask); in afs_dump_edestaddrreq()
729 for (i = 0; i < sl->nr_servers; i++) { in afs_dump_edestaddrreq()
730 const struct afs_server *s = sl->servers[i].server; in afs_dump_edestaddrreq()
732 rcu_dereference(s->endpoint_state); in afs_dump_edestaddrreq()
733 const struct afs_addr_list *a = e->addresses; in afs_dump_edestaddrreq()
736 s->flags, s->addr_version, &s->uuid); in afs_dump_edestaddrreq()
737 pr_notice("FC: - pq=%x R=%lx F=%lx\n", in afs_dump_edestaddrreq()
738 e->probe_seq, e->responsive_set, e->failed_set); in afs_dump_edestaddrreq()
740 pr_notice("FC: - av=%u nr=%u/%u/%u pr=%u\n", in afs_dump_edestaddrreq()
741 a->version, in afs_dump_edestaddrreq()
742 a->nr_ipv4, a->nr_addrs, a->max_addrs, in afs_dump_edestaddrreq()
743 a->preferred); in afs_dump_edestaddrreq()
744 if (a == e->addresses) in afs_dump_edestaddrreq()
745 pr_notice("FC: - current\n"); in afs_dump_edestaddrreq()
750 pr_notice("AC: t=%lx ax=%d\n", op->addr_tried, op->addr_index); in afs_dump_edestaddrreq()