From tinguely@opus.cs.ndsu.NoDak.edu  Tue May 30 07:53:08 1995
Received: from opus.cs.ndsu.NoDak.edu (opus.cs.ndsu.NoDak.edu [134.129.125.6])
          by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id HAA13676
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 30 May 1995 07:53:07 -0700
Received: (from tinguely@localhost) by opus.cs.ndsu.NoDak.edu (8.6.11/8.6.9) id JAA00642; Tue, 30 May 1995 09:53:06 -0500
Message-Id: <199505301453.JAA00642@opus.cs.ndsu.NoDak.edu>
Date: Tue, 30 May 1995 09:53:06 -0500
From: mark tinguely <tinguely@opus.cs.ndsu.NoDak.edu>
Reply-To: tinguely@opus.cs.ndsu.NoDak.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: Bogus lseek warning when dump large filesystems
X-Send-Pr-Version: 3.2

>Number:         461
>Category:       bin
>Synopsis:       Bogus lseek warning when dump large filesystems
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 30 08:00:02 1995
>Closed-Date:    Sat Jun 24 19:16:51 MET DST 1995
>Last-Modified:
>Originator:     Mark Tinguely
>Release:        FreeBSD 2.1.0-Development i386
>Organization:
North Dakota State University
>Environment:

>Description:

	When using dump/rdump on large filesytems (my case 3 GB), the lseek
	claims multiple times to have failed. The problem is a off_t is
	converted into a int and checked for a negative. A true lseek check
	should be checking if the off_t is equal to -1 for failure.

>How-To-Repeat:

	run dump on a large (> 2GB) filesystem

>Fix:
	
	since the lseek is set from the beginning of the filesystem, I simple
	check if the lseek returned the offset that was requested. maybe a
	more efficent test would be a test for -1.

	I never got the "lseek2" error message, but I changed that as well
	just in case.

*** traverse.c.orig	Thu May 26 01:34:03 1994
--- traverse.c	Tue May 30 09:36:15 1995
***************
*** 558,564 ****
  	extern int errno;
  
  loop:
! 	if ((int)lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0)
  		msg("bread: lseek fails\n");
  	if ((cnt = read(diskfd, buf, size)) == size)
  		return;
--- 558,565 ----
  	extern int errno;
  
  loop:
! 	if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) !=
! 						((off_t)blkno << dev_bshift))
  		msg("bread: lseek fails\n");
  	if ((cnt = read(diskfd, buf, size)) == size)
  		return;
***************
*** 598,604 ****
  	 */
  	bzero(buf, size);
  	for (i = 0; i < size; i += dev_bsize, buf += dev_bsize, blkno++) {
! 		if ((int)lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0)
  			msg("bread: lseek2 fails!\n");
  		if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize)
  			continue;
--- 599,606 ----
  	 */
  	bzero(buf, size);
  	for (i = 0; i < size; i += dev_bsize, buf += dev_bsize, blkno++) {
! 		if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) !=
! 						((off_t)blkno << dev_bshift))
  			msg("bread: lseek2 fails!\n");
  		if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize)
  			continue;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sat Jun 24 19:16:51 MET DST 1995 
State-Changed-Why:  

Suggested fix applied in version  1.3 of dump/traverse.c 
>Unformatted:



