[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e878e14a-eec7-4df4-b33d-f2defa8a92cb@linux.alibaba.com>
Date: Fri, 15 Nov 2024 07:26:31 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: linux-erofs@...ts.ozlabs.org, LKML <linux-kernel@...r.kernel.org>,
syzbot+0b1279812c46e48bb0c1@...kaller.appspotmail.com
Subject: Re: [PATCH v2] erofs: fix file-backed mounts over FUSE
On 2024/11/15 00:18, Al Viro wrote:
> On Thu, Nov 14, 2024 at 05:01:09PM +0800, Gao Xiang wrote:
>> --- a/fs/erofs/data.c
>> +++ b/fs/erofs/data.c
>> @@ -38,7 +38,9 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset,
>> }
>> if (!folio || !folio_contains(folio, index)) {
>> erofs_put_metabuf(buf);
>> - folio = read_mapping_folio(buf->mapping, index, NULL);
>> + folio = buf->file ? read_mapping_folio(buf->file->f_mapping,
>> + index, buf->file) :
>> + read_mapping_folio(buf->mapping, index, NULL);
>> if (IS_ERR(folio))
>> return folio;
>> }
>> @@ -61,8 +63,8 @@ void erofs_init_metabuf(struct erofs_buf *buf, struct super_block *sb)
>> {
>> struct erofs_sb_info *sbi = EROFS_SB(sb);
>>
>> - if (erofs_is_fileio_mode(sbi))
>> - buf->mapping = file_inode(sbi->fdev)->i_mapping;
>> + if (erofs_is_fileio_mode(sbi)) /* some fs like FUSE needs it */
>> + buf->file = sbi->fdev;
>
> Would be easier to set *both* ->mapping and ->file at that point, so that
> erofs_bread() would just have read_mapping_folio(buf->mapping, index, buf->file),
> unconditionally...
Ok, will do the next version.
Thanks,
Gao Xiang
Powered by blists - more mailing lists