Skip to content
Permalink
Browse files

xattr: log a warning message when xattributes are not supported

- treat unsupported extended attributes as warning
- if extended attributes are not supported by the underlying operating
  system only raise a job warning, so the job keeps on running
- raise a job error message directly, not after 25 errors as it was before
- suppress source file information in the joblog
- renamed enum class members of BxattrExitCode
  • Loading branch information...
franku committed Jan 31, 2019
1 parent 980a5b1 commit ec7929cda306e76bf3d8e32a57af8f61636b4345
@@ -456,14 +456,7 @@ static inline bool DoBackupAcl(JobControlRecord *jcr, FindFilesPacket *ff_pkt)
case bacl_exit_fatal:
return false;
case bacl_exit_error:
/*
* Non-fatal errors, count them and when the number is under
* ACL_REPORT_ERR_MAX_PER_JOB print the error message set by the
* lower level routine in jcr->errmsg.
*/
if (jcr->acl_data->u.build->nr_errors < ACL_REPORT_ERR_MAX_PER_JOB) {
Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
}
Jmsg(jcr, M_ERROR, 0, "%s", jcr->errmsg);
jcr->acl_data->u.build->nr_errors++;
break;
case bacl_exit_ok:
@@ -475,7 +468,7 @@ static inline bool DoBackupAcl(JobControlRecord *jcr, FindFilesPacket *ff_pkt)

static inline bool DoBackupXattr(JobControlRecord *jcr, FindFilesPacket *ff_pkt)
{
bxattr_exit_code retval;
BxattrExitCode retval;

jcr->xattr_data->last_fname = jcr->last_fname;

@@ -486,20 +479,16 @@ static inline bool DoBackupXattr(JobControlRecord *jcr, FindFilesPacket *ff_pkt)
}

switch (retval) {
case bxattr_exit_fatal:
case BxattrExitCode::kErrorFatal:
return false;
case bxattr_exit_error:
/*
* Non-fatal errors, count them and when the number is under
* XATTR_REPORT_ERR_MAX_PER_JOB print the error message set by the
* lower level routine in jcr->errmsg.
*/
if (jcr->xattr_data->u.build->nr_errors < XATTR_REPORT_ERR_MAX_PER_JOB) {
Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
}
case BxattrExitCode::kWarning:
Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
break;
case BxattrExitCode::kError:
Jmsg(jcr, M_ERROR, 0, "%s", jcr->errmsg);
jcr->xattr_data->u.build->nr_errors++;
break;
case bxattr_exit_ok:
case BxattrExitCode::kSuccess:
break;
}

@@ -2339,8 +2339,11 @@ static bool RestoreCmd(JobControlRecord *jcr)
DoRestore(jcr);
StopDirHeartbeat(jcr);

jcr->setJobStatus(JS_Terminated);
if (!jcr->is_JobStatus(JS_Terminated)) { BnetSuppressErrorMessages(sd, 1); }
if (jcr->JobWarnings) {
jcr->setJobStatus(JS_Warnings);
} else {
jcr->setJobStatus(JS_Terminated);
}

/**
* Send Close session command to Storage daemon
@@ -1439,25 +1439,25 @@ bacl_exit_code plugin_parse_acl_streams(JobControlRecord *jcr,
/**
* Plugin specific callback for getting XATTR information.
*/
bxattr_exit_code PluginBuildXattrStreams(JobControlRecord *jcr,
BxattrExitCode PluginBuildXattrStreams(JobControlRecord *jcr,
struct xattr_data_t *xattr_data,
FindFilesPacket *ff_pkt)
{
Plugin *plugin;
#if defined(HAVE_XATTR)
alist *xattr_value_list = NULL;
#endif
bxattr_exit_code retval = bxattr_exit_error;
BxattrExitCode retval = BxattrExitCode::kError;

Dmsg0(debuglevel, "PluginBuildXattrStreams\n");

if (!jcr->plugin_ctx) {
return bxattr_exit_ok;
return BxattrExitCode::kSuccess;
}
plugin = (Plugin *)jcr->plugin_ctx->plugin;

if (PlugFunc(plugin)->getXattr == NULL) {
return bxattr_exit_ok;
return BxattrExitCode::kSuccess;
} else {
#if defined(HAVE_XATTR)
bool more;
@@ -1554,7 +1554,7 @@ bxattr_exit_code PluginBuildXattrStreams(JobControlRecord *jcr,
*/
retval = SendXattrStream(jcr, xattr_data, STREAM_XATTR_PLUGIN);
} else {
retval = bxattr_exit_ok;
retval = BxattrExitCode::kSuccess;
}
#endif
}
@@ -1572,7 +1572,7 @@ bxattr_exit_code PluginBuildXattrStreams(JobControlRecord *jcr,
/**
* Plugin specific callback for setting XATTR information.
*/
bxattr_exit_code PluginParseXattrStreams(JobControlRecord *jcr,
BxattrExitCode PluginParseXattrStreams(JobControlRecord *jcr,
struct xattr_data_t *xattr_data,
int stream,
char *content,
@@ -1582,12 +1582,12 @@ bxattr_exit_code PluginParseXattrStreams(JobControlRecord *jcr,
Plugin *plugin;
alist *xattr_value_list = NULL;
#endif
bxattr_exit_code retval = bxattr_exit_error;
BxattrExitCode retval = BxattrExitCode::kError;

Dmsg0(debuglevel, "PluginParseXattrStreams\n");

if (!jcr->plugin_ctx) {
return bxattr_exit_ok;
return BxattrExitCode::kSuccess;
}

#if defined(HAVE_XATTR)
@@ -1602,7 +1602,7 @@ bxattr_exit_code PluginParseXattrStreams(JobControlRecord *jcr,
xattr_data,
content,
content_length,
xattr_value_list) != bxattr_exit_ok) {
xattr_value_list) != BxattrExitCode::kSuccess) {
goto bail_out;
}

@@ -1624,7 +1624,7 @@ bxattr_exit_code PluginParseXattrStreams(JobControlRecord *jcr,
}
}

retval = bxattr_exit_ok;
retval = BxattrExitCode::kSuccess;
}

bail_out:
@@ -269,9 +269,9 @@ bool PluginSetAttributes(JobControlRecord *jcr, Attributes *attr, BareosWinFileP
bacl_exit_code PluginBuildAclStreams(JobControlRecord *jcr, acl_data_t *acl_data, FindFilesPacket *ff_pkt);
bacl_exit_code plugin_parse_acl_streams(JobControlRecord *jcr, acl_data_t *acl_data, int stream,
char *content, uint32_t content_length);
bxattr_exit_code PluginBuildXattrStreams(JobControlRecord *jcr, struct xattr_data_t *xattr_data,
BxattrExitCode PluginBuildXattrStreams(JobControlRecord *jcr, struct xattr_data_t *xattr_data,
FindFilesPacket *ff_pkt);
bxattr_exit_code PluginParseXattrStreams(JobControlRecord *jcr, struct xattr_data_t *xattr_data,
BxattrExitCode PluginParseXattrStreams(JobControlRecord *jcr, struct xattr_data_t *xattr_data,
int stream, char *content, uint32_t content_length);
int PluginSave(JobControlRecord *jcr, FindFilesPacket *ff_pkt, bool top_level);
int PluginEstimate(JobControlRecord *jcr, FindFilesPacket *ff_pkt, bool top_level);
@@ -254,7 +254,7 @@ static inline bool do_restore_xattr(JobControlRecord *jcr,
char *content,
uint32_t content_length)
{
bxattr_exit_code retval;
BxattrExitCode retval;

jcr->xattr_data->last_fname = jcr->last_fname;
switch (stream) {
@@ -267,19 +267,16 @@ static inline bool do_restore_xattr(JobControlRecord *jcr,
}

switch (retval) {
case bxattr_exit_fatal:
case BxattrExitCode::kErrorFatal:
return false;
case bxattr_exit_error:
/*
* Non-fatal errors, count them and when the number is under XATTR_REPORT_ERR_MAX_PER_JOB
* print the error message set by the lower level routine in jcr->errmsg.
*/
if (jcr->xattr_data->u.parse->nr_errors < XATTR_REPORT_ERR_MAX_PER_JOB) {
Jmsg(jcr, M_ERROR, 0, "%s", jcr->errmsg);
}
case BxattrExitCode::kWarning:
Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
break;
case BxattrExitCode::kError:
Jmsg(jcr, M_ERROR, 0, "%s", jcr->errmsg);
jcr->xattr_data->u.parse->nr_errors++;
break;
case bxattr_exit_ok:
case BxattrExitCode::kSuccess:
break;
}

Oops, something went wrong.

0 comments on commit ec7929c

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.