Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 May 1995 08:00:04 -0700
From:      mark tinguely <tinguely@opus.cs.ndsu.NoDak.edu>
To:        freebsd-bugs
Subject:   bin/461: Bogus lseek warning when dump large filesystems
Message-ID:  <199505301500.IAA14988@freefall.cdrom.com>
In-Reply-To: Your message of Tue, 30 May 1995 09:53:06 -0500 <199505301453.JAA00642@opus.cs.ndsu.NoDak.edu>

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

>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:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 30 08:00:02 1995
>Originator:     Mark Tinguely
>Organization:
North Dakota State University
>Release:        FreeBSD 2.1.0-Development i386
>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;
>Audit-Trail:
>Unformatted:





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