[Gluster-devel] A problem with fstat64 system call on nfs.

Александр Берсенев bay at hackerdom.ru
Thu Mar 17 11:35:57 UTC 2011

I am experimenting with glusterfs on cluster.
I have a ~20 glusterfs servers. They communicating between each other
via Infiniband.
One of client machine have no Infiniband board, so I mounted the
glusterfs volume on this client machine via nfs.

I used this command:
  mount -t nfs server:/share /mount

When I try to do fstat64 on any file from the nfs mount, the stat call
fails because of stack corruption.

Here is a small source of a fstat test:

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/file.h>
#include <sys/stat.h>

int main(int argc, char **argv){
 if(argc!=2) {
  printf("Usage: ./progname <file>");

 int h=open(argv[1], O_RDONLY);
 if(h<0) {
  printf("Open failed\n");

 struct stat s;
 int f=fstat(h,&s);
 if(f<0) {
  printf("Stat failed\n");

 printf("Size: %d\n",s.st_size);
 return 0;

When I compiling this source with this command: gcc -m32 1.c , all
fstat64 calls from nfs mount is fails:
[u1333 at um64 bay]$ ./a.out aaaaaa
Stat failed

But with non-gluster nfs mount and local files the program is working correctly:
[u1333 at um64 bay]$ ./a.out /etc/passwd
Size: 1743

When I compiling this source with another command: gcc -m64 1.c , all
is working. Strace shows fstat calls instead of fstat64.
[u1333 at um64 bay]$ ./a.out aaaaaa
Size: 2
[u1333 at um64 bay]$ ./a.out /etc/passwd
Size: 1743

Steps for reproduce:
1) Mount glusterfs via nfs.
2) Compile a source with -m32
3) Execute ./a.out <file on nfs>

Is it glusterfs bug?

Alexander Bersenev(Russia)

More information about the Gluster-devel mailing list