Created attachment 11572 [details]
I have reproduced this behavior on Samba 4.2.4 as well as 4.1.17. Samba has SMB3 enabled. Copy a file with EAs from a Windows 8 or Windows Server 2012 client to a share that has "ea support" = no (the default) using explorer. Before the copy was started there is no file with that name in the directory. A dialog appears indicating that the file exists prompting the user to overwrite or skip. Skipping or using the compare option in Windows shows that the file on the share is zero length. Copying a file without EAs behaves as expected, producing no error dialogs.
I have attached a tcpump capture that shows the create file request contains "ExtA" ExtraInfo and gets a response from the server of STATUS_EAS_NOT_SUPPORTED. The windows server appears to retry only to get STATUS_OBJECT_NAME_COLLISION.
If I enable "ea support" on the share there is no error. When I do the same actions from a Windows Server 2008 system the error does not occur and looking at the packet capture for that system in wireshark indicates that it tries to set the EAs in a later request, after the create file and data copy succeed.
I did a quick pass over the source code in this area and it looks like there is a call to set_ea within create_file_unixpath that is called after the file is created but will always fail due to ea support being disabled. My uneducated opinion (:-)) is that smbd ought to either check if EAs are enabled when ea_list is not NULL before creating the file or clean up the file if set_ea fails.
Created attachment 11573 [details]
"Just for fun" I built samba with the following patch applied, this appears to resolve the problem for me.
Oh that's a really good catch - thanks !
Your patch looks like the correct one to me. Can you give me permission to post to samba-technical with your Signed-off-by please ?
Certainly, however I'm not sure what the proper procedure is for the Signed-off-by...
If its just a matter of putting it here in a comment then:
Signed-off-by: John Mulligan <email@example.com>
otherwise please let me know what it is. Thank You.
(In reply to John Mulligan from comment #4)
For this patch your comment here is enough - thanks ! If you want to do more Samba patching you might want to send in this form:
Just do it once and then you're good to go for all future patches !
Created attachment 11578 [details]
git-am fix for 4.3.next, 4.2.next.
This is what went into master cherry-picked for 4.3.next, 4.2.next.
Karolin, please add the patch to 4.2.next and 4.3.next branches. Thanks!
Pushed to autobuild-v4-[3|2]-test.
(In reply to Karolin Seeger from comment #8)
Pushed to both branches.
Closing out bug report.