From owner-freebsd-bugs Wed Aug 9 4:10:18 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id BBD7537B9FF for ; Wed, 9 Aug 2000 04:10:14 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id EAA97168; Wed, 9 Aug 2000 04:10:09 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from probity.mcc.ac.uk (probity.mcc.ac.uk [130.88.200.94]) by hub.freebsd.org (Postfix) with ESMTP id 632EC37B9FF for ; Wed, 9 Aug 2000 04:07:03 -0700 (PDT) (envelope-from ip@albatross.mcc.ac.uk) Received: from albatross.mcc.ac.uk ([130.88.202.16]) by probity.mcc.ac.uk with esmtp (Exim 2.05 #4) id 13MThO-000EO1-00 for FreeBSD-gnats-submit@freebsd.org; Wed, 9 Aug 2000 12:07:02 +0100 Received: (from ip@localhost) by albatross.mcc.ac.uk (8.9.3/8.9.1) id MAA14134; Wed, 9 Aug 2000 12:07:01 +0100 (BST) (envelope-from ip) Message-Id: <200008091107.MAA14134@albatross.mcc.ac.uk> Date: Wed, 9 Aug 2000 12:07:01 +0100 (BST) From: ip@mcc.ac.uk Reply-To: ip@mcc.ac.uk To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/20501: autoloader support in dump(8) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 20501 >Category: bin >Synopsis: extra flag to dump to offline autoloaders at EOT >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: Wed Aug 09 04:10:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Ian Pallfreeman >Release: FreeBSD 3.5-STABLE i386 >Organization: Manchester Computing The University Oxford Road Manchester M13 9PL UK >Environment: Half-a-dozen or so clunky old HP DAT autoloaders and no Solaris >Description: Solaris has an additional ("l") flag to dump (aka ufsdump) which offlines a tape drive after EOT is detected. This tells DAT autoloaders which are in manual mode (i.e. the changer LUN hasn't seen any commands since the pod was loaded) to unload the current tape and load the next, if possible. The dump then continues without manual intervention until all tapes are written. The code is pretty simple. When EOT is reached, and we've waited for the tape to rewind, we do an OFFLINE ioctl and then wait again for two minutes or so until the tape opens successfully. If it doesn't, we assume we've used all the tapes in the pod and ask for manual intervention as before. Similar patches applied to FreeBSD 4.1-STABLE and NetBSD/SPARC 1.4.1. >How-To-Repeat: >Fix: --- main.c.orig Mon May 8 10:52:15 2000 +++ main.c Wed Aug 9 11:46:32 2000 @@ -87,6 +87,7 @@ long dev_bsize = 1; /* recalculated below */ long blocksperfile; /* output blocks per file */ char *host = NULL; /* remote host (if any) */ +int loader = 0; /* offline tape autoloader */ static long numarg __P((char *, long, long)); static void obsolete __P((int *, char **[])); @@ -123,9 +124,9 @@ obsolete(&argc, &argv); #ifdef KERBEROS -#define optstring "0123456789aB:b:cd:f:h:kns:T:uWw" +#define optstring "0123456789aB:b:cd:f:h:klns:T:uWw" #else -#define optstring "0123456789aB:b:cd:f:h:ns:T:uWw" +#define optstring "0123456789aB:b:cd:f:h:lns:T:uWw" #endif while ((ch = getopt(argc, argv, optstring)) != -1) #undef optstring @@ -173,6 +174,10 @@ dokerberos = 1; break; #endif + + case 'l': /* tape loader */ + loader = 1; + break; case 'n': /* notify operators */ notify = 1; --- tape.c.orig Sat Aug 28 01:12:39 1999 +++ tape.c Wed Aug 9 11:46:03 2000 @@ -43,6 +43,8 @@ #include #include #include +#include +#include #ifdef sunos #include @@ -78,6 +80,7 @@ extern int ntrec; /* blocking factor on tape */ extern int cartridge; extern char *host; +extern int loader; char *nexttape; static int atomic __P((ssize_t (*)(), int, char *, int)); @@ -374,20 +377,46 @@ close_rewind() { time_t tstart_changevol, tend_changevol; + int gottape=0; trewind(); if (nexttape) return; (void)time((time_t *)&(tstart_changevol)); - if (!nogripe) { - msg("Change Volumes: Mount volume #%d\n", tapeno+1); - broadcast("CHANGE DUMP VOLUMES!\7\7\n"); + if (loader) { + struct mtop MtOp; + int f,tx=0; + + msg("Mounting next tape on %s\n",tape); + + if ((f = open(tape,0)) < 0) + quit("can't re-open tape loader after rewind"); + + MtOp.mt_op = MTOFFL; + MtOp.mt_count = 1; + if (ioctl(f,MTIOCTOP,&MtOp) < 0) + quit("can't offline tape loader"); + (void) close(f); + sleep(10); + while ((f = open(tape,0)) < 0 && tx++ < 12) + sleep (10); + if (f >= 0) { + (void) close(f); + gottape = 1; + } } - while (!query("Is the new volume mounted and ready to go?")) - if (query("Do you want to abort?")) { - dumpabort(0); - /*NOTREACHED*/ + if (!gottape) { + if (!nogripe) { + msg("Change Volumes: Mount volume #%d\n", tapeno+1); + broadcast("CHANGE DUMP VOLUMES!\7\7\n"); } + while (!query("Is the new volume mounted and ready to go?")) + if (query("Do you want to abort?")) { + dumpabort(0); + /*NOTREACHED*/ + } + } + (void)time((time_t *)&(tend_changevol)); if ((tstart_changevol != (time_t)-1) && (tend_changevol != (time_t)-1)) tstart_writing += (tend_changevol - tstart_changevol); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message