• Home
  • Raw
  • Download

Lines Matching refs:op

21 static bool afs_start_fs_iteration(struct afs_operation *op,  in afs_start_fs_iteration()  argument
28 read_lock(&op->volume->servers_lock); in afs_start_fs_iteration()
29 op->server_list = afs_get_serverlist( in afs_start_fs_iteration()
30 rcu_dereference_protected(op->volume->servers, in afs_start_fs_iteration()
31 lockdep_is_held(&op->volume->servers_lock))); in afs_start_fs_iteration()
32 read_unlock(&op->volume->servers_lock); in afs_start_fs_iteration()
34 op->untried = (1UL << op->server_list->nr_servers) - 1; in afs_start_fs_iteration()
35 op->index = READ_ONCE(op->server_list->preferred); in afs_start_fs_iteration()
40 for (i = 0; i < op->server_list->nr_servers; i++) { in afs_start_fs_iteration()
41 server = op->server_list->servers[i].server; in afs_start_fs_iteration()
43 op->index = i; in afs_start_fs_iteration()
52 if (op->flags & AFS_OPERATION_CUR_ONLY) { in afs_start_fs_iteration()
53 op->error = -ESTALE; in afs_start_fs_iteration()
90 static bool afs_sleep_and_retry(struct afs_operation *op) in afs_sleep_and_retry() argument
92 if (!(op->flags & AFS_OPERATION_UNINTR)) { in afs_sleep_and_retry()
95 op->error = -ERESTARTSYS; in afs_sleep_and_retry()
109 bool afs_select_fileserver(struct afs_operation *op) in afs_select_fileserver() argument
113 struct afs_vnode *vnode = op->file[0].vnode; in afs_select_fileserver()
116 int error = op->ac.error, i; in afs_select_fileserver()
119 op->untried, op->index, in afs_select_fileserver()
120 op->ac.tried, op->ac.index, in afs_select_fileserver()
121 error, op->ac.abort_code); in afs_select_fileserver()
123 if (op->flags & AFS_OPERATION_STOP) { in afs_select_fileserver()
128 op->nr_iterations++; in afs_select_fileserver()
138 op->error = error; in afs_select_fileserver()
139 op->flags |= AFS_OPERATION_STOP; in afs_select_fileserver()
147 switch (op->ac.abort_code) { in afs_select_fileserver()
154 if (op->flags & AFS_OPERATION_VNOVOL) { in afs_select_fileserver()
155 op->error = -EREMOTEIO; in afs_select_fileserver()
159 write_lock(&op->volume->servers_lock); in afs_select_fileserver()
160 op->server_list->vnovol_mask |= 1 << op->index; in afs_select_fileserver()
161 write_unlock(&op->volume->servers_lock); in afs_select_fileserver()
163 set_bit(AFS_VOLUME_NEEDS_UPDATE, &op->volume->flags); in afs_select_fileserver()
164 error = afs_check_volume_status(op->volume, op); in afs_select_fileserver()
168 if (test_bit(AFS_VOLUME_DELETED, &op->volume->flags)) { in afs_select_fileserver()
169 op->error = -ENOMEDIUM; in afs_select_fileserver()
176 if (rcu_access_pointer(op->volume->servers) == op->server_list) { in afs_select_fileserver()
177 op->error = -EREMOTEIO; in afs_select_fileserver()
182 op->flags |= AFS_OPERATION_VNOVOL; in afs_select_fileserver()
192 op->error = afs_abort_to_error(op->ac.abort_code); in afs_select_fileserver()
196 if (!test_and_set_bit(AFS_VOLUME_OFFLINE, &op->volume->flags)) { in afs_select_fileserver()
197 afs_busy(op->volume, op->ac.abort_code); in afs_select_fileserver()
198 clear_bit(AFS_VOLUME_BUSY, &op->volume->flags); in afs_select_fileserver()
200 if (op->flags & AFS_OPERATION_NO_VSLEEP) { in afs_select_fileserver()
201 op->error = -EADV; in afs_select_fileserver()
204 if (op->flags & AFS_OPERATION_CUR_ONLY) { in afs_select_fileserver()
205 op->error = -ESTALE; in afs_select_fileserver()
216 if (op->flags & AFS_OPERATION_NO_VSLEEP) { in afs_select_fileserver()
217 op->error = -EBUSY; in afs_select_fileserver()
220 if (!test_and_set_bit(AFS_VOLUME_BUSY, &op->volume->flags)) { in afs_select_fileserver()
221 afs_busy(op->volume, op->ac.abort_code); in afs_select_fileserver()
222 clear_bit(AFS_VOLUME_OFFLINE, &op->volume->flags); in afs_select_fileserver()
225 if (op->flags & AFS_OPERATION_CUR_ONLY) { in afs_select_fileserver()
226 if (!afs_sleep_and_retry(op)) in afs_select_fileserver()
234 op->flags |= AFS_OPERATION_VBUSY; in afs_select_fileserver()
245 if (op->flags & AFS_OPERATION_VMOVED) { in afs_select_fileserver()
246 op->error = -EREMOTEIO; in afs_select_fileserver()
249 op->flags |= AFS_OPERATION_VMOVED; in afs_select_fileserver()
251 set_bit(AFS_VOLUME_WAIT, &op->volume->flags); in afs_select_fileserver()
252 set_bit(AFS_VOLUME_NEEDS_UPDATE, &op->volume->flags); in afs_select_fileserver()
253 error = afs_check_volume_status(op->volume, op); in afs_select_fileserver()
266 if (rcu_access_pointer(op->volume->servers) == op->server_list) { in afs_select_fileserver()
267 op->error = -ENOMEDIUM; in afs_select_fileserver()
274 clear_bit(AFS_VOLUME_OFFLINE, &op->volume->flags); in afs_select_fileserver()
275 clear_bit(AFS_VOLUME_BUSY, &op->volume->flags); in afs_select_fileserver()
276 op->error = afs_abort_to_error(op->ac.abort_code); in afs_select_fileserver()
282 if (op->error != -EDESTADDRREQ) in afs_select_fileserver()
292 op->error = error; in afs_select_fileserver()
297 op->error = error; in afs_select_fileserver()
303 afs_end_cursor(&op->ac); in afs_select_fileserver()
304 op->server = NULL; in afs_select_fileserver()
305 afs_put_serverlist(op->net, op->server_list); in afs_select_fileserver()
306 op->server_list = NULL; in afs_select_fileserver()
312 error = afs_check_volume_status(op->volume, op); in afs_select_fileserver()
316 if (!afs_start_fs_iteration(op, vnode)) in afs_select_fileserver()
319 _debug("__ VOL %llx __", op->volume->vid); in afs_select_fileserver()
322 _debug("pick [%lx]", op->untried); in afs_select_fileserver()
324 error = afs_wait_for_fs_probes(op->server_list, op->untried); in afs_select_fileserver()
331 if (op->server) { in afs_select_fileserver()
332 _debug("server %u", op->index); in afs_select_fileserver()
333 if (test_bit(op->index, &op->untried)) in afs_select_fileserver()
335 op->server = NULL; in afs_select_fileserver()
339 op->index = -1; in afs_select_fileserver()
341 for (i = 0; i < op->server_list->nr_servers; i++) { in afs_select_fileserver()
342 struct afs_server *s = op->server_list->servers[i].server; in afs_select_fileserver()
344 if (!test_bit(i, &op->untried) || in afs_select_fileserver()
348 op->index = i; in afs_select_fileserver()
353 if (op->index == -1) in afs_select_fileserver()
357 _debug("use %d", op->index); in afs_select_fileserver()
358 __clear_bit(op->index, &op->untried); in afs_select_fileserver()
364 ASSERTCMP(op->ac.alist, ==, NULL); in afs_select_fileserver()
365 server = op->server_list->servers[op->index].server; in afs_select_fileserver()
367 if (!afs_check_server_record(op, server)) in afs_select_fileserver()
372 op->flags |= AFS_OPERATION_RETRY_SERVER; in afs_select_fileserver()
373 op->server = server; in afs_select_fileserver()
388 memset(&op->ac, 0, sizeof(op->ac)); in afs_select_fileserver()
390 if (!op->ac.alist) in afs_select_fileserver()
391 op->ac.alist = alist; in afs_select_fileserver()
395 op->ac.index = -1; in afs_select_fileserver()
398 ASSERT(op->ac.alist); in afs_select_fileserver()
402 if (!afs_iterate_addresses(&op->ac)) in afs_select_fileserver()
406 op->index, op->ac.index, op->ac.alist->nr_addrs, in afs_select_fileserver()
407 &op->ac.alist->addrs[op->ac.index].transport); in afs_select_fileserver()
416 afs_probe_fileserver(op->net, op->server); in afs_select_fileserver()
417 if (op->flags & AFS_OPERATION_RETRY_SERVER) { in afs_select_fileserver()
418 alist = op->ac.alist; in afs_select_fileserver()
420 op->server, !(op->flags & AFS_OPERATION_UNINTR)); in afs_select_fileserver()
423 op->flags &= ~AFS_OPERATION_RETRY_SERVER; in afs_select_fileserver()
435 afs_end_cursor(&op->ac); in afs_select_fileserver()
442 if (op->flags & AFS_OPERATION_VBUSY) in afs_select_fileserver()
447 for (i = 0; i < op->server_list->nr_servers; i++) { in afs_select_fileserver()
448 struct afs_server *s = op->server_list->servers[i].server; in afs_select_fileserver()
457 op->error = error; in afs_select_fileserver()
459 op->flags |= AFS_OPERATION_STOP; in afs_select_fileserver()
460 afs_end_cursor(&op->ac); in afs_select_fileserver()
461 _leave(" = f [failed %d]", op->error); in afs_select_fileserver()
468 void afs_dump_edestaddrreq(const struct afs_operation *op) in afs_dump_edestaddrreq() argument
481 op->file[0].cb_break_before, in afs_dump_edestaddrreq()
482 op->file[1].cb_break_before, op->flags, op->error); in afs_dump_edestaddrreq()
484 op->untried, op->index, op->nr_iterations); in afs_dump_edestaddrreq()
486 if (op->server_list) { in afs_dump_edestaddrreq()
487 const struct afs_server_list *sl = op->server_list; in afs_dump_edestaddrreq()
503 if (a == op->ac.alist) in afs_dump_edestaddrreq()
510 op->ac.tried, op->ac.index, op->ac.abort_code, op->ac.error, in afs_dump_edestaddrreq()
511 op->ac.responded, op->ac.nr_iterations); in afs_dump_edestaddrreq()