When dumping a file which is being actively updated by an application
(in our case it was an outlook pst file on our samba server), safe_read()
can sometimes return 0.

When it happens, sparse_dump_region() goes into an infinite loop.

I don't know what the proper fix would be.  I just fixed it on our server
with this:

    --- sparse.c.orig       2014-02-28 10:54:13.000000000 -0500
    +++ sparse.c    2014-02-28 10:53:51.000000000 -0500
    @@ -312,7 +312,7 @@

           blk = find_next_block ();
           bytes_read = safe_read (file->fd, blk->buffer, bufsize);
    -      if (bytes_read == SAFE_READ_ERROR)
    +      if (bytes_read == SAFE_READ_ERROR || bytes_read == 0)
            {
               read_diag_details (file->stat_info->orig_file_name,
                                 (file->stat_info->sparse_map[i].offset

It now gives a false error message:

  tar.debug: ./backupad.pst: Warning: Read error at byte 5412242432, while 
reading 512 bytes

but doesn't hang anymore.

PS
We do not backup the file while it is being updated, but amanda runs
its estimation phase on a live filesystem.

Reply via email to