Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Mar 1998 14:12:11 -0700 (MST)
From:      "Justin T. Gibbs" <gibbs@narnia.plutotech.com>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/6156: Patches to make dump understand ENOSPC
Message-ID:  <199803282112.OAA19476@narnia.plutotech.com>

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

>Number:         6156
>Category:       bin
>Synopsis:       Patches to make dump understand ENOSPC
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 28 13:20:04 PST 1998
>Last-Modified:
>Originator:     Justin T. Gibbs
>Organization:
Pluto Technologies International Inc.
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	CAM SCSI environment or any other environment where the target
	dump device returns ENOSPC at EOT.

>Description:

	Dump doesn't treat ENOSPC as an EOT condition.  This prevents
	the "auto-size" feature of dump from working on devices that
	return ENOSPC at EOT.  The CAM tape driver does this as do
	other systems (Pyramids running OSx are mentioned in a comment
	in dump).

>How-To-Repeat:

	Perform a large dump to a small tape and watch it bail when
	ENOSPC is returned.

>Fix:

The patch is pretty simple.  Check errno if write returns -1 for ENOSPC
and handle it accordingly.  The only possible catch has to do with rmt
operations.  The code now extracts the errno number from the reply from
the remote rmt session and sets errno accordingly.  If, for some reason,
ENOSPC (28) is a different error code on the remote system, we may
behave unexpectedly.  Is ENOSPC standardized???
	
==== //depot/FreeBSD-current/src/sbin/dump/dumprmt.c#4 - //depot/cam/sbin/dump/dumprmt.c#3 ====
***************
*** 362,375 ****
  {
  	register char *cp;
  	char code[30], emsg[BUFSIZ];
  
  	rmtgets(code, sizeof (code));
  	if (*code == 'E' || *code == 'F') {
  		rmtgets(emsg, sizeof (emsg));
  		msg("%s: %s", cmd, emsg);
  		if (*code == 'F') {
  			rmtstate = TS_CLOSED;
- 			return (-1);
  		}
  		return (-1);
  	}
--- 362,376 ----
  {
  	register char *cp;
  	char code[30], emsg[BUFSIZ];
+ 	extern errno;
  
  	rmtgets(code, sizeof (code));
  	if (*code == 'E' || *code == 'F') {
  		rmtgets(emsg, sizeof (emsg));
  		msg("%s: %s", cmd, emsg);
+ 		errno = atoi(&code[1]);
  		if (*code == 'F') {
  			rmtstate = TS_CLOSED;
  		}
  		return (-1);
  	}
==== //depot/FreeBSD-current/src/sbin/dump/tape.c#6 - //depot/cam/sbin/dump/tape.c#5 ====
***************
*** 819,831 ****
  		     slave_number, size, writesize);
  #endif
  
  		if (eot_count > 0)
  			size = 0;
  
- 		/*
- 		 * fixme: Pyramids running OSx return ENOSPC
- 		 * at EOT on 1/2 inch drives.
- 		 */
  		if (wrote < 0) {
  			(void) kill(master, SIGUSR1);
  			for (;;)
--- 819,835 ----
  		     slave_number, size, writesize);
  #endif
  
+ 		/*
+ 		 * Handle ENOSPC as an EOT condition
+ 		 */
+ 		if (wrote < 0 && errno == ENOSPC) {
+ 			wrote = 0;
+ 			eot_count++;
+ 		}
+ 
  		if (eot_count > 0)
  			size = 0;
  
  		if (wrote < 0) {
  			(void) kill(master, SIGUSR1);
  			for (;;)

>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?199803282112.OAA19476>