From owner-freebsd-bugs@FreeBSD.ORG Thu May 15 03:50:03 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BF55106566C for ; Thu, 15 May 2008 03:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E03BB8FC13 for ; Thu, 15 May 2008 03:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m4F3o2I4095069 for ; Thu, 15 May 2008 03:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m4F3o2Gc095068; Thu, 15 May 2008 03:50:02 GMT (envelope-from gnats) Resent-Date: Thu, 15 May 2008 03:50:02 GMT Resent-Message-Id: <200805150350.m4F3o2Gc095068@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Carlos Santos Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A17FD106567D for ; Thu, 15 May 2008 03:40:45 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 939FA8FC19 for ; Thu, 15 May 2008 03:40:45 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m4F3dZkE077297 for ; Thu, 15 May 2008 03:39:35 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m4F3dZ7B077296; Thu, 15 May 2008 03:39:35 GMT (envelope-from nobody) Message-Id: <200805150339.m4F3dZ7B077296@www.freebsd.org> Date: Thu, 15 May 2008 03:39:35 GMT From: Carlos Santos To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/123693: Workaround for burncd: ioctl(CDIOCEJECT): Input/output error X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 May 2008 03:50:03 -0000 >Number: 123693 >Category: bin >Synopsis: Workaround for burncd: ioctl(CDIOCEJECT): Input/output error >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu May 15 03:50:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Carlos Santos >Release: 7.0-STABLE >Organization: - >Environment: FreeBSD casantos 7.0-STABLE FreeBSD 7.0-STABLE #1: Fri Apr 25 03:02:38 BRT 2008 root@casantos:/share/FreeBSD/src/sys/i386/compile/HP_NX6320 i386 >Description: I get "burncd: ioctl(CDIOCEJECT): Input/output error" each time I attempt to blank a CDRW with burncd -f /dev/acd0 blank eject I noticed that this does not happen when I write a data cd with burncd -f /dev/acd0 data cd-image.iso fixate eject I have seen the same bahavior on 4 different computers that have DVD-RW units. It seems that it is necessary to give some time to the writer in order to let it stabilize before attempting to eject the disk. >How-To-Repeat: Run "burncd -f /dev/acd0 blank eject" on a Compaq nx6320 notebook with FreeBSD 7.0-STABLE installed. I have seen the same problem on 6.x releases. >Fix: Applying the attached patch to /usr/src/usr.sbin/burncd/burncd.c solves the problem. It makes burncd attempt to eject the CD five times, sleeping for one second after each unccessful try. Patch attached with submission follows: --- burncd.c.orig 2005-05-13 17:06:44.000000000 -0300 +++ burncd.c 2008-05-12 01:44:30.000000000 -0300 @@ -46,6 +46,7 @@ #include #define BLOCKS 16 +#define EJECT_TRIES 5 struct track_info { int file; @@ -316,9 +317,13 @@ err(EX_IOERR, "ioctl(CDRIOCSETBLOCKSIZE)"); } - if (eject) - if (ioctl(fd, CDIOCEJECT) < 0) + if (eject) { + int status, i = 0; + while ((status = ioctl(fd, CDIOCEJECT)) < 0 && ++i <= EJECT_TRIES) + sleep(1); + if (status < 0) err(EX_IOERR, "ioctl(CDIOCEJECT)"); + } close(fd); exit(EX_OK); } >Release-Note: >Audit-Trail: >Unformatted: