Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] libxfs: report device open errors during topology probing
@ 2026-08-27 11:28 Hans Holmberg
  2026-08-31  7:10 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Holmberg @ 2026-08-27 11:28 UTC (permalink / raw)
  To: linux-xfs; +Cc: aalbersh, cem, hch, djwong, Hans Holmberg

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-03  5:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27 11:28 [PATCH] libxfs: report device open errors during topology probing Hans Holmberg
2026-08-31  7:10 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox