Bug 865858 - Potentially unnecessary file opens/closes performed around xattr read/writes
Summary: Potentially unnecessary file opens/closes performed around xattr read/writes
Keywords:
Status: MODIFIED
Alias: None
Product: Gluster-Swift
Classification: Community
Component: utils
Version: 1.8.0
Hardware: x86_64
OS: Linux
low
low
Target Milestone: ---
Assignee: Nobody
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 903396 978061
TreeView+ depends on / blocked
 
Reported: 2012-10-12 16:36 UTC by Peter Portante
Modified: 2023-01-31 23:40 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)
Initial patch to remove the use of deprecated pyxattr methods. (2.94 KB, patch)
2012-10-12 19:11 UTC, Peter Portante
no flags Details | Diff
Actual fix to remove extra system calls. (5.32 KB, patch)
2012-10-12 19:12 UTC, Peter Portante
no flags Details | Diff

Description Peter Portante 2012-10-12 16:36:18 UTC
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.

Comment 1 Peter Portante 2012-10-12 18:34:07 UTC
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.

Comment 2 Peter Portante 2012-10-12 18:51:18 UTC
Probably would be helpful to actually include the link to the pastebin ...

http://pastebin.test.redhat.com/110804

Comment 3 Peter Portante 2012-10-12 19:10:11 UTC
Here are the results of the same operation but with a patch applied to remove the extra system calls (from 13 down to 3).

http://pastebin.test.redhat.com/110818

Comment 4 Peter Portante 2012-10-12 19:11:21 UTC
Created attachment 626189 [details]
Initial patch to remove the use of deprecated pyxattr methods.

Comment 5 Peter Portante 2012-10-12 19:12:00 UTC
Created attachment 626190 [details]
Actual fix to remove extra system calls.

Comment 6 Vijay Bellur 2012-10-13 17:40:51 UTC
CHANGE: http://review.gluster.org/4077 (Refactor to use pyxattr's get/set/remove methods) merged in master by Anand Avati (avati)

Comment 7 Vijay Bellur 2012-10-13 17:45:00 UTC
CHANGE: http://review.gluster.org/4078 (Fix BZ 865858: remove unnecessary system calls around xattr ops) merged in master by Anand Avati (avati)


Note You need to log in before you can comment on or make changes to this bug.