[PATCH v7] erofs-utils: add support for fuse 2/3 lowlevel API

Gao Xiang hsiangkao at linux.alibaba.com
Thu Aug 31 21:05:16 AEST 2023



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


More information about the Linux-erofs mailing list