[CentOS] Issues with stat() call on CentOS5 vs CentOS4

Fri Dec 10 20:06:26 UTC 2010
David Sommerseth <dazo at users.sourceforge.net>

On 10/12/10 18:23, Dougal Ballantyne wrote:
> Dear CentOS,
>
> I have recently upgraded several servers from CentOS4 to CentOS5 and I am
> noticing a strange change to the stat() call. I have written a very
> small program to test and show the behavior. I am calling stat()
> against a file which is exported from my NAS and mounted with 32k
> read/write sizes.
>
> [dougalb at centos4 tmp]$ cat my_stat.c
> #include<unistd.h>
> #include<stdio.h>
> #include<sys/stat.h>
> #include<sys/types.h>
>
> int main(int argc, char **argv)
> {
>     if(argc != 2)
>         return 1;
>
>     struct stat fileStat;
>     if(stat(argv[1],&fileStat)<  0)
>         return 1;
>
>     printf("Block size: \t\t%d\n",fileStat.st_blksize);
>
>     return 0;
> }
>
> [dougalb at centos4 tmp]$
> [dougalb at centos4 tmp]$ gcc -o my_stat.exe my_stat.c
> [dougalb at centos4 tmp]$
> [dougalb at centos4 tmp]$ ./my_stat.exe /mnt/nas/testfile
> Block size:             32768
> [dougalb at centos4 tmp]$
> [dougalb at centos4 tmp]$ cat /etc/redhat-release
> CentOS release 4.7 (Final)
> [dougalb at centos4 tmp]$
>
> [dougalb at centos5 tmp]$ ./my_stat.exe /mnt/nas/testfile
> Block size:             4096
> [dougalb at centos5 tmp]$
> [dougalb at centos5 tmp]$ cat /etc/redhat-release
> CentOS release 5.5 (Final)
> [dougalb at centos5 tmp]$
>
> On CentOS5 it is reporting 4k block sizes when it should report 32k. Has
> anyone seen this or aware of what is causing this change in behavior?

What kind of network file system is used to mount your NAS?


kind regards,

David Sommerseth