smbfs: lseek returns EINVAL when using large files.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux