after upgrade from 11.1 to 11.2 release tivoli storage manager client (TSM) fails due to incorrect listxattr implementation. listxattr should return error -EOPNOTSUPP if file system does not support extended attributes and no error and result 0 if file does not have extended attributes. With 11.2 listxattr returns -ENODATA in the second case. On linux output of strace of listxattr of directory ./nano without extended attributes: listxattr(".nano/", NULL, 0) = 0 On FreeBSD output of ktrace of listxattr of directory without extended attributes: 54332 dsmc RET linux_llistxattr -1 errno -61 Attribute not found Following change in code between 11.1 and 11.2 led to the emergence of the bug. In 11.1 EOPNOTSUPP was returned instead of ENODATA. This change may seem correct for other linux xattr calls, but not for listxattr. *** linux32_sysvec.c Mon Jan 7 18:30:21 2019 --- linux32_sysvec.c-11.2 Fri Jun 22 01:02:23 2018 *************** *** 146,152 **** -100,-101,-102,-103,-104,-105,-106,-107,-108,-109, -110,-111, -40, -36,-112,-113, -39, -11, -87,-122, -116, -66, -6, -6, -6, -6, -6, -37, -38, -9, ! -6, -6, -43, -42, -75,-125, -84, -95, -16, -74, -72, -67, -71 }; --- 146,152 ---- -100,-101,-102,-103,-104,-105,-106,-107,-108,-109, -110,-111, -40, -36,-112,-113, -39, -11, -87,-122, -116, -66, -6, -6, -6, -6, -6, -37, -38, -9, ! -6, -6, -43, -42, -75,-125, -84, -61, -16, -74, -72, -67, -71 };
Seems to be a regression from r326282. Shouldn't the change have also modified the xattr stubs to return EOPNOTSUPP instead of ENOATTR?
The listxattr and other extattr related linux emulator calls are implemented as dummy calls. See DUMMY_XATTR macro in the linux_dummy.c. The dummy calls return values are ENOATTR in all cases. After the bsd_to_linux_errno mapping the linux ENODATA (-61) will be returned. Before the r326282 it was linux EOPNOTSUPP (-95). It is possible to change dummy calls return values from ENOATTR to EOPNOTSUPP. I am not clearly understand, why it was not done from beginning? Is it possible to affect someone if the error code will be changed?
(In reply to Fedor Uporov from comment #2) Indeed, I think the stubs should be modified to return EOPNOTSUPP. I'm not sure why it wasn't that way before... with the previous translation of ENOATTR it just "worked" so I guess it was a bug that nobody noticed. Since you were in that area, would you like to fix it?
(In reply to Mark Johnston from comment #3) Ok, I will prepare the phabricator review soon.
MFC`ed to stable/11. Revision: r342999