Amanda-Users

Re: Reiserfs?

2005-01-27 04:59:13
Subject: Re: Reiserfs?
From: Paul Bijnens <paul.bijnens AT xplanation DOT com>
To: amanda-users AT amanda DOT org
Date: Thu, 27 Jan 2005 10:53:23 +0100
Jon LaBadie wrote:
On Wed, Jan 26, 2005 at 03:51:33PM +0100, Paul Bijnens wrote:

Jon LaBadie wrote:

It has been a couple of years since I looked at tar,
but IIRC two things that give a return code of 2 are
 "file changed as we backed it up"
 "file disappeared after we made the list of what to backup"

These conditions are common on active file systems.
Both cause the error message
 "error exit delayed from previous errors"

which is a return code of 2.

Consulting sources of gnutar 1.13.25:
"file changed..." would set exit(2) but is neutralized
when given the --ignore-failed-read option to tar.



I believe you are correct on a "failed read", i.e. permissions
type changes, but I don't think "file changed ..."is affected
by the --ignore-failed-read option.  I think it still prints
the message, and exits 2 with the "error exit delayed" message.

I *did* consult the source :-)  :

Here are some checks when dumping a file:

tar-1.13.15/src/misc.c:

  # an IO error while reading a file
   1378           count = safe_read (f, start->buffer, bufsize);
   1379         if (count < 0)
   1380           {
   1381             (ignore_failed_read_option
   1382              ? read_warn_details
   1383              : read_error_details)
   1384               (p, current_stat.st_size - sizeleft, bufsize);
   1385             goto padit;
   1386           }
   ...
  # file shrank while reading
   1394         if (count != bufsize)
   1395           {
   1396             char buf[UINTMAX_STRSIZE_BOUND];
   1397             memset (start->buffer + count, 0, bufsize - count);
   1398             WARN ((0, 0,
1399 _("%s: File shrank by %s bytes; padding with zeros"),
   1400                quotearg_colon (p),
   1401                STRINGIFY_BIGINT (sizeleft, buf)));
   1402             if (! ignore_failed_read_option)
   1403               exit_status = TAREXIT_FAILURE;
   1404             goto padit;     /* short read */
   1405           }
 ...
 # when at end of file, it can be disappeared already
   1414           if (fstat (f, &final_stat) != 0)
   1415         {
   1416           if (ignore_failed_read_option)
   1417             stat_warn (p);
   1418           else
   1419             stat_error (p);
   1420         }
 # ctime changed: someone wrote to it, or chmod it etc
   1421           else if (final_stat.st_ctime != original_ctime)
   1422         {
   1423           char const *qp = quotearg_colon (p);
   1424           WARN ((0, 0, _("%s: file changed as we read it"), qp));
   1425           if (! ignore_failed_read_option)
   1426             exit_status = TAREXIT_FAILURE;
   1427         }
 # even an IO error detected while closing
   1428           if (close (f) != 0)
   1429         {
   1430           if (ignore_failed_read_option)
   1431             close_warn (p);
   1432           else
   1433             close_error (p);
   1434         }

In 1.15.1 the code is rearranged -- looks clearer -- but still does
the same.

As far as I can see in the sources, the --ignore-failed-read
option really avoids exit with a failure for all errors
involved on the reading side.


Sources of gnutar 1.15.1:
"file changed...." is never triggering an exit-code different
from zero  (but warning is printed nevertheless).
"file shrank ..." however still needs --ignore-failed-read flag
to be neutralized.


Looks like the RE's ignored need to be revisited.


The "file disappeared..." is diagnosed as
"Warning: Cannot stat: No such file or directory", and that
one neither sets a exitcode different from zero (in 1.13.25
and 1.15.1).



With the --ignored-failed-read I'm sure you are correct.

Yes, indeed.



The "error exit delayed" situation can be set to be considered
"normal" in sendbackup-gnutar.c or it and a few others ignored
by defining "IGNORE_TAR_ERRORS" in amanda.h.


Amanda does pass the --ignore-failed-read option, and thus you
normally should not need to compile with IGNORE_TAR_ERRORS defined.
The last one classifies the printed warnings as "normal" instead
of "strange" and suppresses the STRANGE section in the amanda report.
And maybe it would ignore other more serious errors too?


These are the 3 messages added by the IGNORE_TAR_ERRORS macro.

    "File .* shrunk by [0-9][0-9]* bytes, padding with zeros"
    "Cannot add file .*: No such file or directory"
    "Error exit delayed from previous errors"

Seem to be directly related to the current discussion.


Tar always prints a message for the problems, but --ignore-failed-read option just inhibits setting the exit failure code 2 for some
of them.

When tar returns with 2, amanda trows away the archive.
Amanda classifies the messages in "NORMAL", "ERROR" and all
the rest as "STRANGE".

The IGNORE_TAR_ERRORS macro just classifies those three as NORMAL
instead of STRANGE.
But the macro also makes amanda change the gnutar exit code 2 into 0.

Because you can have other real errors, defining that macro is not
very wise, I believe.  I strongly think about adding the first
two regexps to the normal list, just to suppress the noise
in the report, together with one like "File changed as we read it"
(why was that left out from the regexp list?), but keep the
decision from gnutar indicating if the archive is OK or not.

The message "Error exit delayed..." however means there was an
error that --ignore-failed-read did not neutralize, and I *am*
interested in knowing about those!  That one should not be "normal".

And some which are neutralized by the --ignore-failed-read flag
should still be flagged as strange (e.g. IO error on reading a file
means I need to replace my disk soon), but the tar archive is
valid, and does contain useful data.

Maybe that macro got added to amanda when gnutar did not yet had the
--ignore-failed-read flag?

--
Paul Bijnens, Xplanation                            Tel  +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM    Fax  +32 16 397.512
http://www.xplanation.com/          email:  Paul.Bijnens AT xplanation DOT com
***********************************************************************
* I think I've got the hang of it now:  exit, ^D, ^C, ^\, ^Z, ^Q, F6, *
* quit,  ZZ, :q, :q!,  M-Z, ^X^C,  logoff, logout, close, bye,  /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt,  abort,  hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e,  kill -1 $$,  shutdown, *
* kill -9 1,  Alt-F4,  Ctrl-Alt-Del,  AltGr-NumLock,  Stop-A,  ...    *
* ...  "Are you sure?"  ...   YES   ...   Phew ...   I'm out          *
***********************************************************************



<Prev in Thread] Current Thread [Next in Thread>