NetBSD Problem Report #36244

From kovert@omniscient.com  Sun Apr 29 15:31:12 2007
Return-Path: <kovert@omniscient.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id D105663B960
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 29 Apr 2007 15:31:11 +0000 (UTC)
Message-Id: <200704291531.l3TFV6gg016310@guinness.omniscient.com>
Date: Sun, 29 Apr 2007 11:31:06 -0400 (EDT)
From: Todd Kover <kovert@omniscient.com>
Reply-To: kovert@omniscient.com
To: gnats-bugs@NetBSD.org
Subject: various ioctls fail for ld noticably on install
X-Send-Pr-Version: 3.95

>Number:         36244
>Category:       kern
>Synopsis:       ioctls fail to the ld driver preventing sysinst install
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    tron
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 29 15:35:00 +0000 2007
>Closed-Date:    Mon Apr 30 20:35:15 +0000 2007
>Last-Modified:  Mon Apr 30 20:35:15 +0000 2007
>Originator:     Todd Kover
>Release:        NetBSD 4.0_BETA2 (patch for -current)
>Organization:
Omniscient Technologies
>Environment:
NetBSD slivovice.cz.omniscient.com 4.0_BETA2 NetBSD 4.0_BETA2 (SLIVOVICE) #0: Sun Apr 29 16:28:38 CEST 2007  kovert@slivovice.cz.omniscient.com:/usr/obj/4.0-stable/i386/usr/src/os/NetBSD-4.0-branch/src/sys/arch/i386/compile/SLIVOVICE i386
Architecture: i386
Machine: i386
>Description:

        ldioctl() fails to set a return value for success so any ioctls
        processed by the function return ENOTTY.  This prevents sysinst
        from noticing the disk, preventing installations or upgrades.
        It's also noticable with invocations of disklabel and fdisk.

        oddly, I notice this on a Adaptec 2610SA-based ld0 but not a
        2410SA-based ld0; I didn't dig into why (the latter is also an
        older rev of BETA2, so it may have been caused by a pullup).

>How-To-Repeat:
        1. attempt to use sysinst or disklabel -I -e or fdisk on an
        	ld-based disk
	2. read " Inappropriate ioctl for device"
	3. curse

>Fix:

        The below patch fixes it. (it's against -current, but I tested
        it under 4.0_BETA2).

        It would be great if this could be applied and pulled up to 4.0.
        This would allow 4.0 to install on all ld-based disks.


Index: ld.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ld.c,v
retrieving revision 1.46
diff -u -r1.46 ld.c
--- ld.c	4 Mar 2007 06:01:42 -0000	1.46
+++ ld.c	29 Apr 2007 14:56:02 -0000
@@ -402,6 +402,7 @@
 	if (error != EPASSTHROUGH)
 		return (error);

+	error = 0;	/* reset to avoid erroneous passthru */
 	switch (cmd) {
 	case DIOCGDINFO:
 		memcpy(addr, sc->sc_dk.dk_label, sizeof(struct disklabel));

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->tron
Responsible-Changed-By: tron@netbsd.org
Responsible-Changed-When: Mon, 30 Apr 2007 13:26:44 +0000
Responsible-Changed-Why:
I'll handle this PR.


From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36244 CVS commit: src/sys/dev
Date: Mon, 30 Apr 2007 17:23:09 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Mon Apr 30 17:23:09 UTC 2007

 Modified Files:
 	src/sys/dev: ld.c

 Log Message:
 Reset error code if an ioctl() request is not handled by the generic
 disk framework. This stops ld(4) from returning an error for various
 ioctl() requests which actually *did* work. As a result fdisk(8) and
 therefore also sysinst(8) work with ld(4) devices once again.

 Based on a patch supplied by Todd Kover in PR kern/36244, successfully
 tested with ld(4)@icp(4).


 To generate a diff of this commit:
 cvs rdiff -r1.46 -r1.47 src/sys/dev/ld.c

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

From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36244 CVS commit: [netbsd-4] src/sys/dev
Date: Mon, 30 Apr 2007 19:01:15 +0000 (UTC)

 Module Name:	src
 Committed By:	bouyer
 Date:		Mon Apr 30 19:01:15 UTC 2007

 Modified Files:
 	src/sys/dev [netbsd-4]: ld.c

 Log Message:
 Pull up following revision(s) (requested by tron in ticket #601):
 	sys/dev/ld.c: revision 1.47
 Reset error code if an ioctl() request is not handled by the generic
 disk framework. This stops ld(4) from returning an error for various
 ioctl() requests which actually *did* work. As a result fdisk(8) and
 therefore also sysinst(8) work with ld(4) devices once again.
 Based on a patch supplied by Todd Kover in PR kern/36244, successfully
 tested with ld(4)@icp(4).


 To generate a diff of this commit:
 cvs rdiff -r1.42.2.2 -r1.42.2.3 src/sys/dev/ld.c

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

State-Changed-From-To: open->closed
State-Changed-By: tron@netbsd.org
State-Changed-When: Mon, 30 Apr 2007 20:35:15 +0000
State-Changed-Why:
I've committed a fix based on your patch. Thanks a lot for figuring this
one out.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.