[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241114161823.GN3387508@ZenIV>
Date: Thu, 14 Nov 2024 16:18:23 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Gao Xiang <hsiangkao@...ux.alibaba.com>
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 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...
Powered by blists - more mailing lists