Bug 516165

Summary: Can't read last ~5% of a remote file
Product: [Fedora] Fedora Reporter: The Source <thesource>
Component: sambaAssignee: Guenther Deschner <gdeschner>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: medium    
Version: 13CC: alexl, azelinka, bnocera, gdeschner, jeff, jlayton, jreznik, marcosfrm, nkukard, oded, rodd, ssorce, tbzatek, theophanis_kontogiannis
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: samba-3.5.8-75.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-04 09:52:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 516998    
Attachments:
Description Flags
gvfsd-smb debug log none

Description The Source 2009-08-07 05:41:33 UTC
Description of problem:
The last small part of the file on a samba network can not be read (either copied by nautilus or cp or just read from gvfs mounted folder. Nautilus shows 'invalid argument' error message).

Version-Release number of selected component (if applicable):
3.4.0-0.39.fc11.x86_64

How reproducible:
always

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Jeffrey C. Ollie 2009-08-19 02:52:58 UTC
I'm seeing this as well... What would be the best way to gather some more information to track the problem down?  I don't access Windows shares very often, but it's often enough to know that this problem only cropped up recently.  When I get into work tomorrow I'll try some F11 and F12Alpha live CDs to see if this problem shows up there.

Comment 2 Tomáš Bžatek 2009-08-19 13:08:35 UTC
Created attachment 357934 [details]
gvfsd-smb debug log

Raising severity and priority, added K- for FEDORA-2009-7909 in bodhi (please don't push broken updates into stable repo). Reproducible with samba-3.4.0-0.39.fc11 and samba-3.4.0-0.41.fc12.1, seems like whole 3.4 series is affected.

This is a major problem since users are unable to open (copy) any file from SMB share in Gnome. Small test showed issues in KDE as well. Both use libsmbclient. Standalone smbclient works fine though. Writing files showed no errors (haven't tested for content corruption).

Tested against WinXP SP2, other users reported issues with Win2003 Server. No special characters in path or filename.

Attached you can find debug log from gvfsd-smb (backend) serving client gvfs-copy command. There's nothing special in the code, just getting read function for context via smbc_getFunctionRead() and calling it afterwards for blocks smaller than 65536.

Upstream Gnome bug is http://bugzilla.gnome.org/show_bug.cgi?id=588391

Comment 3 Theophanis Kontogiannis 2009-08-19 16:12:51 UTC
Rolling back to samba and libsmbclient 3.3.2-0.33.fc11.x86_64 solves the problem.

Comment 4 Guenther Deschner 2009-08-19 23:20:04 UTC
Ok, this is a bug in samba 3.4 libsmbclient (which just got fixed in master git tree), upstream bug is: https://bugzilla.samba.org/show_bug.cgi?id=6649.

Anyway, the gvfs smb backend MUST set the buffer size to 65534 (which will drastically increase read performance).

the code in http://git.gnome.org/cgit/gvfs/tree/daemon/gvfsbackendsmb.c#n715
MUST be changed into:

if (bytes_requested > 65534)
  bytes_requested = 65534;

In fact, not truncating the buffer size at all would gain even more performance (when talking to non-windows cifs servers).

Comment 5 Jeffrey C. Ollie 2009-08-20 00:44:03 UTC
I added the patch referenced in the samba bug report to what's in samba's F-11 cvs branch.  I can now copy files off of windows shares.

Comment 6 Tomáš Bžatek 2009-08-20 14:59:34 UTC
(In reply to comment #4)
> Anyway, the gvfs smb backend MUST set the buffer size to 65534 (which will
> drastically increase read performance).
Changes done in upstream, will get to rawhide next monday/tuesday.

Günther, please backport the patch to rawhide packages at least, F11 is not so important as no samba-3.4.0 packages have been pushed to stable. Thanks!

Comment 7 The Source 2009-11-21 11:34:00 UTC
Works properly in Fedora 12 and later versions in F11.

Comment 8 Rodd Clarkson 2010-08-19 04:04:17 UTC
I'm seeing the same symptoms as this in F13 trying to copy files to a Windows server.

When I drag a file to a share I get the following error:

|----------------------------------------------------|
| Error while copying "myplace-15h5uv2.jpg".         |
|                                                    |
| There was an error copying the file into smb://    |
| rwps-fs1/studentshared/shared.                     |
|                                                    |
| Show more details                                  |
|                                                    |
| Invalid Argument                                   |
|----------------------------------------------------|

I'm using samba-3.5.4-62.fc13.x86_64 and libsmbclient-3.5.4-62.fc13.x86_64

Comment 9 Rodd Clarkson 2010-08-19 04:09:28 UTC
If I look at the properties of the files that I was copying to the server, then I see that 49152 bytes have been copied (out of a total of 233408 bytes).

Comment 10 The Source 2010-08-19 05:06:03 UTC
Yep, same here. However, cp command seems to work fine. Problem occurs to me with nautilus.

Comment 11 The Source 2010-08-19 05:07:07 UTC
Reopening by marking as 'Assigned' since bugzilla interface doesn't give me 'New' or 'Reopened' option.

Comment 12 Guenther Deschner 2010-10-08 14:16:19 UTC
Looks like a gnome-vfs2 bug

Comment 13 Tomáš Bžatek 2010-11-12 15:52:38 UTC
Please refer to upstream bugs:
 Gnome https://bugzilla.gnome.org/show_bug.cgi?id=633937
 Samba https://bugzilla.samba.org/show_bug.cgi?id=7791

Comment 14 Guenther Deschner 2011-04-04 09:52:05 UTC
A Samba update has been issued that contains the fix mentioned in the upstream bugreport. Closing as fixed with current release.

Comment 15 Marcos Mello 2012-03-28 15:08:06 UTC
The bug is back in F17. When I try write to a Windows 7 password protected share:

$ gvfs-copy -p "img.png" "smb://sempron/documents/Blog"
Error copying file img.png: Argumento inválido

On the other way (copy from the Windows share) it works.

gvfs-smb-1.11.5-1.fc17
libsmbclient-3.6.3-81.fc17.1

Comment 16 Marcos Mello 2012-03-30 11:41:15 UTC
Please disconsider the above report. I don't know why but after a reinstall all works again.

Comment 17 Tomáš Bžatek 2012-03-30 11:52:28 UTC
(In reply to comment #16)
> Please disconsider the above report. I don't know why but after a reinstall all
> works again.

Okay, feel free to open a new bugreport when you face this issue again. Most likely this is a samba problem as gvfsd-smb hasn't changed much past years and it heavily depends on libsmbclient.