From: Kern Sibbald Date: Mon, 7 Jun 2004 10:49:02 +0000 (+0000) Subject: Zero Slot if cannot mount volume X-Git-Tag: Release-7.0.0~9380 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dbd24da039d5b0577b881c06ce1bb6c68e96a0a2;p=bacula%2Fbacula Zero Slot if cannot mount volume git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1385 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index 51fbf5960a..b4b2113438 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -48,6 +48,7 @@ For 1.33 Testing/Documentation: - Add regression of btape "fill" - Document if absolute path specified extension must be specified on Win32. +- Document vendor database repair. For version 1.35: - Do tape alerts -- see tapealert.txt diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index 7de73ada44..469d605510 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -474,8 +474,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev) * Slot for an autochanger, otherwise wait * for the operator to mount the media. */ - if ((jcr->VolumeName[0] && !dev_cap(dev, CAP_REM) && dev_cap(dev, CAP_LABEL)) || - (jcr->VolumeName[0] && jcr->VolCatInfo.Slot)) { + if ((!dev_cap(dev, CAP_REM) && dev_cap(dev, CAP_LABEL)) || jcr->VolCatInfo.Slot) { Dmsg0(100, "Return 1 from mount without wait.\n"); return 1; } diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index 60f428a2ce..f8c35fecb5 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -64,6 +64,8 @@ int autoload_device(JCR *jcr, DEVICE *dev, int writing, BSOCK *dir) } if (dir_find_next_appendable_volume(jcr)) { slot = jcr->VolCatInfo.Slot; + } else { + slot = 0; } } Dmsg1(400, "Want changer slot=%d\n", slot); diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 4effbc20d1..5d411b743e 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -59,16 +59,19 @@ int mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, int release */ mount_next_vol: /* Ignore retry if this is poll request */ - if (!dev->poll && retry++ > 8) { - Jmsg(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"), - dev_name(dev)); - return 0; + if (!dev->poll && retry++ > 4) { + /* Last ditch effort before giving up, force operator to respond */ + jcr->VolCatInfo.Slot = 0; + if (!dir_ask_sysop_to_mount_volume(jcr, dev)) { + Jmsg(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"), + dev_name(dev)); + return 0; + } } if (job_canceled(jcr)) { Jmsg(jcr, M_FATAL, 0, _("Job %d canceled.\n"), jcr->JobId); return 0; } - autochanger = false; /* Assume no autochanger */ recycle = false; if (release) { Dmsg0(100, "mount_next_volume release=1\n"); @@ -111,6 +114,10 @@ mount_next_vol: if (autoload_device(jcr, dev, 1, NULL) > 0) { autochanger = true; + ask = false; + } else { + autochanger = false; + jcr->VolCatInfo.Slot = 0; } Dmsg1(100, "autoload_dev returns %d\n", autochanger); /* @@ -119,7 +126,7 @@ mount_next_vol: * and read the label. If there is no tape in the drive, * we will err, recurse and ask the operator the next time. */ - if (autochanger || (!release && dev_is_tape(dev) && dev_cap(dev, CAP_AUTOMOUNT))) { + if (!release && dev_is_tape(dev) && dev_cap(dev, CAP_AUTOMOUNT)) { ask = false; /* don't ask SYSOP this time */ } Dmsg2(100, "Ask=%d autochanger=%d\n", ask, autochanger); @@ -292,22 +299,6 @@ read_volume: dev_name(dev), strerror_dev(dev)); goto mount_next_vol; } - /* - * We do not return the label in the block, because if we are - * running multiple simultaneous jobs, once we release the lock - * some other thread may write his block over the label. So, - * we simply write it definitively now. - */ -#ifdef needed - if (!rewind_dev(dev)) { - Jmsg2(jcr, M_ERROR, 0, _("Unable to rewind device %s. ERR=%s\n"), - dev_name(dev), strerror_dev(dev)); - goto mount_next_vol; - } - - /* Recreate a correct volume label and return it in the block */ - write_volume_label_to_block(jcr, dev, block); -#endif } /* Set or reset Volume statistics */ dev->VolCatInfo.VolCatJobs = 0; diff --git a/bacula/src/version.h b/bacula/src/version.h index aeb118554e..e6edb1b851 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -2,8 +2,8 @@ #undef VERSION #define VERSION "1.34.3" #define VSTRING "1" -#define BDATE "05 June 2004" -#define LSMDATE "05Jun04" +#define BDATE "06 June 2004" +#define LSMDATE "06Jun04" /* Debug flags */ #undef DEBUG