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

Shehjar Tikoo shehjart at gluster.com
Thu Mar 17 12:10:38 UTC 2011



----- Original Message -----
> From: "Александр Берсенев" <bay at hackerdom.ru>
> To: gluster-devel at nongnu.org
> Sent: Thursday, March 17, 2011 5:05:57 PM
> Subject: [Gluster-devel] A problem with fstat64 system call on nfs.
> 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>");
> exit(1);
> }
> 
> int h=open(argv[1], O_RDONLY);
> if(h<0) {
> printf("Open failed\n");
> exit(1);
> }
> 
> struct stat s;
> int f=fstat(h,&s);
> if(f<0) {
> printf("Stat failed\n");
> exit(1);
> }
> 
> 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?

I dont think this is a bug. It has probably got something to do with the difference in inode number size. Anyway, we can confirm this by the following steps:

1. In source, along with the line:

printf("Stat failed\n");

..please print strerror(errno). i.e change the above line to:

printf("Stat failed: %s\n", strerror(errno));

I need to see what error number the fstat syscall fails with.

3. please recompile as:

gcc -m32 1.c

and re-run the test.

2. Once the test finishes. Please send me the output of the program above and the output of:

$ dmesg |tail 
$ uname -a


With this info, I can figure out whats going on. Thanks.


> 
> ---
> Alexander Bersenev(Russia)
> 
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at nongnu.org
> http://lists.nongnu.org/mailman/listinfo/gluster-devel




More information about the Gluster-devel mailing list