Skip to content

Commit

Permalink
Merge branch 'bareos-15.2'
Browse files Browse the repository at this point in the history
Conflicts:
	src/filed/authenticate.c
	src/filed/dir_cmd.c
  • Loading branch information
joergsteffens committed May 19, 2016
2 parents c30a177 + bcdd2b1 commit d313ee8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/filed/dir_cmd.c
Expand Up @@ -547,6 +547,7 @@ void *process_director_commands(JCR *jcr, BSOCK *dir)
Dmsg1(110, "End FD msg: %s\n", dir->msg);
}

bail_out:
generate_plugin_event(jcr, bEventJobEnd);

dequeue_messages(jcr); /* send any queued messages */
Expand Down
11 changes: 8 additions & 3 deletions src/filed/status.c
Expand Up @@ -178,9 +178,7 @@ static void list_running_jobs_plain(STATUS_PKT *sp)

foreach_jcr(njcr) {
bstrftime_nc(dt, sizeof(dt), njcr->start_time);
if (njcr->JobId == 0) {
len = Mmsg(msg, _("Director connected at: %s\n"), dt);
} else {
if (njcr->JobId > 0) {
len = Mmsg(msg, _("JobId %d Job %s is running.\n"),
njcr->JobId, njcr->Job);
sendit(msg, len, sp);
Expand All @@ -194,6 +192,13 @@ static void list_running_jobs_plain(STATUS_PKT *sp)
level_to_str(njcr->getJobLevel()),
job_type_to_str(njcr->getJobType()), dt);
#endif
} else if ((njcr->JobId == 0) && (njcr->director)) {
len = Mmsg(msg, _("%s (director) connected at: %s\n"), njcr->director->name(), dt);
} else {
/*
* This should not occur shortly, until the JCR values are set.
*/
len = Mmsg(msg, _("Unknown connection, started at: %s\n"), dt);
}
sendit(msg, len, sp);
if (njcr->JobId == 0) {
Expand Down
11 changes: 8 additions & 3 deletions src/lmdb/mdb.c
Expand Up @@ -7476,8 +7476,13 @@ mdb_cursor_put(MDB_cursor *mc, MDB_val *key, MDB_val *data,
/* Note - this page is already counted in parent's dirty_room */
rc2 = mdb_mid2l_insert(mc->mc_txn->mt_u.dirty_list, &id2);
mdb_cassert(mc, rc2 == 0);
/* Currently we make the page look as with put() in the
* parent txn, in case the user peeks at MDB_RESERVEd
* or unused parts. Some users treat ovpages specially.
*/
if (!(flags & MDB_RESERVE)) {
/* Copy end of page, adjusting alignment so
/* Skip the part where LMDB will put *data.
* Copy end of page, adjusting alignment so
* compiler may copy words instead of bytes.
*/
off = (PAGEHDRSZ + data->mv_size) & -sizeof(size_t);
Expand Down Expand Up @@ -9735,7 +9740,7 @@ mdb_env_cthr_toggle(mdb_copy *my, int st)
static int ESECT
mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags)
{
MDB_cursor mc;
MDB_cursor mc = {0};
MDB_node *ni;
MDB_page *mo, *mp, *leaf;
char *buf, *ptr;
Expand All @@ -9747,8 +9752,8 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags)
return MDB_SUCCESS;

mc.mc_snum = 1;
mc.mc_top = 0;
mc.mc_txn = my->mc_txn;
mc.mc_flags = my->mc_txn->mt_flags & (C_ORIG_RDONLY|C_WRITEMAP);

rc = mdb_page_get(&mc, *pg, &mc.mc_pg[0], NULL);
if (rc)
Expand Down
56 changes: 48 additions & 8 deletions src/plugins/filed/rados-fd.c
Expand Up @@ -576,7 +576,7 @@ static inline void set_string(char **destination, char *value)
*
* The definition is in this form:
*
* rados:
* rados:conffile=<ceph_conf_file>:namespace=<name_space>:clientid=<client_id>:clustername=<clustername>:username=<username>:snapshotname=<snapshot_name>:
*/
static bRC parse_plugin_definition(bpContext *ctx, void *value)
{
Expand Down Expand Up @@ -1026,19 +1026,34 @@ static bRC endRestoreFile(bpContext *ctx)
*/
static bRC createFile(bpContext *ctx, struct restore_pkt *rp)
{
char *bp;
int status;
bool exists = false;
plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;

if (!p_ctx) {
return bRC_Error;
}

status = rados_stat(p_ctx->ioctx, rp->ofname,
&p_ctx->object_size, &p_ctx->object_mtime);
/*
* Filename is in the form <pool_name>/<object_name>
*/
pm_strcpy(p_ctx->next_filename, rp->ofname);
bp = strrchr(p_ctx->next_filename, '/');
if (!bp) {
rp->create_status = CF_SKIP;
goto bail_out;
}
p_ctx->object_name = ++bp;

rp->create_status = CF_EXTRACT;

status = rados_stat(p_ctx->ioctx, p_ctx->object_name, &p_ctx->object_size, &p_ctx->object_mtime);
if (status < 0) {
rp->create_status = CF_EXTRACT;
return bRC_OK;
goto bail_out;
} else {
exists = true;

switch (rp->replace) {
case REPLACE_IFNEWER:
if (rp->statp.st_mtime <= p_ctx->object_mtime) {
Expand All @@ -1063,7 +1078,31 @@ static bRC createFile(bpContext *ctx, struct restore_pkt *rp)
}
}

rp->create_status = CF_EXTRACT;
switch (rp->type) {
case FT_REG: /* Regular file */
/*
* See if object already exists then we need to unlink it.
*/
if (exists) {
status = rados_remove(p_ctx->ioctx, p_ctx->object_name);
if (status < 0) {
berrno be;

Jmsg(ctx, M_ERROR, "rados-fd: rados_remove(%s) failed: %s\n",
p_ctx->object_name, be.bstrerror(-status));
goto bail_out;
}
}
break;
case FT_DELETED:
Jmsg(ctx, M_INFO, 0, _("rados-fd: Original file %s have been deleted: type=%d\n"), rp->ofname, rp->type);
rp->create_status = CF_SKIP;
break;
default:
Jmsg(ctx, M_ERROR, 0, _("rados-fd: Unknown file type %d; not restored: %s\n"), rp->type, rp->ofname);
rp->create_status = CF_ERROR;
break;
}

bail_out:
return bRC_OK;
Expand Down Expand Up @@ -1165,11 +1204,12 @@ static bRC setXattr(bpContext *ctx, xattr_pkt *xp)
}

bp = strrchr(xp->fname, '/');
if (!bp++) {
if (!bp) {
goto bail_out;
}

status = rados_setxattr(p_ctx->ioctx, bp, xp->name, xp->value, xp->value_length);
p_ctx->object_name = ++bp;
status = rados_setxattr(p_ctx->ioctx, p_ctx->object_name, xp->name, xp->value, xp->value_length);
if (status < 0) {
berrno be;

Expand Down

0 comments on commit d313ee8

Please sign in to comment.