From ath@gamma.it.kth.se Wed Jul 29 18:49:45 1998 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 Subject: src/sys/scsi/st.c:st_close() ignores errors from st_write_filemarks() X-Send-Pr-Version: 3.2 >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: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jul 29 18:50:02 PDT 1998 >Closed-Date: Fri Jul 31 02:00:45 PDT 1998 >Last-Modified: Fri Jul 31 02:00:59 PDT 1998 >Originator: Andrew Heybey >Release: FreeBSD 2.2.6-RELEASE i386 >Organization: >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); } /* >Release-Note: >Audit-Trail: State-Changed-From-To: open->closed State-Changed-By: phk State-Changed-When: Fri Jul 31 02:00:45 PDT 1998 State-Changed-Why: committed, thanks! >Unformatted: