Bug 11354 - Unable to create xattr > ~1k on Windows2008
Summary: Unable to create xattr > ~1k on Windows2008
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 4.2.2
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-19 21:49 UTC by Paul Smedley
Modified: 2016-05-13 09:08 UTC (History)
2 users (show)

See Also:


Attachments
proposed patch (1.54 KB, patch)
2016-05-10 18:06 UTC, Christian Ambach
no flags Details
updated patch (1.56 KB, patch)
2016-05-11 13:01 UTC, Christian Ambach
no flags Details
git-am fix for 4.4.next, 4.3.next (1.80 KB, patch)
2016-05-12 08:07 UTC, Jeremy Allison
ambi: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Smedley 2015-06-19 21:49:56 UTC
Hi,

I working on porting Samba 4.2.2 to the OS/2 operating system. OS/2 makes extensive use of extended attributes. The current OS/2 port is based on Samba 3.6, and with that version, I am able to successfully create EA's (aka xattr) of > 9k on a Windows 2008 server.

Since updating my client to use Samba 4.2.2, I can only create EA's < ~950 bytes.

I can reproduce this with smbclient from Samba 4.1.13 on Ubuntu using:
smb: \> setea 2014.jpg TEST abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
set_ea \2014.jpg: NT_STATUS_INSUFF_SERVER_RESOURCES

Unfortunate there is not much debug logging that is relevant even with -d 10

Any suggestions?
Comment 1 Paul Smedley 2015-06-19 23:17:44 UTC
Interestingly, creating xattr using setea with a size > 1k works fine to a server running OS/2.

So it may be an issue specific to servers running on Windows
Comment 2 Paul Smedley 2015-06-20 07:07:12 UTC
EA creation also seems to work fine with a Samba 3.6.6 server running on a Raspberry Pi - so the problem seems to only affect servers running Windows
Comment 3 Paul Smedley 2015-06-21 06:58:25 UTC
it appears the problem with a Windows server is a protocol issue.

smbclient uses NT1 by default and EA transfer fails.

If I use -m=SMB2 to force SMB2, EA transfer works.

This still doesn't explain why EA transfer with NT1 works with smbclient from Samba 3.6
Comment 4 Paul Smedley 2015-06-22 09:40:35 UTC
Some more testing:

smbclient from ubuntu to a Win2k08 server:
smb: \> setea apr-1.5.1-unix.diff TEST abcdef
smb: \> setea apr-1.5.1-unix.diff TEST2 abcdefghijklmnopqrstuvwxyz
smb: \> geteas apr-1.5.1-unix.diff
TEST (0) =
[0000] 61 62 63 64 65 66                                 abcdef 

TEST (0) =
[0000] 61 62 63 64 65 66                                 abcdef 

Note the second EA that is set ends up as a duplicate of the first one.

Same as above but writing to a Linux Samba server:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
smb: \> setea apr-1.5.1-unix.diff TEST abcdef
smb: \> setea apr-1.5.1-unix.diff TEST2 abcdefghijklmnopqrstuvwxyz
smb: \> geteas apr-1.5.1-unix.diff
TEST (0) =
[0000] 61 62 63 64 65 66                                 abcdef 

TEST2 (0) =
[0000] 61 62 63 64 65 66 67 68   69 6A 6B 6C 6D 6E 6F 70   abcdefgh ijklmnop
[0010] 71 72 73 74 75 76 77 78   79 7A                    qrstuvwx yz

EA creation works fine :/
Comment 5 Paul Smedley 2015-06-22 09:44:49 UTC
..and more interesting - geteas from smbclient from samba 3.6 shows the expected EA's from the test in the previous comments
Comment 6 Paul Smedley 2015-06-22 09:45:31 UTC
ie:
smb: \> geteas apr-1.5.1-unix.diff
TEST (0) =
[0000] 61 62 63 64 65 66                                 abcdef

TEST2 (0) =
[0000] 61 62 63 64 65 66 67 68   69 6A 6B 6C 6D 6E 6F 70   abcdefgh ijklmnop
[0010] 71 72 73 74 75 76 77 78   79 7A                    qrstuvwx yz
Comment 7 Paul Smedley 2015-06-25 08:59:37 UTC
Note: the issues with geteas mentioned in comments 4 through 6 seem to appear only when SMB2 is used. With SMB1 geteas works OK.
Comment 8 Christian Ambach 2016-05-10 18:06:09 UTC
Created attachment 12094 [details]
proposed patch

There was a change to libsmbclient in Samba 4.0 that limited the amount of EA information that can be written over non SMB2/3 connections.
With this patch I was able to write 3k of EA information to a Windows 8 machine over both SMB2 and NT1.

Any chance you can give it some testing in your environment?
Comment 9 Paul Smedley 2016-05-11 09:08:30 UTC
(In reply to Christian Ambach from comment #8)
Hi Christian - looks good to me. Tested on a server running win2k8 server and all seems OK :) Thanks for the fix!
Comment 10 Jeremy Allison 2016-05-11 12:38:04 UTC
As far as I can see in MS-CIFS section 2.2.6.7.2 the max data response is zero, not 2 (2 is the parameter response size).

Can you test this replacing the 2 with zero ?

Thanks,

Jeremy.
Comment 11 Christian Ambach 2016-05-11 13:01:17 UTC
Created attachment 12099 [details]
updated patch

Paul, can you give the updated patch a test as well?
Thanks!
Comment 12 Paul Smedley 2016-05-11 20:09:30 UTC
(In reply to Christian Ambach from comment #11)
Hi Christian - updated patch appears to work as well based on limited testing
Comment 13 Lewis Rosenthal 2016-05-11 21:12:40 UTC
Yes, I can also confirm that writing to W2K8 R2 this latest patch with the 4.4.3 client from OS/2 I am able to back up an entire desktop (with EAs intact). I see both file and directory EAs getting cleanly written.

Nicely done!
Comment 14 Jeremy Allison 2016-05-12 08:07:30 UTC
Created attachment 12101 [details]
git-am fix for 4.4.next, 4.3.next

Cherry-picked from master.
Comment 15 Jeremy Allison 2016-05-12 08:10:22 UTC
Re-assigning to Karolin for inclusion in 4.4.next, 4.3.next.
Comment 16 Karolin Seeger 2016-05-12 12:14:56 UTC
(In reply to Jeremy Allison from comment #15)
Pushed to autobuild-v4-[3|4]-test.
Comment 17 Karolin Seeger 2016-05-13 09:08:56 UTC
(In reply to Karolin Seeger from comment #16)
Pushed to both branches.
Closing out bug report.

Thanks!