Skip site navigation (1)Skip section navigation (2)
Date:      10 Jan 1999 23:22:57 -0000
From:      mwm@phone.net
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/9429: dump -w tends to run dumps a day later than expected
Message-ID:  <19990110232257.10963.qmail@guru.phone.net>

next in thread | raw e-mail | index | archive | help

>Number:         9429
>Category:       bin
>Synopsis:       dump -w tends to run dumps a day later than expected
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 10 15:30:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Mike Meyer
>Release:        FreeBSD 3.0-RELEASE i386
>Organization:
Meyer Consulting
>Environment:

I know this bug existed as long ago as BSD 4.3, and probably before then.

>Description:

My reading of the dump & fstab documentation is that if you put N in
the "dump" column of /etc/fstab, then 'dump -w' will recommend that
you dump that file system every N days. This is not the case.

If you're running automated dumps that start at the same time every
day, the first dump is the only one that will behave as expected. If
you start the dump at 2am N days ago, then the dumps would have run at
(say) 2am, then 2:10 and later. Dump writes out the time the dump was
run. dump -w then checks that time against the time it is running to
generate a list of dumps that need to be done, to the nearest minute.
On the Nth day after the dumps were run, file systems after the first
won't be schedule to be dumped, as it's only been N-1 days and 50
minutes (or less).

>How-To-Repeat:

Try changing a correct /etc/dumpdates to include file systems that
should be dumped today, but are tagged as having been dumped an hour
(or a few minutes) later in the day, and then running dump -w.

>Fix:
	
The attached patch to /usr/src/sbin/dump/optr.c changes the comparison
so that dumps are treated by dump -w as having been done on midnight
of the day they were actually run. This makes dump -w behave as
expected for regularly scheduled daily dumps - if they all run the
same day. It makes dump -w behave strangely if you dump late in the
day and check again after midnight, but that is the lesser of two
evils.


*** optr.c-old	Sun Jun 14 23:58:11 1998
--- optr.c	Sun Jan 10 15:17:31 1999
***************
*** 484,490 ****
  	register struct dumpdates *dtwalk;
  	char *lastname, *date;
  	int dumpme;
! 	time_t tnow;
  
  	(void) time(&tnow);
  	getfstab();		/* /etc/fstab input */
--- 484,490 ----
  	register struct dumpdates *dtwalk;
  	char *lastname, *date;
  	int dumpme;
! 	time_t tnow, then;
  
  	(void) time(&tnow);
  	getfstab();		/* /etc/fstab input */
***************
*** 500,512 ****
  		if (strncmp(lastname, dtwalk->dd_name,
  		    sizeof(dtwalk->dd_name)) == 0)
  			continue;
! 		date = (char *)ctime(&dtwalk->dd_ddate);
  		date[16] = '\0';	/* blast away seconds and year */
  		lastname = dtwalk->dd_name;
  		dt = fstabsearch(dtwalk->dd_name);
  		dumpme = (dt != NULL &&
! 		    dt->fs_freq != 0 &&
! 		    dtwalk->dd_ddate < tnow - (dt->fs_freq * 86400));
  		if (arg != 'w' || dumpme)
  			(void) printf(
  			    "%c %8s\t(%6s) Last dump: Level %c, Date %s\n",
--- 500,512 ----
  		if (strncmp(lastname, dtwalk->dd_name,
  		    sizeof(dtwalk->dd_name)) == 0)
  			continue;
! 		then = 86400 * (dtwalk->dd_ddate / 86400); 
! 		date = (char *)ctime(&then);
  		date[16] = '\0';	/* blast away seconds and year */
  		lastname = dtwalk->dd_name;
  		dt = fstabsearch(dtwalk->dd_name);
  		dumpme = (dt != NULL &&
! 		    dt->fs_freq != 0 && then < tnow - (dt->fs_freq * 86400));
  		if (arg != 'w' || dumpme)
  			(void) printf(
  			    "%c %8s\t(%6s) Last dump: Level %c, Date %s\n",


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990110232257.10963.qmail>