On Fri, Sep 25, 2020 at 07:49:20AM +0200, Otto Moerbeek wrote:

> On Fri, Sep 25, 2020 at 08:42:38AM +0300, Juha Erkkilä wrote:
> 
> > 
> > > On 24. Sep 2020, at 15.36, Otto Moerbeek <o...@drijf.net> wrote:
> > > 
> > > On Tue, Sep 22, 2020 at 08:37:22PM +0300, Juha Erkkilä wrote:
> > >> Actually, I tested this again and now it appears
> > >> dump and restore both work correctly. Previously,
> > >> I first tested dump/restore with an empty filesystem,
> > >> then with some files, and it may be that the second
> > >> time I was accidentally testing restore with the first
> > >> dump file.
> > >> 
> > >> My tests were only with a small amount of files,
> > >> I will do a better test with proper data (about
> > >> 0.5 terabytes and over 100000 files) and will
> > >> report again here in a next few days.
> > > 
> > > Lookin through FreeBSD commits I think you want the main.c one as
> > > well, otherwise silent corruption of the dump is still possible.
> > > 
> > >   -Otto
> > 
> > With that patch I get a message:
> > 
> > fatal: morestack on g0
> >   DUMP: fs is too large for dump!
> >   DUMP: The ENTIRE dump is aborted.
> > 
> > This is on a 2 terabyte filesystem with 0.5 terabytes
> > of data “successfully” backed up (or at least I considered
> > the backup and restore as successful).
> 
> Hmm, I neeed to dig into the dump format and see if the math is right.

Indeed, that commit was reverted in FreeBSD. This should do better. I
do not like the assert FreeBSD has, so I turned into an quit().

        -Otto

Index: tape.c
===================================================================
RCS file: /cvs/src/sbin/dump/tape.c,v
retrieving revision 1.45
diff -u -p -r1.45 tape.c
--- tape.c      28 Jun 2019 13:32:43 -0000      1.45
+++ tape.c      26 Sep 2020 06:30:37 -0000
@@ -330,7 +330,10 @@ flushtape(void)
        }
 
        blks = 0;
-       if (spcl.c_type != TS_END) {
+       if (spcl.c_type != TS_END && spcl.c_type != TS_CLRI &&
+           spcl.c_type != TS_BITS) {
+               if (spcl.c_count > TP_NINDIR)
+                       quit("c_count too large\n");
                for (i = 0; i < spcl.c_count; i++)
                        if (spcl.c_addr[i] != 0)
                                blks++;

Reply via email to