Commit fb72cd3d authored by David Howells's avatar David Howells

afs: Expose information from afs_vlserver through /proc for debugging

Convert various bitfields in afs_vlserver::probe to a mask and then expose
this and some other bits of information through /proc/net/afs/<cell>/vlservers
to make it easier to debug VL server communication issues.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 4f4c2c05
...@@ -412,10 +412,11 @@ struct afs_vlserver { ...@@ -412,10 +412,11 @@ struct afs_vlserver {
unsigned int rtt; /* RTT as ktime/64 */ unsigned int rtt; /* RTT as ktime/64 */
u32 abort_code; u32 abort_code;
short error; short error;
bool responded:1; unsigned short flags;
bool is_yfs:1; #define AFS_VLSERVER_PROBE_RESPONDED 0x01 /* At least once response (may be abort) */
bool not_yfs:1; #define AFS_VLSERVER_PROBE_IS_YFS 0x02 /* The peer appears to be YFS */
bool local_failure:1; #define AFS_VLSERVER_PROBE_NOT_YFS 0x04 /* The peer appears not to be YFS */
#define AFS_VLSERVER_PROBE_LOCAL_FAILURE 0x08 /* A local failure prevented a probe */
} probe; } probe;
u16 port; u16 port;
......
...@@ -310,6 +310,11 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) ...@@ -310,6 +310,11 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
alist->preferred == i ? '>' : '-', alist->preferred == i ? '>' : '-',
&alist->addrs[i].transport); &alist->addrs[i].transport);
} }
seq_printf(m, " info: fl=%lx rtt=%d\n", vlserver->flags, vlserver->probe.rtt);
seq_printf(m, " probe: fl=%x e=%d ac=%d out=%d\n",
vlserver->probe.flags, vlserver->probe.error,
vlserver->probe.abort_code,
atomic_read(&vlserver->probe_outstanding));
return 0; return 0;
} }
......
...@@ -45,14 +45,14 @@ void afs_vlserver_probe_result(struct afs_call *call) ...@@ -45,14 +45,14 @@ void afs_vlserver_probe_result(struct afs_call *call)
server->probe.error = 0; server->probe.error = 0;
goto responded; goto responded;
case -ECONNABORTED: case -ECONNABORTED:
if (!server->probe.responded) { if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)) {
server->probe.abort_code = call->abort_code; server->probe.abort_code = call->abort_code;
server->probe.error = ret; server->probe.error = ret;
} }
goto responded; goto responded;
case -ENOMEM: case -ENOMEM:
case -ENONET: case -ENONET:
server->probe.local_failure = true; server->probe.flags |= AFS_VLSERVER_PROBE_LOCAL_FAILURE;
afs_io_error(call, afs_io_error_vl_probe_fail); afs_io_error(call, afs_io_error_vl_probe_fail);
goto out; goto out;
case -ECONNRESET: /* Responded, but call expired. */ case -ECONNRESET: /* Responded, but call expired. */
...@@ -67,7 +67,7 @@ void afs_vlserver_probe_result(struct afs_call *call) ...@@ -67,7 +67,7 @@ void afs_vlserver_probe_result(struct afs_call *call)
default: default:
clear_bit(index, &alist->responded); clear_bit(index, &alist->responded);
set_bit(index, &alist->failed); set_bit(index, &alist->failed);
if (!server->probe.responded && if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) &&
(server->probe.error == 0 || (server->probe.error == 0 ||
server->probe.error == -ETIMEDOUT || server->probe.error == -ETIMEDOUT ||
server->probe.error == -ETIME)) server->probe.error == -ETIME))
...@@ -81,12 +81,12 @@ void afs_vlserver_probe_result(struct afs_call *call) ...@@ -81,12 +81,12 @@ void afs_vlserver_probe_result(struct afs_call *call)
clear_bit(index, &alist->failed); clear_bit(index, &alist->failed);
if (call->service_id == YFS_VL_SERVICE) { if (call->service_id == YFS_VL_SERVICE) {
server->probe.is_yfs = true; server->probe.flags |= AFS_VLSERVER_PROBE_IS_YFS;
set_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags); set_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags);
alist->addrs[index].srx_service = call->service_id; alist->addrs[index].srx_service = call->service_id;
} else { } else {
server->probe.not_yfs = true; server->probe.flags |= AFS_VLSERVER_PROBE_NOT_YFS;
if (!server->probe.is_yfs) { if (!(server->probe.flags & AFS_VLSERVER_PROBE_IS_YFS)) {
clear_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags); clear_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags);
alist->addrs[index].srx_service = call->service_id; alist->addrs[index].srx_service = call->service_id;
} }
...@@ -100,7 +100,7 @@ void afs_vlserver_probe_result(struct afs_call *call) ...@@ -100,7 +100,7 @@ void afs_vlserver_probe_result(struct afs_call *call)
} }
smp_wmb(); /* Set rtt before responded. */ smp_wmb(); /* Set rtt before responded. */
server->probe.responded = true; server->probe.flags |= AFS_VLSERVER_PROBE_RESPONDED;
set_bit(AFS_VLSERVER_FL_PROBED, &server->flags); set_bit(AFS_VLSERVER_FL_PROBED, &server->flags);
out: out:
spin_unlock(&server->probe_lock); spin_unlock(&server->probe_lock);
...@@ -202,7 +202,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist, ...@@ -202,7 +202,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist,
server = vllist->servers[i].server; server = vllist->servers[i].server;
if (!test_bit(AFS_VLSERVER_FL_PROBING, &server->flags)) if (!test_bit(AFS_VLSERVER_FL_PROBING, &server->flags))
__clear_bit(i, &untried); __clear_bit(i, &untried);
if (server->probe.responded) if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)
have_responders = true; have_responders = true;
} }
} }
...@@ -228,7 +228,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist, ...@@ -228,7 +228,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist,
for (i = 0; i < vllist->nr_servers; i++) { for (i = 0; i < vllist->nr_servers; i++) {
if (test_bit(i, &untried)) { if (test_bit(i, &untried)) {
server = vllist->servers[i].server; server = vllist->servers[i].server;
if (server->probe.responded) if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)
goto stop; goto stop;
if (test_bit(AFS_VLSERVER_FL_PROBING, &server->flags)) if (test_bit(AFS_VLSERVER_FL_PROBING, &server->flags))
still_probing = true; still_probing = true;
...@@ -246,7 +246,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist, ...@@ -246,7 +246,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist,
for (i = 0; i < vllist->nr_servers; i++) { for (i = 0; i < vllist->nr_servers; i++) {
if (test_bit(i, &untried)) { if (test_bit(i, &untried)) {
server = vllist->servers[i].server; server = vllist->servers[i].server;
if (server->probe.responded && if ((server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) &&
server->probe.rtt < rtt) { server->probe.rtt < rtt) {
pref = i; pref = i;
rtt = server->probe.rtt; rtt = server->probe.rtt;
......
...@@ -192,7 +192,8 @@ bool afs_select_vlserver(struct afs_vl_cursor *vc) ...@@ -192,7 +192,8 @@ bool afs_select_vlserver(struct afs_vl_cursor *vc)
for (i = 0; i < vc->server_list->nr_servers; i++) { for (i = 0; i < vc->server_list->nr_servers; i++) {
struct afs_vlserver *s = vc->server_list->servers[i].server; struct afs_vlserver *s = vc->server_list->servers[i].server;
if (!test_bit(i, &vc->untried) || !s->probe.responded) if (!test_bit(i, &vc->untried) ||
!(s->probe.flags & AFS_VLSERVER_PROBE_RESPONDED))
continue; continue;
if (s->probe.rtt < rtt) { if (s->probe.rtt < rtt) {
vc->index = i; vc->index = i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment