lkml.org 
[lkml]   [2005]   [Apr]   [11]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
Subjectsmbfs: lseek returns EINVAL when using large files.
FromMathieu Fluhr <>
DateMon, 11 Apr 2005 11:07:43 +0200
Hello

It seems that the smbfs driver does not handle correctly large files
(>2GB). The thing is that statting them is correct (for example, the
st_size field is correctly set), but as soon as you try to make a lseek
with an offset larget than INT_MAX, you get a EINVAL error.

Note: This is not coming out of the remote samba server (Tested with
under windows, and it is working fine).

I'm using a 2.6.10 kernel without external patches. I parsed the 2.6.11
changelog to see if this problem has been fixed, but I didn't found
anything related. If this has already been discussed, just let me
know ;-)

You can reproduce this bug with this little program:

-8<------------------------------------------
/* Enable large file support for x86 */
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include <stdio.h>

int main(int argc, char **argv)
{
  int fd = open(argv[1], O_RDONLY);
  if(fd == -1)
    perror("open");
  struct stat st;
  fstat(fd, &st);

  printf("filesize: %llu\n", st.st_size);

  /* Go at end... */
  if(lseek(fd, 0, SEEK_END) == (off_t)(-1))
    perror("lseek");
  close(fd);
  return 0;
}
-8<------------------------------------------
Best Regards,
Mathieu Fluhr


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-04-11 11:12    [W:0.687 / U:0.490 seconds]
©2003-2008 Jasper Spaans