diff options
Diffstat (limited to 'fs/afs/server.c')
-rw-r--r-- | fs/afs/server.c | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/fs/afs/server.c b/fs/afs/server.c index 44aff81dc6a7..44b0ce53e913 100644 --- a/fs/afs/server.c +++ b/fs/afs/server.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* server.c: AFS server record management | 1 | /* AFS server record management |
2 | * | 2 | * |
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
@@ -41,7 +41,6 @@ static const struct afs_timer_ops afs_server_timer_ops = { | |||
41 | .timed_out = __afs_server_timeout, | 41 | .timed_out = __afs_server_timeout, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /*****************************************************************************/ | ||
45 | /* | 44 | /* |
46 | * lookup a server record in a cell | 45 | * lookup a server record in a cell |
47 | * - TODO: search the cell's server list | 46 | * - TODO: search the cell's server list |
@@ -106,7 +105,7 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr, | |||
106 | return 0; | 105 | return 0; |
107 | 106 | ||
108 | /* found a matching active server */ | 107 | /* found a matching active server */ |
109 | use_active_server: | 108 | use_active_server: |
110 | _debug("active server"); | 109 | _debug("active server"); |
111 | afs_get_server(active); | 110 | afs_get_server(active); |
112 | write_unlock(&cell->sv_lock); | 111 | write_unlock(&cell->sv_lock); |
@@ -119,7 +118,7 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr, | |||
119 | 118 | ||
120 | /* found a matching server in the graveyard, so resurrect it and | 119 | /* found a matching server in the graveyard, so resurrect it and |
121 | * dispose of the new record */ | 120 | * dispose of the new record */ |
122 | resurrect_server: | 121 | resurrect_server: |
123 | _debug("resurrecting server"); | 122 | _debug("resurrecting server"); |
124 | 123 | ||
125 | list_move_tail(&zombie->link, &cell->sv_list); | 124 | list_move_tail(&zombie->link, &cell->sv_list); |
@@ -133,10 +132,8 @@ int afs_server_lookup(struct afs_cell *cell, const struct in_addr *addr, | |||
133 | *_server = zombie; | 132 | *_server = zombie; |
134 | _leave(" = 0 (%p)", zombie); | 133 | _leave(" = 0 (%p)", zombie); |
135 | return 0; | 134 | return 0; |
135 | } | ||
136 | 136 | ||
137 | } /* end afs_server_lookup() */ | ||
138 | |||
139 | /*****************************************************************************/ | ||
140 | /* | 137 | /* |
141 | * destroy a server record | 138 | * destroy a server record |
142 | * - removes from the cell list | 139 | * - removes from the cell list |
@@ -175,9 +172,8 @@ void afs_put_server(struct afs_server *server) | |||
175 | write_unlock(&cell->sv_lock); | 172 | write_unlock(&cell->sv_lock); |
176 | 173 | ||
177 | _leave(" [killed]"); | 174 | _leave(" [killed]"); |
178 | } /* end afs_put_server() */ | 175 | } |
179 | 176 | ||
180 | /*****************************************************************************/ | ||
181 | /* | 177 | /* |
182 | * timeout server record | 178 | * timeout server record |
183 | * - removes from the cell's graveyard if the usage count is zero | 179 | * - removes from the cell's graveyard if the usage count is zero |
@@ -230,9 +226,8 @@ void afs_server_do_timeout(struct afs_server *server) | |||
230 | kfree(server); | 226 | kfree(server); |
231 | 227 | ||
232 | _leave(" [destroyed]"); | 228 | _leave(" [destroyed]"); |
233 | } /* end afs_server_do_timeout() */ | 229 | } |
234 | 230 | ||
235 | /*****************************************************************************/ | ||
236 | /* | 231 | /* |
237 | * get a callslot on a connection to the fileserver on the specified server | 232 | * get a callslot on a connection to the fileserver on the specified server |
238 | */ | 233 | */ |
@@ -323,7 +318,7 @@ int afs_server_request_callslot(struct afs_server *server, | |||
323 | } | 318 | } |
324 | 319 | ||
325 | /* got a callslot, but no connection */ | 320 | /* got a callslot, but no connection */ |
326 | obtained_slot: | 321 | obtained_slot: |
327 | 322 | ||
328 | /* need to get hold of the RxRPC connection */ | 323 | /* need to get hold of the RxRPC connection */ |
329 | down_write(&server->sem); | 324 | down_write(&server->sem); |
@@ -337,8 +332,7 @@ int afs_server_request_callslot(struct afs_server *server, | |||
337 | /* reuse an existing connection */ | 332 | /* reuse an existing connection */ |
338 | rxrpc_get_connection(server->fs_conn[nconn]); | 333 | rxrpc_get_connection(server->fs_conn[nconn]); |
339 | callslot->conn = server->fs_conn[nconn]; | 334 | callslot->conn = server->fs_conn[nconn]; |
340 | } | 335 | } else { |
341 | else { | ||
342 | /* create a new connection */ | 336 | /* create a new connection */ |
343 | ret = rxrpc_create_connection(afs_transport, | 337 | ret = rxrpc_create_connection(afs_transport, |
344 | htons(7000), | 338 | htons(7000), |
@@ -360,23 +354,21 @@ int afs_server_request_callslot(struct afs_server *server, | |||
360 | return 0; | 354 | return 0; |
361 | 355 | ||
362 | /* handle an error occurring */ | 356 | /* handle an error occurring */ |
363 | error_release_upw: | 357 | error_release_upw: |
364 | up_write(&server->sem); | 358 | up_write(&server->sem); |
365 | 359 | ||
366 | error_release: | 360 | error_release: |
367 | /* either release the callslot or pass it along to another deserving | 361 | /* either release the callslot or pass it along to another deserving |
368 | * task */ | 362 | * task */ |
369 | spin_lock(&server->fs_lock); | 363 | spin_lock(&server->fs_lock); |
370 | 364 | ||
371 | if (nconn < 0) { | 365 | if (nconn < 0) { |
372 | /* no callslot allocated */ | 366 | /* no callslot allocated */ |
373 | } | 367 | } else if (list_empty(&server->fs_callq)) { |
374 | else if (list_empty(&server->fs_callq)) { | ||
375 | /* no one waiting */ | 368 | /* no one waiting */ |
376 | server->fs_conn_cnt[nconn]++; | 369 | server->fs_conn_cnt[nconn]++; |
377 | spin_unlock(&server->fs_lock); | 370 | spin_unlock(&server->fs_lock); |
378 | } | 371 | } else { |
379 | else { | ||
380 | /* someone's waiting - dequeue them and wake them up */ | 372 | /* someone's waiting - dequeue them and wake them up */ |
381 | pcallslot = list_entry(server->fs_callq.next, | 373 | pcallslot = list_entry(server->fs_callq.next, |
382 | struct afs_server_callslot, link); | 374 | struct afs_server_callslot, link); |
@@ -400,10 +392,8 @@ int afs_server_request_callslot(struct afs_server *server, | |||
400 | 392 | ||
401 | _leave(" = %d", ret); | 393 | _leave(" = %d", ret); |
402 | return ret; | 394 | return ret; |
395 | } | ||
403 | 396 | ||
404 | } /* end afs_server_request_callslot() */ | ||
405 | |||
406 | /*****************************************************************************/ | ||
407 | /* | 397 | /* |
408 | * release a callslot back to the server | 398 | * release a callslot back to the server |
409 | * - transfers the RxRPC connection to the next pending callslot if possible | 399 | * - transfers the RxRPC connection to the next pending callslot if possible |
@@ -426,8 +416,7 @@ void afs_server_release_callslot(struct afs_server *server, | |||
426 | /* no one waiting */ | 416 | /* no one waiting */ |
427 | server->fs_conn_cnt[callslot->nconn]++; | 417 | server->fs_conn_cnt[callslot->nconn]++; |
428 | spin_unlock(&server->fs_lock); | 418 | spin_unlock(&server->fs_lock); |
429 | } | 419 | } else { |
430 | else { | ||
431 | /* someone's waiting - dequeue them and wake them up */ | 420 | /* someone's waiting - dequeue them and wake them up */ |
432 | pcallslot = list_entry(server->fs_callq.next, | 421 | pcallslot = list_entry(server->fs_callq.next, |
433 | struct afs_server_callslot, link); | 422 | struct afs_server_callslot, link); |
@@ -449,9 +438,8 @@ void afs_server_release_callslot(struct afs_server *server, | |||
449 | rxrpc_put_connection(callslot->conn); | 438 | rxrpc_put_connection(callslot->conn); |
450 | 439 | ||
451 | _leave(""); | 440 | _leave(""); |
452 | } /* end afs_server_release_callslot() */ | 441 | } |
453 | 442 | ||
454 | /*****************************************************************************/ | ||
455 | /* | 443 | /* |
456 | * get a handle to a connection to the vlserver (volume location) on the | 444 | * get a handle to a connection to the vlserver (volume location) on the |
457 | * specified server | 445 | * specified server |
@@ -473,8 +461,7 @@ int afs_server_get_vlconn(struct afs_server *server, | |||
473 | rxrpc_get_connection(server->vlserver); | 461 | rxrpc_get_connection(server->vlserver); |
474 | conn = server->vlserver; | 462 | conn = server->vlserver; |
475 | up_read(&server->sem); | 463 | up_read(&server->sem); |
476 | } | 464 | } else { |
477 | else { | ||
478 | /* create a new connection */ | 465 | /* create a new connection */ |
479 | up_read(&server->sem); | 466 | up_read(&server->sem); |
480 | down_write(&server->sem); | 467 | down_write(&server->sem); |
@@ -496,4 +483,4 @@ int afs_server_get_vlconn(struct afs_server *server, | |||
496 | *_conn = conn; | 483 | *_conn = conn; |
497 | _leave(" = %d", ret); | 484 | _leave(" = %d", ret); |
498 | return ret; | 485 | return ret; |
499 | } /* end afs_server_get_vlconn() */ | 486 | } |