NetBSD Problem Report #59674

From www@netbsd.org  Sun Sep 28 20:22:12 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C1F7F1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 28 Sep 2025 20:22:12 +0000 (UTC)
Message-Id: <20250928202211.72AAF1A923A@mollari.NetBSD.org>
Date: Sun, 28 Sep 2025 20:22:11 +0000 (UTC)
From: cmeerw@cmeerw.org
Reply-To: cmeerw@cmeerw.org
To: gnats-bugs@NetBSD.org
Subject: Unable to create wapbl journal on logical volume with NetBSD 11.0_BETA
X-Send-Pr-Version: www-1.0

>Number:         59674
>Category:       kern
>Synopsis:       Unable to create wapbl journal on logical volume with NetBSD 11.0_BETA
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 28 20:25:01 +0000 2025
>Last-Modified:  Sat Oct 04 19:55:00 +0000 2025
>Originator:     Christof Meerwald
>Release:        11.0_BETA (Wed Sep 24 12:39:13 UTC 2025)
>Organization:
>Environment:
NetBSD hlcs 11.0_BETA NetBSD 11.0_BETA (GENERIC) #0: Wed Sep 24 12:39:13 UTC 2025  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

>Description:
Mounting a newly created filesystem on a logical volume with the "log" option results in "Inappropriate ioctl for device".

see https://mail-index.netbsd.org/netbsd-users/2025/09/27/msg033178.html
https://mail-index.netbsd.org/netbsd-users/2025/09/28/msg033182.html
https://mail-index.netbsd.org/netbsd-users/2025/09/28/msg033183.html
https://mail-index.netbsd.org/netbsd-users/2025/09/28/msg033186.html

>How-To-Repeat:
Use NetBSD 11.0_BETA (or maybe HEAD)

- create a logical volume "vg-test"

- create a new filesystem on that logical volume: newfs -O2ea /dev/mapper/vg-test

- mount that filesystem with the "log" option: mount -o log /dev/mapper/vg-test /mnt

will likely result in "Inappropriate ioctl for device"

>Fix:
see https://mail-index.netbsd.org/netbsd-users/2025/09/28/msg033186.html for some analysis:

https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/dm/dm_ioctl.c.diff?r1=1.56;r2=1.57;f=h
with this change (the second part of it) it now fails on NetBSD 11.0_BETA, but I think the change is actually good.

Where it actually fails is in "getdisksize": this does a DIOCGWEDGEINFO and then a disk_find on dkw.dkw_parent.

I think the issue is in the handling of DIOCGWEDGEINFO in dev/dm/device-mapper.c where it sets dkw->dkw_parent to dmv->name. Should that maybe also use device_xname(dmv->devt)? (and what should dkw->device_name be set to there?)

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/59674: Unable to create wapbl journal on logical volume with NetBSD 11.0_BETA
Date: Sun, 28 Sep 2025 22:14:10 -0000 (UTC)

 cmeerw@cmeerw.org writes:

 >I think the issue is in the handling of DIOCGWEDGEINFO in dev/dm/device-mapper.c where it sets dkw->dkw_parent to dmv->name. Should that maybe also use device_xname(dmv->devt)? (and what should dkw->device_name be set to there?)


 Yes, the dm disk name was changed between -10 and -11 (from volume name
 to 'dm'+unit number). The same needs to be done for the DIOCWEDGEINFO
 code so that disk_find() can locate the disk structure in getdisksize().


From: "Michael van Elst" <mlelstv@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/59674 CVS commit: src/sys/dev/dm
Date: Mon, 29 Sep 2025 12:50:27 +0000

 Module Name:	src
 Committed By:	mlelstv
 Date:		Mon Sep 29 12:50:27 UTC 2025

 Modified Files:
 	src/sys/dev/dm: device-mapper.c

 Log Message:
 Use xdevice_name for DIOCGWEDGEINFO answer to align with the registered
 disk name. getdisksize() relies on it to find the disk structure.

 Fixes PR 59674.
 Pullup -11.


 To generate a diff of this commit:
 cvs rdiff -u -r1.64 -r1.65 src/sys/dev/dm/device-mapper.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Christof Meerwald <cmeerw@cmeerw.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: PR/59674 CVS commit: src/sys/dev/dm
Date: Sat, 4 Oct 2025 21:50:25 +0200

 Just re-tested with that patch (on the NetBSD-11 branch) and I can
 confirm that it works now as expected.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.