[LU-3403] error return value of listxattr when buffer is not large enough Created: 27/May/13  Updated: 16/Oct/13  Resolved: 16/Oct/13

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.3.0, Lustre 1.8.9
Fix Version/s: Lustre 2.5.0

Type: Bug Priority: Major
Reporter: Li Xi (Inactive) Assignee: Keith Mannthey (Inactive)
Resolution: Fixed Votes: 0
Labels: client, patch

Attachments: File listxattr.patch     File read_xattr.c    
Severity: 3
Rank (Obsolete): 8420

 Description   

According to the standard, listxattr(2) should return -1 and errno should be set to ERANGE if the size of the list buffer is too small to hold the result. However ll_listxattr() will return a value bigger than the size of buffer in some cases.

Let's assume listxattr(2) returns SIZE when it is called with a large enough list buffer. If it's called with a list buffer whose size is smaller than SIZE but bigger than (SIZE - 12), then listxattr(2) will return SIZE too. I believe it is not a correct result.

Attached file 'read_xattr.c' is the code which can reproduce the problem. It runs perfectly on normal file system, but fails on Lustre.

Attached file 'listxattr.patch' is the patch that fixed the problem. The program of 'read_xattr.c' runs well when the patch is applied.



 Comments   
Comment by Peter Jones [ 27/May/13 ]

Hi Li Xi

I know that you are familiar with gerrit because I saw you upload a patch there recently. Please can you upload any patches you would like us to review into gerrit? This both allows our automated testing to verify the patch and also serves as the signoff permission for us to land the patch into the Lustre tree.

Thanks

Peter

PS/ Also, I am unclear why you have marked this as a blocker. Could you please elaborate?

Comment by Li Xi (Inactive) [ 27/May/13 ]

Hi Peter,

Sure. I'm pushing the patch to the gerrit. It will be finished soon.

And I'm sorry if the 'blocker' option bothers you. The bug affected an application months ago. But we walked aroud it. So I'd like to change it if it's possible to.

Thanks
Li Xi

Comment by Peter Jones [ 27/May/13 ]

ok thanks li xi!

Comment by Li Xi (Inactive) [ 27/May/13 ]

I've pushed the patch into gerrit. http://review.whamcloud.com/#change,6463

Comment by Peter Jones [ 27/May/13 ]

Thanks Li Xi!

Keith

Can you please review this patch and in particular whether a similar issue exists on master

Thanks

Peter

Comment by Keith Mannthey (Inactive) [ 29/May/13 ]

Perhaps we can add this test as well. How should your program be used to detect this error?

Comment by Li Xi (Inactive) [ 29/May/13 ]

We can use the test program like this:

gcc read_xattr.c -o read_xattr
./read_xattr /mnt/lustre/some_file

When it is run on Lustre without the fix patch, it will compain and exit. When it is run on Lustre with the patch, everything is OK.

Comment by Keith Mannthey (Inactive) [ 08/Jun/13 ]

I have added a test for this issue. It is dependant on the fix.

It can be seen here: http://review.whamcloud.com/6594

Comment by Jodi Levi (Inactive) [ 16/Oct/13 ]

Patches have landed to Master. Please let me know if more work is needed in this ticket and I will reopen.

Generated at Sat Feb 10 01:33:37 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.