Bug 7707 - stat() fails if cifs-fs is mounted without noserverino option
stat() fails if cifs-fs is mounted without noserverino option
Product: CifsVFS
Classification: Unclassified
Component: kernel fs
Other Linux
: P3 normal
: ---
Assigned To: Jeff Layton
Depends on:
  Show dependency treegraph
Reported: 2010-10-01 03:14 UTC by Gerhard Schiller
Modified: 2010-10-07 10:01 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Schiller 2010-10-01 03:14:17 UTC
When mounting a windows share with mount.cifs without the "noserverino" option, a call to stat() will fail.

mount.cifs version: 4.6 - I compiled it myself from "cifs-utils-4.5" src package as I had to apply a patch to make the "credentials" option work.


How to reproduce:
Mount a windows share using an fstab line like this:
//$ /mnt/idefix/intranet cifs credentials=/etc/samba.credentials_for_idefix_intranet,rw,uid=gerhard,gid=users,dir_mode=0755,file_mode=0664 0 0

Compile and run the test program with the path to a file on the share as argument:

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>

main(int argc, char **argv)
  struct stat statbuf;
  if(stat(argv[1], &statbuf) == 0)
    printf("st_ino = %d, st_mode = 0%o, st_size = %d\n", statbuf.st_ino, statbuf.st_mode, statbuf.st_size);
	fprintf(stderr, "errno:%d, ", errno);
  return 0;

It will fail with:
errno:75, stat: Value too large for defined data type.

Now umount the share an mount it again with the noserverino option using an fstab line like this:
//$ /mnt/idefix/intranet cifs noserverino,credentials=/etc/samba.credentials_for_idefix_intranet,rw,uid=gerhard,gid=users,dir_mode=0755,file_mode=0664 0 0

Run the test programm again, and it will display some parts of the stat structure.

What else:
My "hardware" is actually a virtual machine, running under VM-Player.
I have an other (older) virtual machine on my hard disk, which did not require the noserverino option. So I copied my test program - the binary - to that other machine and it was able to "stat" the share.

This environment:

mount.cifs version: 1.10-3.0.32-0.2-2210-SUSE-SL10.3

Compiling the source code of the test on the older machine and running it on the machine where I encountered the problem gave the same results: failure to "stat" without noserverino.

Therefore I believe, the problem is within the cifs package and not with in stat().

The problem and the workaround is documented at:

Gerhard Schiller

As this is my first bug report, please don't be to harsh in your judgment if something it's not perfect...
Comment 1 Jeff Layton 2010-10-05 06:35:34 UTC
This is not a bug in CIFS:


Short answer: You need to recompile your test program with 


What's happening is that glibc uses the stat64() system call to handle the stat, even with 32-bit non LFS programs. When it gets back a large inode number that doesn't fit in a 32-bit value, it generates EOVERFLOW in userspace and returns that to the program.

noserverino works around this because it tends to generate small values. This is also not likely to be a problem on 64-bit arches.
Comment 2 Gerhard Schiller 2010-10-07 10:01:09 UTC
Not a bug in samba.
KDE3 libraries need to be recompiled with -D_FILE_OFFSET_BITS=64.