Hi,<br><br>I have a question about function ll_listxattr(). According to the standard, listxattr(2) should return -1if the size of the list buffer is too small to hold the result. However ll_listxattr() will return a value bigger than buffer size in some cases.<br>
<br>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 got the result on Lustre-2.2. I believe it is not a correct result.<br>
<br>The following codes in ll_listxattr() causes this problem:<br><br> if (buffer && (rc + total_len) <= size) {<br> buffer += rc;<br> memcpy(buffer,XATTR_LUSTRE_PREFIX, prefix_len);<br>
memcpy(buffer+prefix_len, "lov", name_len);<br> buffer[prefix_len + name_len] = '\0';<br> }<br> rc2 = total_len;<br><br>I think when '(rc + total_len) <= size' is false and the buffer is not NULL, the return valuse should be set to -1.<br>
<br>Is that a problem or a feature?<br><br>Thanks,<br><br>Li Xi<br>