[ENBD] 2GB limit on x86 hardware

Peter T. Breuer ptb@it.uc3m.es
Thu, 15 Mar 2001 15:03:17 +0100 (MET)


"A month of sundays ago Staffan.Ohman@nokia.com wrote:"
> I'm trying to set up a redundant file server using two x86 boxes
> running RH 7.0 with 2.4.2 kernel and nbd 2.4.21.
> I got nbd compiled without any problems and the tests also went
> ok. 
> The problems started when I tried to use a 10 GB raw partition on
> the server. On the client it worked ok (mkfs /dev/nda) except for 
> that less than 2GB ever got used. The instructions say that you need
> to have _LARGEFILE64_SOURCE defined when you compile to get >2GB 

This is a pre-requisite. You must also compile in the correct lseek,
which you do by running configure (make config), and making sure you
have an adequate lseek in libc (rewrite libc to taste)

> support. That seems to be the case by default (from looking at the messages
> when make is running)  During the compilation you get a warning
> message that got my attention:
> lowlevel.o(.text+0xf9): the `llseek' function may be dangerous; use
> `lseek64' instead.

You are using the "wrong" lseek, in some senses.

> After running make config a file called config.h appears in the nbd
> directory.
> It contains, among others, lines like this:
> 
> /* Define if you have the llseek function.  */
> #define HAVE_LLSEEK 1
> 
> /* Define if you have the lseek64 function.  */
> /* #undef HAVE_LSEEK64 */

Apparently you don't. So you don't have  a libc that supports a useful
lseek call.

> I tried changing it to :
> 
> /* Define if you have the llseek function.  */
> /* #define HAVE_LLSEEK 1 */
> 
> /* Define if you have the lseek64 function.  */
> #define HAVE_LSEEK64 1

Do you?

> After a recompiling and reinstalling the kernel module, the sever and the
> client the nda 
> device on the client seemed to work correctly (haven't done much testing
> yet), so 
> I guess the problem is in the configure script that generates the config.h
> file. 
> 
> Could someone confirm that it is ok to do something like that ?
> (and if so perhaps even fix the configure script :)

The configure script in principle is correct. It simply does a test compile
with lseek64. From configure.in:

  AC_CHECK_SIZEOF(long long int)
  AC_CHECK_FUNCS(llseek)
  AC_CHECK_FUNCS(lseek64)

And you can see that the configure script that it generates tests
by making a file:

#include "confdefs.h"
#include <assert.h>
    /* Override any gcc2 internal prototype to avoid an error.  */
    /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
char lseek64();
int main() {
        /* The GNU C library defines this for functions which it
         * implements to always fail with ENOSYS.  Some functions are actually
           named something starting with __ and the normal name is an
           alias.  */
   #if defined (__stub_lseek64) || defined (__stub___lseek64)
        choke me
   #else
       lseek64();
   #endif
; return 0;
}

So see how that compiles for you. Alternatively, remake the configure
script by running autoconf.


Peter