vfs_acl_xattr: avoid needlessly supplying a large buffer to getxattr()
authorUri Simchoni <uri@samba.org>
Thu, 13 Apr 2017 09:44:58 +0000 (12:44 +0300)
committerJeremy Allison <jra@samba.org>
Tue, 18 Apr 2017 02:41:16 +0000 (04:41 +0200)
commit05d83ccf7a6fecf963fcb980acd50cebfc0c3ea9
tree40061bc5c95f43744e18121cb17ddff4d8ad217d
parent7b775abd9278ae34110ec87d94a736be7f64884a
vfs_acl_xattr: avoid needlessly supplying a large buffer to getxattr()

When obtaining the security descriptor via getxattr(), first try
optimistically to supply a buffer of 4K, and if that turns out
to be too small, determine the correct buffer size.

The previous behavior of falling back to a 64K buffer encountered
problem with Linux prior to version 3.6, due to pyisical memory
fragmentation. With those kernels, as long as the buffer is 8K or
smaller, getting the xattr is much less prone to failure due to
memory fragmentation.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12737

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 18 04:41:16 CEST 2017 on sn-devel-144
source3/modules/vfs_acl_xattr.c