From owner-freebsd-bugs Wed Jul 29 18:50:19 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA05945 for freebsd-bugs-outgoing; Wed, 29 Jul 1998 18:50:19 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA05852 for ; Wed, 29 Jul 1998 18:50:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id SAA12006; Wed, 29 Jul 1998 18:50:02 -0700 (PDT) Received: from gamma.it.kth.se (gamma.it.kth.se [130.237.15.171]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA05768 for ; Wed, 29 Jul 1998 18:49:41 -0700 (PDT) (envelope-from ath@gamma.it.kth.se) Received: (from ath@localhost) by gamma.it.kth.se (8.8.8/8.8.8) id SAA01417; Wed, 29 Jul 1998 18:49:38 -0700 (PDT) (envelope-from ath) Message-Id: <199807300149.SAA01417@gamma.it.kth.se> Date: Wed, 29 Jul 1998 18:49:38 -0700 (PDT) From: Andrew Heybey To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/7441: src/sys/scsi/st.c:st_close() ignores errors from st_write_filemarks() Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 7441 >Category: kern >Synopsis: src/sys/scsi/st.c:st_close() ignores errors from st_write_filemarks() >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jul 29 18:50:02 PDT 1998 >Last-Modified: >Originator: Andrew Heybey >Organization: >Release: FreeBSD 2.2.6-RELEASE i386 >Environment: Writing to a SCSI tape near EOM. >Description: In sys/scsi/st.c, st_close() does not check for errors from calling st_write_filemarks(). This means that it is possible to write a file on the tape for which all the writes and the close return without errors, but the all bits did not make it onto the tape. >How-To-Repeat: Write to a SCSI tape near EOM and get unlucky such that no error is returned until the file marks are written in st_close(). >Fix: *** st.c 1998/07/29 15:35:05 1.1 --- st.c 1998/07/29 15:39:53 *************** *** 452,464 **** { u_int32_t unit, mode; struct scsi_data *st; unit = STUNIT(dev); mode = MODE(dev); st = sc_link->sd; if ((st->flags & (ST_WRITTEN | ST_FM_WRITTEN)) == ST_WRITTEN) ! st_write_filemarks(unit, 1, 0); /* * Since the device has seen its last close, allow media removal. --- 452,465 ---- { u_int32_t unit, mode; struct scsi_data *st; + errval errcode = 0; unit = STUNIT(dev); mode = MODE(dev); st = sc_link->sd; if ((st->flags & (ST_WRITTEN | ST_FM_WRITTEN)) == ST_WRITTEN) ! errcode = st_write_filemarks(unit, 1, 0); /* * Since the device has seen its last close, allow media removal. *************** *** 484,490 **** sc_link->flags &= ~SDEV_OPEN; st->flags &= ~ST_OPEN; ! return (0); } /* --- 485,491 ---- sc_link->flags &= ~SDEV_OPEN; st->flags &= ~ST_OPEN; ! return (errcode); } /* >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message