From: Kern Sibbald Date: Mon, 3 Mar 2008 11:18:12 +0000 (+0000) Subject: Apply patch from Frank Kardel that implements 'honor no dump flag', X-Git-Tag: Release-7.0.0~4917 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=73562a8b5e32e10a3cff1d9f80bb6522c552528d;p=bacula%2Fbacula Apply patch from Frank Kardel that implements 'honor no dump flag', which causes the FD to detect whether or not the OS has the honor no dump bit (*BSD systems), and if so, to skip backing up any file with this bit set. The feature is enabled by setting 'honor no dump flag = yes' in the Options section of a FileSet git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6525 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/AUTHORS b/bacula/AUTHORS index e2eb11cc08..1d4b26752c 100644 --- a/bacula/AUTHORS +++ b/bacula/AUTHORS @@ -40,6 +40,7 @@ Eric Bollengier Erich Prinz Felix Schwarz Francisco Reyes +Frank Kardel Frank Sweetser Howard Thomson Jaime Ventura diff --git a/bacula/src/dird/dird_conf.h b/bacula/src/dird/dird_conf.h index f35890ff7f..0407cea6ac 100644 --- a/bacula/src/dird/dird_conf.h +++ b/bacula/src/dird/dird_conf.h @@ -428,7 +428,7 @@ public: inline char *JOB::name() const { return hdr.name; } #undef MAX_FOPTS -#define MAX_FOPTS 34 +#define MAX_FOPTS 40 /* File options structure */ struct FOPTS { diff --git a/bacula/src/dird/inc_conf.c b/bacula/src/dird/inc_conf.c index b7a52e1acc..62837e42bc 100644 --- a/bacula/src/dird/inc_conf.c +++ b/bacula/src/dird/inc_conf.c @@ -127,6 +127,7 @@ static RES_ITEM options_items[] = { {"drivetype", store_drivetype, {0}, 0, 0, 0}, {"checkfilechanges",store_opts, {0}, 0, 0, 0}, {"strippath", store_opts, {0}, 0, 0, 0}, + {"honornodumpflag", store_opts, {0}, 0, 0, 0}, {NULL, NULL, {0}, 0, 0, 0} }; @@ -155,7 +156,8 @@ enum { INC_KW_NOATIME, INC_KW_ENHANCEDWILD, INC_KW_CHKCHANGES, - INC_KW_STRIPPATH + INC_KW_STRIPPATH, + INC_KW_HONOR_NODUMP }; /* @@ -187,6 +189,7 @@ static struct s_kw FS_option_kw[] = { {"enhancedwild", INC_KW_ENHANCEDWILD}, {"checkfilechanges", INC_KW_CHKCHANGES}, {"strippath", INC_KW_STRIPPATH}, + {"honornodumpflag", INC_KW_HONOR_NODUMP}, {NULL, 0} }; @@ -254,6 +257,8 @@ static struct s_fs_opt FS_options[] = { {"no", INC_KW_ENHANCEDWILD, "0"}, {"yes", INC_KW_CHKCHANGES, "c"}, {"no", INC_KW_CHKCHANGES, "0"}, + {"yes", INC_KW_HONOR_NODUMP, "N"}, + {"no", INC_KW_HONOR_NODUMP, "0"}, {NULL, 0, 0} }; diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index ce5d8f09bc..db8d98dab9 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -1558,7 +1558,8 @@ int wait_cmd(UAContext *ua, const char *cmd) { JCR *jcr; - /* no args + /* + * no args * Wait until no job is running */ if (ua->argc == 1) { @@ -1626,7 +1627,7 @@ int wait_cmd(UAContext *ua, const char *cmd) } /* - * We wait the end of job + * We wait the end of a specific job */ bmicrosleep(0, 200000); /* let job actually start */ diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index c3ba64f6b4..f2f60bd35a 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -298,6 +298,22 @@ bail_out: return true; } +/* + * check for BSD nodump flag + */ +static bool no_dump(JCR *jcr, FF_PKT *ff_pkt) +{ +#if defined(HAVE_CHFLAGS) && defined(UF_NODUMP) + if ( (ff_pkt->flags & FO_HONOR_NODUMP) && + (ff_pkt->statp.st_flags & UF_NODUMP) ) { + Jmsg(jcr, M_INFO, 1, _(" NODUMP flag set - will not process %s\n"), + ff_pkt->fname); + return true; /* do not backup this file */ + } +#endif + return false; /* do backup */ +} + /* * Find all the requested files and send them * to the Storage daemon. @@ -533,10 +549,14 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) break; case FT_REGE: Dmsg1(130, "FT_REGE saving: %s\n", ff_pkt->fname); + if (no_dump(jcr, ff_pkt)) + return 1; has_file_data = true; break; case FT_REG: Dmsg1(130, "FT_REG saving: %s\n", ff_pkt->fname); + if (no_dump(jcr, ff_pkt)) + return 1; has_file_data = true; break; case FT_LNK: @@ -544,6 +564,8 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) break; case FT_DIRBEGIN: jcr->num_files_examined--; /* correct file count */ + if (no_dump(jcr, ff_pkt)) /* disable recursion on nodump directories */ + ff_pkt->flags |= FO_NO_RECURSION; return 1; /* not used */ case FT_NORECURSE: Jmsg(jcr, M_INFO, 1, _(" Recursion turned off. Will not descend from %s into %s\n"), diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 9e1f8d2de4..d8ee96eacc 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -1099,6 +1099,9 @@ static void set_options(findFOPTS *fo, const char *opts) case 'c': fo->flags |= FO_CHKCHANGES; break; + case 'N': + fo->flags |= FO_HONOR_NODUMP; + break; default: Emsg1(M_ERROR, 0, _("Unknown include/exclude option: %c\n"), *p); break; diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index 7a00819ee0..cbbbe6c63c 100644 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -108,6 +108,7 @@ enum { #define FO_ENHANCEDWILD (1<<23) /* Enhanced wild card processing */ #define FO_CHKCHANGES (1<<24) /* Check if file have been modified during backup */ #define FO_STRIPPATH (1<<25) /* Check for stripping path */ +#define FO_HONOR_NODUMP (1<<26) /* honor NODUMP flag */ struct s_included_file { struct s_included_file *next; diff --git a/bacula/src/version.h b/bacula/src/version.h index f133f9d0ec..563c1fa5d5 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "2.3.10" -#define BDATE "26 February 2008" -#define LSMDATE "26Feb08" +#define VERSION "2.3.11" +#define BDATE "03 March 2008" +#define LSMDATE "03Mar08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 73f260fe80..cf3617a214 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,12 @@ Technical notes on version 2.3 General: +03Mar08 +kes Apply patch from Frank Kardel that implements 'honor no dump flag', + which causes the FD to detect whether or not the OS has the + honor no dump bit (*BSD systems), and if so, to skip backing up + any file with this bit set. The feature is enabled by setting + 'honor no dump flag = yes' in the Options section of a FileSet. 28Feb08 kes Correct po warning message with datarootdir kes Implement more code in dird.c to put configuration parsing in