public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@atomlin.com>
To: steved@redhat.com, tbecker@redhat.com
Cc: yi.zhang@redhat.com, linux-nfs@vger.kernel.org
Subject: [PATCH 2/2] nfsrahead: quieten misleading error for non-NFS block devices
Date: Mon,  9 Mar 2026 10:50:25 -0400	[thread overview]
Message-ID: <20260309145025.107623-3-atomlin@atomlin.com> (raw)
In-Reply-To: <20260309145025.107623-1-atomlin@atomlin.com>

When get_device_info() evaluates a physical block device via the
fast-path rejection logic, it deliberately returns -ENODEV.

Previously, main() handled this by logging a D_GENERAL error ("unable to
find device"). Because udev invokes nfsrahead for all block devices
across the system, this results in misleading journal spam for devices
that were intentionally skipped, rather than genuinely missing.

Update the error handling logic in main() to explicitly catch the
-ENODEV return code. When encountered, log a more accurate "skipping
non-NFS device" message at the D_ALL debugging level. This prevents
unnecessary journal noise whilst maintaining the existing behaviour of
returning the errno exit status.

Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
---
 tools/nfsrahead/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/nfsrahead/main.c b/tools/nfsrahead/main.c
index 33487f37..86c7fcc6 100644
--- a/tools/nfsrahead/main.c
+++ b/tools/nfsrahead/main.c
@@ -218,7 +218,11 @@ int main(int argc, char **argv)
 	if ((argc - optind) != 1)
 		xlog_err("expected the device number of a BDI; is udev ok?");
 
-	if ((ret = get_device_info(argv[optind], &device)) != 0 || device.fstype == NULL) {
+	ret = get_device_info(argv[optind], &device);
+	if (ret == -ENODEV) {
+		xlog(D_ALL, "skipping non-NFS device %s\n", argv[optind]);
+		goto out;
+	} else if (ret != 0 || device.fstype == NULL) {
 		xlog(D_GENERAL, "unable to find device %s\n", argv[optind]);
 		goto out;
 	}
-- 
2.51.0


  parent reply	other threads:[~2026-03-09 14:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 14:50 [PATCH 0/2] nfsrahead: fix uninitialised memory crash and refine fast-path logging Aaron Tomlin
2026-03-09 14:50 ` [PATCH 1/2] nfsrahead: zero-initialise device_info struct Aaron Tomlin
2026-03-09 14:50 ` Aaron Tomlin [this message]
2026-03-11  8:27 ` [PATCH 0/2] nfsrahead: fix uninitialised memory crash and refine fast-path logging Yi Zhang
2026-03-11 16:11   ` Steve Dickson
2026-03-11 19:45   ` Aaron Tomlin
2026-03-12 12:50 ` Steve Dickson

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=20260309145025.107623-3-atomlin@atomlin.com \
    --to=atomlin@atomlin.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    --cc=tbecker@redhat.com \
    --cc=yi.zhang@redhat.com \
    /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