Skip to content

Commit

Permalink
afs: Add some more info to /proc/net/afs/servers
Browse files Browse the repository at this point in the history
In /proc/net/afs/servers, show the cell name and the last error for each
address in the server's list.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
  • Loading branch information
David Howells committed Jan 1, 2024
1 parent d2ce4a8 commit af9a5b4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
2 changes: 0 additions & 2 deletions fs/afs/fs_operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ void afs_wait_for_operation(struct afs_operation *op)
op->call_abort_code = op->call->abort_code;
op->call_error = op->call->error;
op->call_responded = op->call->responded;
WRITE_ONCE(op->alist->addrs[op->addr_index].last_error,
op->call_error);
afs_put_call(op->call);
}
}
Expand Down
2 changes: 2 additions & 0 deletions fs/afs/fs_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ void afs_fileserver_probe_result(struct afs_call *call)

_enter("%pU,%u", &server->uuid, index);

WRITE_ONCE(addr->last_error, ret);

spin_lock(&server->probe_lock);

switch (ret) {
Expand Down
24 changes: 16 additions & 8 deletions fs/afs/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,31 +377,39 @@ static int afs_proc_servers_show(struct seq_file *m, void *v)
{
struct afs_server *server;
struct afs_addr_list *alist;
unsigned long failed;
int i;

if (v == SEQ_START_TOKEN) {
seq_puts(m, "UUID REF ACT\n");
seq_puts(m, "UUID REF ACT CELL\n");
return 0;
}

server = list_entry(v, struct afs_server, proc_link);
alist = rcu_dereference(server->addresses);
seq_printf(m, "%pU %3d %3d\n",
seq_printf(m, "%pU %3d %3d %s\n",
&server->uuid,
refcount_read(&server->ref),
atomic_read(&server->active));
atomic_read(&server->active),
server->cell->name);
seq_printf(m, " - info: fl=%lx rtt=%u brk=%x\n",
server->flags, server->rtt, server->cb_s_break);
seq_printf(m, " - probe: last=%d out=%d\n",
(int)(jiffies - server->probed_at) / HZ,
atomic_read(&server->probe_outstanding));
failed = alist->probe_failed;
seq_printf(m, " - ALIST v=%u rsp=%lx f=%lx\n",
alist->version, alist->responded, alist->probe_failed);
for (i = 0; i < alist->nr_addrs; i++)
seq_printf(m, " [%x] %pISpc%s rtt=%d\n",
i, rxrpc_kernel_remote_addr(alist->addrs[i].peer),
alist->preferred == i ? "*" : "",
rxrpc_kernel_get_srtt(alist->addrs[i].peer));
for (i = 0; i < alist->nr_addrs; i++) {
const struct afs_address *addr = &alist->addrs[i];

seq_printf(m, " [%x] %pISpc%s rtt=%d err=%d\n",
i, rxrpc_kernel_remote_addr(addr->peer),
alist->preferred == i ? "*" :
test_bit(i, &failed) ? "!" : "",
rxrpc_kernel_get_srtt(addr->peer),
addr->last_error);
}
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions fs/afs/rotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ bool afs_select_fileserver(struct afs_operation *op)
if (op->nr_iterations == 0)
goto start;

WRITE_ONCE(alist->addrs[op->addr_index].last_error, error);

/* Evaluate the result of the previous operation, if there was one. */
switch (op->call_error) {
case 0:
Expand Down
2 changes: 2 additions & 0 deletions fs/afs/vl_rotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ bool afs_select_vlserver(struct afs_vl_cursor *vc)
if (vc->nr_iterations == 0)
goto start;

WRITE_ONCE(alist->addrs[vc->addr_index].last_error, error);

/* Evaluate the result of the previous operation, if there was one. */
switch (error) {
default:
Expand Down

0 comments on commit af9a5b4

Please sign in to comment.