Skip to content

Commit 918b8e3

Browse files
jtlaytonAnna Schumaker
authored andcommitted
sunrpc: add netns inum and srcaddr to debugfs rpc_xprt info
The output format should provide a value that matches the one in the /proc/<pid>/ns/net symlink. This makes it simpler to match the rpc_xprt and rpc_clnt to a particular container. Also, when the xprt defines the get_srcaddr operation, use that to display the source address as well. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent eb3fabd commit 918b8e3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

net/sunrpc/debugfs.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@ xprt_info_show(struct seq_file *f, void *v)
182182
seq_printf(f, "addr: %s\n", xprt->address_strings[RPC_DISPLAY_ADDR]);
183183
seq_printf(f, "port: %s\n", xprt->address_strings[RPC_DISPLAY_PORT]);
184184
seq_printf(f, "state: 0x%lx\n", xprt->state);
185+
seq_printf(f, "netns: %u\n", xprt->xprt_net->ns.inum);
186+
187+
if (xprt->ops->get_srcaddr) {
188+
int ret, buflen;
189+
char buf[INET6_ADDRSTRLEN];
190+
191+
buflen = ARRAY_SIZE(buf);
192+
ret = xprt->ops->get_srcaddr(xprt, buf, buflen);
193+
if (ret < 0)
194+
ret = sprintf(buf, "<closed>");
195+
seq_printf(f, "saddr: %.*s\n", ret, buf);
196+
}
185197
return 0;
186198
}
187199

0 commit comments

Comments
 (0)