Description of problem:
The Gluster/Swift plugin code provides wrappers for get/set/removexattr
system calls which perform file open/close systems calls. The open/close
sequence appears to be unnecessary.
Version-Release number of selected component (if applicable):
3.3.0
Actual results:
Files are first opened, xattr key read/written/removed, then closed for
every metadata key stored (could have multiple keys stored, see
https://bugzilla.redhat.com/show_bug.cgi?id=865619)
Expected results:
No open or close system call is made around xattr operations.

I created a permanent pastebin link with the output of an strace from a GET on an object.
Lines 222 - 240 are annotated to show where a read_metadata() calls starts and ends, and what do_getxattr() does for a file. Notice that 13 system calls are made. The two calls to fgetxattr in a row are the result of the pyxattr modules' behavior to first find out the size of the xattr value so that it can allocate memory for it and then fetch the full contents of it.
We should be able to remove the extra stat calls as well.