Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Hans Holmberg <hans.holmberg@wdc.com>
To: linux-xfs@vger.kernel.org
Cc: aalbersh@kernel.org, cem@kernel.org, hch@lst.de,
	djwong@kernel.org, Hans Holmberg <hans.holmberg@wdc.com>
Subject: [PATCH] libxfs: report device open errors during topology probing
Date: Thu, 27 Aug 2026 13:28:55 +0200	[thread overview]
Message-ID: <20260827112855.70037-1-hans.holmberg@wdc.com> (raw)

mkfs probes the device topology before libxfs_init opens the target.
If blkid cannot open the device, blkid_new_probe_from_filename returns
NULL and leaves the topology sector sizes initialized to zero.  This
causes mkfs to report the misleading error "illegal sector size 0".

Report the underlying open error immediately so that permission
failures are diagnosed correctly. For example:

cannot probe device topology for device /dev/nvme1n1: Permission denied

Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
---
 libxfs/topology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libxfs/topology.c b/libxfs/topology.c
index dc2aaa17..5571c9d8 100644
--- a/libxfs/topology.c
+++ b/libxfs/topology.c
@@ -230,8 +230,12 @@ blkid_get_topology(
 	blkid_probe pr;
 
 	pr = blkid_new_probe_from_filename(device);
-	if (!pr)
-		return;
+	if (!pr) {
+		fprintf(stderr,
+			_("cannot probe device topology for device %s: %s\n"),
+			device, strerror(errno));
+		exit(EXIT_FAILURE);
+	}
 
 	tp = blkid_probe_get_topology(pr);
 	if (!tp)
-- 
2.53.0


             reply	other threads:[~2026-08-27 11:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 11:28 Hans Holmberg [this message]
2026-08-31  7:10 ` [PATCH] libxfs: report device open errors during topology probing Christoph Hellwig
2026-09-01  8:46   ` Hans Holmberg
2026-09-02  5:59     ` Christoph Hellwig
2026-09-02 16:20       ` Darrick J. Wong
2026-09-03  5:35         ` Christoph Hellwig

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=20260827112855.70037-1-hans.holmberg@wdc.com \
    --to=hans.holmberg@wdc.com \
    --cc=aalbersh@kernel.org \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@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