* bpftrace script to monitor tasks that are stuck in NFSv4 exception loops
@ 2023-10-11 15:15 Trond Myklebust
2023-10-16 20:24 ` Benjamin Coddington
0 siblings, 1 reply; 2+ messages in thread
From: Trond Myklebust @ 2023-10-11 15:15 UTC (permalink / raw)
To: bcodding@redhat.com; +Cc: linux-nfs@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 120 bytes --]
See attachment.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
[-- Attachment #2: bpftrace script --]
[-- Type: text/plain, Size: 852 bytes --]
#!/usr/bin/bpftrace
/*
* Monitor NFSv4 exceptions
*
* Copyright 2023 Trond Myklebust
* Licensed under the GPLv2
*
*/
struct nfs4_exception {
struct nfs4_state *state;
struct inode *inode;
struct nfs4_stateid_struct *stateid;
long timeout;
unsigned short retrans;
unsigned char task_is_privileged : 1;
unsigned char delay : 1,
recovering : 1,
retry : 1;
bool interruptible;
};
kprobe:nfs4_do_handle_exception {
$server = (struct nfs_server *)arg0;
$errorcode = (int32)arg1;
$exception = (struct nfs4_exception *)arg2;
$inode = $exception->inode;
if ($errorcode != 0 && $inode != 0) {
$dev = (uint32)$inode->i_sb->s_dev;
printf("%s [%d]: inode=%u:%u:%u, error=%d %s\n",
strftime("%F %H:%M:%S", nsecs), pid, $dev >> 20,
$dev & ((1 << 20) - 1), $inode->i_ino, $errorcode,
kstack());
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: bpftrace script to monitor tasks that are stuck in NFSv4 exception loops
2023-10-11 15:15 bpftrace script to monitor tasks that are stuck in NFSv4 exception loops Trond Myklebust
@ 2023-10-16 20:24 ` Benjamin Coddington
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Coddington @ 2023-10-16 20:24 UTC (permalink / raw)
To: Trond Myklebust; +Cc: linux-nfs
On 11 Oct 2023, at 11:15, Trond Myklebust wrote:
> See attachment.
Cool. Thanks for this - looks pretty similar to the systemtap stuff we use, but compile times are faster here.
I wonder if bpftrace can do the "guru" things that systemtap can, like modify the stack and memory.
Seems it works with gcc too, just needed CONFIG_DEBUG_INFO_BTF=y. I will play with it a bit.
Ben
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-16 20:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-11 15:15 bpftrace script to monitor tasks that are stuck in NFSv4 exception loops Trond Myklebust
2023-10-16 20:24 ` Benjamin Coddington
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox