[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241114060434.GL3387508@ZenIV>
Date: Thu, 14 Nov 2024 06:04:34 +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] erofs: fix file-backed mounts over FUSE
On Thu, Nov 14, 2024 at 01:19:57PM +0800, Gao Xiang wrote:
> diff --git a/fs/erofs/data.c b/fs/erofs/data.c
> index 6355866220ff..43c89194d348 100644
> --- a/fs/erofs/data.c
> +++ b/fs/erofs/data.c
> @@ -38,7 +38,10 @@ 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->use_fp ?
> + read_mapping_folio(file_inode(buf->filp)->i_mapping,
> + index, buf->filp) :
> + read_mapping_folio(buf->mapping, index, NULL);
UGH...
1) 'filp' is an atrocious identifier. Please, don't perpetuate
the piss-poor taste of AST - if you want to say 'file', say so.
2) there's ->f_mapping; no need to go through the file_inode().
3) AFAICS, (buf->kmap_type == EROFS_KMAP) == (buf->base != NULL). What's
the point of having that as a separate field?
4) Why bother with union? Just have buf->file serve as your buf->use_fp
and be done with that...
Powered by blists - more mailing lists