afs: Add some more info to /proc/net/afs/servers
authorDavid Howells <dhowells@redhat.com>
Fri, 27 Oct 2023 09:45:56 +0000 (10:45 +0100)
committerDavid Howells <dhowells@redhat.com>
Mon, 1 Jan 2024 16:36:58 +0000 (16:36 +0000)
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

fs/afs/fs_operation.c
fs/afs/fs_probe.c
fs/afs/proc.c
fs/afs/rotate.c
fs/afs/vl_rotate.c

index 00e22259be36b46aff7c0270dd0b6aea50dbb124..e760e11d5bcb93b7d48d8eeac3be387f245d4ea7 100644 (file)
@@ -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);
                }
        }
index aef16ac3f577b3c5d669d2e2b5d86c738a259281..8008d3ecabab91cac3ba3d1d24dcea67b5e46658 100644 (file)
@@ -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) {
index 16d93fa6396f4f6b65cb8f9f06bb4e1edfceed18..0b43bb9b0260bf8ee65f9f415221af13254a9d57 100644 (file)
@@ -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;
 }
 
index a6bda8f44c0f487e194a82194d4f7a289889391d..5423ac80f4e0ae3ac8ae42c8f607d73c6331cb62 100644 (file)
@@ -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:
index 91168528179cfd3ab641c87cb77ec598e9cdc180..d8f79f6ada3d9d8c415b1f1595f462f96875db1c 100644 (file)
@@ -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: