From bb799ad1cfb97f28825a40d074c89f7f981f97b9 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 12 Jun 2009 19:00:50 +0000 Subject: [PATCH] Create patch that may fix bug #1298 and bug #1304, which causes an SD crash after canceling a job. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8893 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/askdir.c | 3 +++ bacula/src/stored/block.c | 6 ++++++ bacula/src/stored/reserve.c | 6 ++++++ bacula/src/stored/spool.c | 3 +++ bacula/src/stored/vol_mgr.c | 6 ++++++ bacula/technotes | 3 +++ 6 files changed, 27 insertions(+) diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index 0066636412..37d33bdeff 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -494,6 +494,9 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr) JCR *jcr = dcr->jcr; bool got_vol = false; + if (job_canceled(jcr)) { + return false; + } Dmsg0(400, "enter dir_ask_sysop_to_create_appendable_volume\n"); ASSERT(dev->blocked()); for ( ;; ) { diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 3980328f03..117122919f 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -415,6 +415,9 @@ bool write_block_to_dev(DCR *dcr) empty_block(block); return true; #endif + if (job_canceled(jcr)) { + return false; + } ASSERT(block->binbuf == ((uint32_t) (block->bufp - block->buf))); ASSERT(dev->is_open()); @@ -935,6 +938,9 @@ bool read_block_from_dev(DCR *dcr, bool check_block_numbers) DEVICE *dev = dcr->dev; DEV_BLOCK *block = dcr->block; + if (job_canceled(jcr)) { + return false; + } ASSERT(dev->is_open()); if (dev->at_eot()) { diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 67e42be464..c2377d8f0d 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -755,6 +755,9 @@ static bool reserve_device_for_read(DCR *dcr) bool ok = false; ASSERT(dcr); + if (job_canceled(jcr)) { + return false; + } dev->dlock(); @@ -809,6 +812,9 @@ static bool reserve_device_for_append(DCR *dcr, RCTX &rctx) bool ok = false; ASSERT(dcr); + if (job_canceled(jcr)) { + return false; + } dev->dlock(); diff --git a/bacula/src/stored/spool.c b/bacula/src/stored/spool.c index 21212c53bf..6bff7b5969 100644 --- a/bacula/src/stored/spool.c +++ b/bacula/src/stored/spool.c @@ -436,6 +436,9 @@ bool write_block_to_spool_file(DCR *dcr) bool despool = false; DEV_BLOCK *block = dcr->block; + if (job_canceled(dcr->jcr)) { + return false; + } ASSERT(block->binbuf == ((uint32_t) (block->bufp - block->buf))); if (block->binbuf <= WRITE_BLKHDR_LENGTH) { /* Does block have data in it? */ return true; diff --git a/bacula/src/stored/vol_mgr.c b/bacula/src/stored/vol_mgr.c index 4e239fcd7c..0d6b088912 100644 --- a/bacula/src/stored/vol_mgr.c +++ b/bacula/src/stored/vol_mgr.c @@ -344,6 +344,9 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) VOLRES *vol, *nvol; DEVICE * volatile dev = dcr->dev; + if (job_canceled(dcr->jcr)) { + return NULL; + } ASSERT(dev != NULL); Dmsg2(dbglvl, "enter reserve_volume=%s drive=%s\n", VolumeName, @@ -701,6 +704,9 @@ bool DCR::can_i_use_volume() bool rtn = true; VOLRES *vol; + if (job_canceled(jcr)) { + return false; + } lock_volumes(); vol = find_volume(VolumeName); if (!vol) { diff --git a/bacula/technotes b/bacula/technotes index 535f7e6440..ed33d20060 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -2,6 +2,9 @@ General: +12Jun09 +kes Create patch that may fix bug #1298 and bug #1304, which causes + an SD crash after canceling a job. 08Jun09 kes Attempt to get bat conf file installation to work with DESTDIR 05uun09 -- 2.39.5