Hi Xiang, Thank you for your reminder, I will reconsider the reply_err part.
Here is more information about the workaround. It can be considered that the return of size=0 is an interface specification that users should follow. https://github.com/philips/attr/blob/master/getfattr/getfattr.c#L298 I will complete the modification of the lib in V8 and delete the workaround. On 2023/8/31 19:05, Gao Xiang wrote: > > > On 2023/8/31 18:48, Li Yiyan wrote: > > ... > >>>> + >>>> + vi->sbi = &sbi; >>>> + vi->nid = (erofs_nid_t)ino; >>>> + ret = erofs_read_inode_from_disk(vi); >>>> + if (ret < 0) { >>>> + fuse_reply_err(req, EIO); >>> >>> Maybe reply -ret? Since there are other errors in >>> erofs_read_inode_from_disk. >> >> No. As mentioned in declaration, param err represents the *positive* error >> value, >> or zero for success. > > I think Jianan meant: > if (ret < 0) { > fuse_reply_err(req, -err); > > instead. > >>> > > ... > >>> >>>> + return; >>>> + } >>>> + >>>> + if (bufsize == 0) >>>> + bufsize = EROFSFUSE_XATTR_BUF_SIZE; >>> >>> Why do we need to reconfigure bufsize here? erofs_listxattr should >>> handle bufsize of 0. >> >> >> This is a workaround for the time being, I will propose a patch to modify >> the lib >> to solve this problem. >> >> As mentioned in https://man7.org/linux/man-pages/man2/listxattr.2.html: >> >> "If size is specified as zero, these calls return the current size of the >> list of >> extended attribute names ( and leave list unchanged). This can be used to >> determine >> the size of the buffer that should be supplied in a subsequent call." >> >> Therefore, buf=0 means that we need to use fuse_reply_xattr to return the >> requested >> size of the buffer. Only when buf is not 0 do we need to copy xattr to >> buffer. >> At present, the erofs_getxattr cannot solve this problem, so a workaround is >> made on the fuse layer to temporarily solve this problem and >> control the extent of the patch. > > Are you sure that erofs_listxattr() cannot accept NULL buffers? > I'm totally confused. > > Anyway, if erofs_listxattr() unmeet your requirement for whatever > reasons, please fix this instead. > > Thanks, > Gao Xiang Thanks, Yiyan
