Details
-
Bug
-
Resolution: Fixed
-
Major
-
Lustre 2.3.0, Lustre 1.8.9
-
3
-
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.