From owner-freebsd-bugs Sat Mar 28 13:20:11 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA08532 for freebsd-bugs-outgoing; Sat, 28 Mar 1998 13:20:11 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: (from gnats@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA08513; Sat, 28 Mar 1998 13:20:07 -0800 (PST) (envelope-from gnats) Received: from narnia.plutotech.com (narnia.plutotech.com [206.168.67.130]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA07344 for ; Sat, 28 Mar 1998 13:15:38 -0800 (PST) (envelope-from gibbs@narnia.plutotech.com) Received: (from gibbs@localhost) by narnia.plutotech.com (8.8.8/8.7.3) id OAA19476; Sat, 28 Mar 1998 14:12:11 -0700 (MST) Message-Id: <199803282112.OAA19476@narnia.plutotech.com> Date: Sat, 28 Mar 1998 14:12:11 -0700 (MST) From: "Justin T. Gibbs" Reply-To: gibbs@narnia.plutotech.com To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/6156: Patches to make dump understand ENOSPC Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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