Linux NFS development
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@hammerspace.com>
To: "bcodding@redhat.com" <bcodding@redhat.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: bpftrace script to monitor tasks that are stuck in NFSv4 exception loops
Date: Wed, 11 Oct 2023 15:15:06 +0000	[thread overview]
Message-ID: <c3e1e5ccc8ac88cee2c0f2b8414283038dc9b8f7.camel@hammerspace.com> (raw)

[-- 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());
	}
}

             reply	other threads:[~2023-10-11 15:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11 15:15 Trond Myklebust [this message]
2023-10-16 20:24 ` bpftrace script to monitor tasks that are stuck in NFSv4 exception loops Benjamin Coddington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3e1e5ccc8ac88cee2c0f2b8414283038dc9b8f7.camel@hammerspace.com \
    --to=trondmy@hammerspace.com \
    --cc=bcodding@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox