Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jan 2011 08:57:29 +0200
From:      Daniel Braniss <danny@cs.huji.ac.il>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        freebsd-hackers@freebsd.org, Rick Macklem <rmacklem@uoguelph.ca>
Subject:   Re: NFS: file too large 
Message-ID:  <E1PfRyz-0000mX-Oa@kabab.cs.huji.ac.il>
In-Reply-To: <201101190424.p0J4OkgW006798@apollo.backplane.com> 
References:  <334773590.270506.1295050163687.JavaMail.root@erie.cs.uoguelph.ca> <201101190424.p0J4OkgW006798@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> :Well, since a server specifies the maximum file size it can
> :handle, it seems good form to check for that in the client.
> :(Although I'd agree that a server shouldn't crash if a read/write
> : that goes beyond that limit.)
> :
> :Also, as Matt notes, off_t is signed. As such, it looks to me like
> :the check could mess up if uio_offset it right near 0x7fffffffffffffff,
> :so that uio->ui_offset + uio->uio_resid ends up negative. I think the
> :check a little above that for uio_offset < 0 should also check
> :uio_offset + uio_resid < 0 to avoid this.
> :
> :rick
> 
>     Yes, though doing an overflow check in C, at least with newer versions
>     of GCC, requires a separate comparison.  The language has been mangled
>     pretty badly over the years.
> 
> 
>     if (a + b < a)	-> can be optimized-out by the compiler
> 
>     if (a + b < 0)	-> also can be optimized-out by the compiler
> 
>     x = a + b;
>     if (x < a)		-> this is ok (best method)
> 
>     x = a + b;
>     if (x < 0)		-> this is ok
> 
> 
>     This sort of check may already be made in various places (e.g. by UFS
>     and/or uio), since negative offsets are used to identify meta-data in
>     UFS.
> 
> 					-Matt
> 					Matthew Dillon 
> 					<dillon@backplane.com>

my question, badly written, was why not let the underlaying fs (ufs, zfs, etc)
have the last word, instead of the nfsclient having to guess? Is there
a problem in sending back the error?

danny





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1PfRyz-0000mX-Oa>