chmod 770 $(DESTDIR)$(working_dir); \
fi
-if test "x$(dir_user)" != "x" ; then \
- chown -f $(dir_user) $(DESTDIR)$(working_dir); \
+ chown $(dir_user) $(DESTDIR)$(working_dir); \
fi
-if test "x$(dir_group)" != "x" ; then \
- chown -f :$(dir_group) $(DESTDIR)$(working_dir); \
+ chgrp $(dir_group) $(DESTDIR)$(working_dir); \
fi
# $(MKDIR) $(DESTDIR)$(mandir)
Kern Sibbald
General:
+18Apr06
+- Remove the -f option from the chown in Makefile.in for more
+ portability.
+- Change setting the group in Makefile.in to use chgrp for
+ more portability.
+- Implement a write_store and read_store to replace
+ dirstore in reserve.c
+- Implement a Bacula read/write lock for Python rather
+ than using the Python lock to avoid recursive problems.
+- Correct the uninstall directory names in filed/Makefile.in
+ as reported by a user.
17Apr06
- Correct some problems with database creation (new tables).
- Replace a bunch of old 0x%x by %p.
const int nmatch = 30;
regmatch_t pmatch[nmatch];
if (last_item) {
- free(last_item->item);
Dmsg1(000, "Remove item %s\n", last_item->item);
+ free(last_item->item);
item_chain->remove(last_item);
}
Dmsg1(000, "Jobitem=%s\n", item->item);
return NULL;
}
/* Release lock due to recursion */
- PyEval_ReleaseLock();
+// PyEval_ReleaseLock();
jcr = get_jcr_from_PyObject(self);
UAContext *ua = new_ua_context(jcr);
ua->batch = true;
parse_ua_args(ua); /* parse command */
stat = run_cmd(ua, ua->cmd);
free_ua_context(ua);
- PyEval_AcquireLock();
+// PyEval_AcquireLock();
return PyInt_FromLong((long)stat);
}
/* ***FIXME*** raise exception */
return NULL;
}
- PyEval_ReleaseLock();
+// PyEval_ReleaseLock();
UAContext *ua = new_ua_context(jcr);
ua->batch = true;
if (!cancel_job(ua, jcr)) {
}
free_ua_context(ua);
free_jcr(jcr);
- PyEval_AcquireLock();
+// PyEval_AcquireLock();
Py_INCREF(Py_None);
return Py_None;
}
return 0;
}
- PyEval_AcquireLock();
+ lock_python();
+// PyEval_AcquireLock();
method = find_method(events, method, event);
if (!method) {
Py_XDECREF(result);
bail_out:
- PyEval_ReleaseLock();
+ unlock_python();
+// PyEval_ReleaseLock();
return stat;
}
uninstall:
(cd $(DESTDIR)$(sbindir); $(RMF) bacula-fd)
- (cd $(DESTDIR)$(sbindir); $(RMF) bacula-fd.conf)
- (cd $(DESTDIR)$(sbindir); $(RMF) bacula-fd.conf.new)
+ (cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-fd.conf)
+ (cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-fd.conf.new)
* Version $Id$
*
*/
-
/*
Copyright (C) 2005-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
return 0;
}
- PyEval_AcquireLock();
+ lock_python();
+// PyEval_AcquireLock();
method = find_method(events, method, event);
if (!method) {
Py_XDECREF(result);
bail_out:
- PyEval_ReleaseLock();
+ unlock_python();
+// PyEval_ReleaseLock();
return stat;
}
bool spool_data; /* set to spool data */
int CurVol; /* Current Volume count */
DIRRES* director; /* Director resource */
- alist *dirstore; /* list of storage devices sent by DIR */
+ alist *write_store; /* list of write storage devices sent by DIR */
+ alist *read_store; /* list of read devices sent by DIR */
alist *reserve_msgs; /* reserve fail messages */
bool write_part_after_job; /* Set to write part after job */
bool PreferMountedVols; /* Prefer mounted vols rather than new */
void term_python_interpreter();
//extern EVENT_HANDLER *generate_daemon_event;
int generate_daemon_event(JCR *jcr, const char *event);
+void lock_python();
+void unlock_python();
/* signal.c */
void init_signals (void terminate(int sig));
*
*/
/*
- Copyright (C) 2004-2005 Kern Sibbald
+ Copyright (C) 2004-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#undef _POSIX_C_SOURCE
#include <Python.h>
+/* Forward referenced subroutines */
+static void init_python_lock();
+static void term_python_lock();
+void lock_python();
+void unlock_python();
+
extern char *configfile;
/* Imported subroutines */
}
}
PyEval_ReleaseLock();
+ init_python_lock();
}
Py_XDECREF(StartUp_module);
Py_Finalize();
}
+ term_python_lock();
}
static PyObject *set_bacula_events(PyObject *self, PyObject *args)
}
Dmsg1(100, "event=%s\n", event);
- PyEval_AcquireLock();
+ lock_python();
+// PyEval_AcquireLock();
if (strcmp(event, "JobStart") == 0) {
if (!JobStart_method) {
stat = 0;
/* Fall through */
jobstart_ok:
Py_XDECREF(result);
- PyEval_ReleaseLock();
+ unlock_python();
+// PyEval_ReleaseLock();
return stat;
}
+static brwlock_t python_rwlock;
+
+static void init_python_lock()
+{
+ int errstat;
+ if ((errstat=rwl_init(&python_rwlock)) != 0) {
+ berrno be;
+ Emsg1(M_ABORT, 0, _("Unable to initialize the Python lock. ERR=%s\n"),
+ be.strerror(errstat));
+ }
+
+}
+
+static void term_python_lock()
+{
+ rwl_destroy(&python_rwlock);
+}
+
+/* This applies to a drive and to Volumes */
+void lock_python()
+{
+ int errstat;
+ if ((errstat=rwl_writelock(&python_rwlock)) != 0) {
+ berrno be;
+ Emsg2(M_ABORT, 0, "Python rwl_writelock failure. stat=%d: ERR=%s\n",
+ errstat, be.strerror(errstat));
+ }
+}
+
+void unlock_python()
+{
+ int errstat;
+ if ((errstat=rwl_writeunlock(&python_rwlock)) != 0) {
+ berrno be;
+ Emsg2(M_ABORT, 0, "Python rwl_writeunlock failure. stat=%d: ERR=%s\n",
+ errstat, be.strerror(errstat));
+ }
+}
+
+
#else
/*
*/
void stored_free_jcr(JCR *jcr)
{
+ Dmsg1(900, "stored_free_jcr JobId=%u\n", jcr->JobId);
if (jcr->file_bsock) {
bnet_close(jcr->file_bsock);
jcr->file_bsock = NULL;
free_dcr(jcr->read_dcr);
jcr->read_dcr = NULL;
}
- if (jcr->dirstore) {
+
+ if (jcr->read_store) {
DIRSTORE *store;
- foreach_alist(store, jcr->dirstore) {
+ foreach_alist(store, jcr->read_store) {
delete store->device;
delete store;
}
- delete jcr->dirstore;
- jcr->dirstore = NULL;
+ delete jcr->read_store;
+ jcr->read_store = NULL;
}
+ if (jcr->write_store) {
+ DIRSTORE *store;
+ foreach_alist(store, jcr->write_store) {
+ delete store->device;
+ delete store;
+ }
+ delete jcr->write_store;
+ jcr->write_store = NULL;
+ }
+
return;
}
* Version $Id$
*
*/
-
/*
- Copyright (C) 2005 Kern Sibbald
+ Copyright (C) 2005-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
+
#include "bacula.h"
#include "stored.h"
return 0;
}
- PyEval_AcquireLock();
+ lock_python();
+// PyEval_AcquireLock();
method = find_method(events, method, event);
if (!method) {
Py_XDECREF(result);
bail_out:
- PyEval_ReleaseLock();
+ unlock_python();
+// PyEval_ReleaseLock();
return stat;
}
RCTX rctx;
char *msg;
alist *msgs;
+ alist *dirstore;
memset(&rctx, 0, sizeof(RCTX));
rctx.jcr = jcr;
* If there are multiple devices, the director sends us
* use_device for each device that it wants to use.
*/
- jcr->dirstore = New(alist(10, not_owned_by_alist));
+ dirstore = New(alist(10, not_owned_by_alist));
+// Dmsg2(000, "dirstore=%p JobId=%u\n", dirstore, jcr->JobId);
msgs = jcr->reserve_msgs = New(alist(10, not_owned_by_alist));
do {
Dmsg1(100, "<dird: %s", dir->msg);
if (!ok) {
break;
}
+ if (append) {
+ jcr->write_store = dirstore;
+ } else {
+ jcr->read_store = dirstore;
+ }
+ rctx.append = append;
unbash_spaces(store_name);
unbash_spaces(media_type);
unbash_spaces(pool_name);
unbash_spaces(pool_type);
store = new DIRSTORE;
- jcr->dirstore->append(store);
+ dirstore->append(store);
memset(store, 0, sizeof(DIRSTORE));
store->device = New(alist(10));
bstrncpy(store->name, store_name, sizeof(store->name));
/* This loop is debug code and can be removed */
/* ***FIXME**** remove after 1.38 release */
char *device_name;
- foreach_alist(store, jcr->dirstore) {
+ foreach_alist(store, dirstore) {
Dmsg5(110, "Storage=%s media_type=%s pool=%s pool_type=%s append=%d\n",
store->name, store->media_type, store->pool_name,
store->pool_type, store->append);
bool ok;
DIRSTORE *store;
char *device_name;
+ alist *dirstore;
+ if (rctx.append) {
+ dirstore = jcr->write_store;
+ } else {
+ dirstore = jcr->read_store;
+ }
/*
* For each storage device that the user specified, we
* search and see if there is a resource for that device.
rctx.PreferMountedVols, rctx.exact_match, rctx.suitable_device,
rctx.autochanger_only);
ok = false;
- foreach_alist(store, jcr->dirstore) {
+ foreach_alist(store, dirstore) {
rctx.store = store;
foreach_alist(device_name, store->device) {
int stat;
bool suitable_device; /* at least one device is suitable */
bool autochanger_only; /* look at autochangers only */
bool notify_dir; /* Notify DIR about device */
+ bool append; /* set if append device */
char VolumeName[MAX_NAME_LENGTH]; /* Vol name suggested by DIR */
};
*/
#undef VERSION
-#define VERSION "1.39.8"
-#define BDATE "16 April 2006"
-#define LSMDATE "16Apr06"
+#define VERSION "1.39.9"
+#define BDATE "18 April 2006"
+#define LSMDATE "18Apr06"
/* Debug flags */
#undef DEBUG