From 1c3b143abc2b9ad55a32121d675e3dc5339b9d27 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 21 May 2008 12:44:48 +0000 Subject: [PATCH] Display open() errors except when polling. Previously too many were suppressed. This should fix bug #1070. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@7002 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/autoprune.c | 2 +- bacula/src/stored/acquire.c | 10 ++++++++-- bacula/src/stored/dircmd.c | 15 +++++++++------ bacula/src/stored/label.c | 4 ++++ bacula/src/stored/mount.c | 2 +- bacula/technotes-2.1 | 4 +++- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/bacula/src/dird/autoprune.c b/bacula/src/dird/autoprune.c index 2b8e8cb91f..cc812c5cbb 100644 --- a/bacula/src/dird/autoprune.c +++ b/bacula/src/dird/autoprune.c @@ -96,7 +96,7 @@ bool prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr) POOL_MEM query(PM_MESSAGE); UAContext *ua; bool ok = false; - char ed1[50], ed2[100], ed3[50]; + char ed1[50], ed2[100]; POOL_DBR spr; Dmsg1(050, "Prune volumes PoolId=%d\n", jcr->jr.PoolId); diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index bf32057b9d..875560217b 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -219,8 +219,10 @@ bool acquire_device_for_read(DCR *dcr) */ Dmsg1(100, "bstored: open vol=%s\n", dcr->VolumeName); if (dev->open(dcr, OPEN_READ_ONLY) < 0) { - Jmsg3(jcr, M_WARNING, 0, _("Read open device %s Volume \"%s\" failed: ERR=%s\n"), - dev->print_name(), dcr->VolumeName, dev->bstrerror()); + if (!dev->poll) { + Jmsg3(jcr, M_WARNING, 0, _("Read open device %s Volume \"%s\" failed: ERR=%s\n"), + dev->print_name(), dcr->VolumeName, dev->bstrerror()); + } goto default_path; } Dmsg1(50, "opened dev %s OK\n", dev->print_name()); @@ -287,6 +289,10 @@ default_path: if (dev->open(dcr, OPEN_READ_ONLY) >= 0) { continue; } + if (!dev->poll) { + Jmsg3(jcr, M_WARNING, 0, _("Read open device %s Volume \"%s\" failed: ERR=%s\n"), + dev->print_name(), dcr->VolumeName, dev->bstrerror()); + } } /* Mount a specific volume and no other */ diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index ceac150446..a6208244e5 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -149,6 +149,7 @@ void *handle_connection_request(void *arg) bool found, quit; int bnet_stat = 0; char name[500]; + char tbuf[100]; if (bs->recv() <= 0) { Emsg0(M_ERROR, 0, _("Connection request failed.\n")); @@ -174,7 +175,8 @@ void *handle_connection_request(void *arg) Dmsg1(000, "msg); } if (sscanf(bs->msg, "Hello Start Job %127s", name) == 1) { - Dmsg0(110, "Got a FD connection\n"); + Dmsg1(110, "Got a FD connection at %s\n", bstrftimes(tbuf, sizeof(tbuf), + (utime_t)time(NULL))); handle_filed_connection(bs, name); return NULL; } @@ -182,7 +184,8 @@ void *handle_connection_request(void *arg) /* * This is a connection from the Director, so setup a JCR */ - Dmsg0(110, "Got a DIR connection\n"); + Dmsg1(110, "Got a DIR connection at %s\n", bstrftimes(tbuf, sizeof(tbuf), + (utime_t)time(NULL))); jcr = new_jcr(sizeof(JCR), stored_free_jcr); /* create Job Control Record */ jcr->dir_bsock = bs; /* save Director bsock */ jcr->dir_bsock->set_jcr(jcr); @@ -670,8 +673,8 @@ static bool mount_cmd(JCR *jcr) } /* We freed the device, so reopen it and wake any waiting threads */ if (dev->open(dcr, OPEN_READ_ONLY) < 0) { - dir->fsend(_("3901 open device failed: ERR=%s\n"), - dev->bstrerror()); + dir->fsend(_("3901 Unable to open device %s: ERR=%s\n"), + dev->print_name(), dev->bstrerror()); if (dev->blocked() == BST_UNMOUNTED) { /* We blocked the device, so unblock it */ Dmsg0(100, "Unmounted. Unblocking device\n"); @@ -727,8 +730,8 @@ static bool mount_cmd(JCR *jcr) } } else if (dev->is_tape()) { if (dev->open(dcr, OPEN_READ_ONLY) < 0) { - dir->fsend(_("3901 open device failed: ERR=%s\n"), - dev->bstrerror()); + dir->fsend(_("3901 Unable to open device %s: ERR=%s\n"), + dev->print_name(), dev->bstrerror()); break; } read_label(dcr); diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 3d791f4fb0..db38527539 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -339,6 +339,8 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, if (dev->open(dcr, OPEN_READ_WRITE) < 0) { /* If device is not tape, attempt to create it */ if (dev->is_tape() || dev->open(dcr, CREATE_READ_WRITE) < 0) { + Jmsg3(dcr->jcr, M_WARNING, 0, _("Open device %s Volume \"%s\" failed: ERR=%s\n"), + dev->print_name(), dcr->VolumeName, dev->bstrerror()); goto bail_out; } } @@ -435,6 +437,8 @@ bool rewrite_volume_label(DCR *dcr, bool recycle) JCR *jcr = dcr->jcr; if (dev->open(dcr, OPEN_READ_WRITE) < 0) { + Jmsg3(jcr, M_WARNING, 0, _("Open device %s Volume \"%s\" failed: ERR=%s\n"), + dev->print_name(), dcr->VolumeName, dev->bstrerror()); return false; } Dmsg2(190, "set append found freshly labeled volume. fd=%d dev=%x\n", dev->fd(), dev); diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 6e5e1ff3fa..2f292de209 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -227,7 +227,7 @@ mount_next_vol: } /* If DVD, ignore the error, very often you cannot open the device * (when there is no DVD, or when the one inserted is a wrong one) */ - if (dev->poll || dev->is_dvd() || dev->is_removable()) { + if (dev->poll || dev->is_dvd()) { goto mount_next_vol; } else { Jmsg(jcr, M_ERROR, 0, _("Could not open device %s: ERR=%s\n"), diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 849ec4bbfe..6f3a1374e9 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -3,12 +3,14 @@ General: 21May08 +kes Display open() errors except when polling. Previously too + many were suppressed. This should fix bug #1070. kes Fix Win32 reparse points. Bacula will not recurse into any reparse point directory, including mount points, unless the directory is explicitly mentioned at the top level (same as with Unix). A file that is linked to another file will be backed up -- much as Unix does for hardlinked files. - This *should* fix bug #1041. + This fixes bug #1041. 20May08 kes Remove double quotes from ChangeLog and ReleaseNotes kes Remove StorageId test when pruning and recycling (Eric's changes). -- 2.39.5