Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jul 1998 18:49:38 -0700 (PDT)
From:      Andrew Heybey <ath@niksun.com>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/7441: src/sys/scsi/st.c:st_close() ignores errors from st_write_filemarks()
Message-ID:  <199807300149.SAA01417@gamma.it.kth.se>

next in thread | raw e-mail | index | archive | help

>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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807300149.SAA01417>