]> git.dujemihanovic.xyz Git - linux.git/commit
erofs: fix refcount on the metabuf used for inode lookup
authorSandeep Dhavale <dhavale@google.com>
Wed, 21 Feb 2024 21:03:47 +0000 (13:03 -0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 22 Feb 2024 07:54:21 +0000 (15:54 +0800)
commit56ee7db31187dc36d501622cb5f1415e88e01c2a
treea77550519ec7d80d1dd726f04135399477de8170
parent841c35169323cd833294798e58b9bf63fa4fa1de
erofs: fix refcount on the metabuf used for inode lookup

In erofs_find_target_block() when erofs_dirnamecmp() returns 0,
we do not assign the target metabuf. This causes the caller
erofs_namei()'s erofs_put_metabuf() at the end to be not effective
leaving the refcount on the page.
As the page from metabuf (buf->page) is never put, such page cannot be
migrated or reclaimed. Fix it now by putting the metabuf from
previous loop and assigning the current metabuf to target before
returning so caller erofs_namei() can do the final put as it was
intended.

Fixes: 500edd095648 ("erofs: use meta buffers for inode lookup")
Cc: <stable@vger.kernel.org> # 5.18+
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20240221210348.3667795-1-dhavale@google.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/namei.c