linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* smbfs: lseek returns EINVAL when using large files.
@ 2005-04-11  9:07 Mathieu Fluhr
  2005-04-11  9:17 ` Arjan van de Ven
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Fluhr @ 2005-04-11  9:07 UTC (permalink / raw)
  To: Linux Kernel ML

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: smbfs: lseek returns EINVAL when using large files.
  2005-04-11  9:07 smbfs: lseek returns EINVAL when using large files Mathieu Fluhr
@ 2005-04-11  9:17 ` Arjan van de Ven
  0 siblings, 0 replies; 2+ messages in thread
From: Arjan van de Ven @ 2005-04-11  9:17 UTC (permalink / raw)
  To: Mathieu Fluhr; +Cc: Linux Kernel ML

On Mon, 2005-04-11 at 11:07 +0200, Mathieu Fluhr wrote:
> 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.


have you tried the cifs client, which is new in 2.6 and is the more
actively maintained way to access windows shares and samba ?



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-11  9:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-11  9:07 smbfs: lseek returns EINVAL when using large files Mathieu Fluhr
2005-04-11  9:17 ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).