From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D5C623392B for ; Sun, 19 Jul 2026 07:21:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784445692; cv=none; b=oAxz0Pqlg9jO8OBWpGkWqL1gYfGJYQiKdXL8VCe+sgGB0G/Hb0cyeJLQyFnG7SwiTgkEmjhSYqNz/M0VIdp3tmAKKdYJXMf08xClenwyHSniJ9J5X855SxFS1Sa2HNVxW3ZeMFpRIMDbLgl1fJo2SygGwsSsYvEsJM4BwCHojDw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784445692; c=relaxed/simple; bh=J/he51CHN/LfD5/K4KRwDtoa7RJ2bCf7vzQdhs0CYP8=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=gTOPDGgfXBHgcH27bhQz0nJjghh5AL3PIzu3/9AC1/6dOKP6xtEhqanqH+SXHG0uqV5+Di4gwTQqBk4+HJ8+Yl61lQajZad3kuiD179cmJswEK5c8rLGyWoCv++rPbQDMiMAK2Ru9YIc1+jzZKW5PvUBPn9m/O7YuQLmDG16agg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R5ssUMUU; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R5ssUMUU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3E9B1F000E9; Sun, 19 Jul 2026 07:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784445691; bh=9jIKAlXv/4RICULVFLnh1Fr9bNKFdUEweKxXxJ3WsFE=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=R5ssUMUUeI78sn/WvsFCuyiMnBhNrYWTCD5rlCpQmUHYvES3jAhxZIjcHMyhGGLL8 KwtlTHyTbv44xXM2zMqBoe6mEI0//1Ec14F7RpQEn9RYRRfIkgcSOeKBK4dEBkKXbF hYn19owUNnG3vB/6HzK2q2M++Xd9BA5PamtNVnZb/40S+GCo0tK+D3Kv78nYaW6PNj bgjSiIZf6C3VZvJ1Lg8O3yJp12vosf1uU3buJ9Il044XnvmHK1wF4k1TRT5vgX875v h8UhGrqATz+slqv4bVwc2zsgxc5xcrFOmKCCwBqwFsN+5STXE+5HxrlfU0arMmgyQu XdBj/N26CoSzg== Message-ID: Date: Sun, 19 Jul 2026 15:21:27 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH] f2fs: fix ifolio leak in f2fs_move_inline_dirents To: Guanghui Yang <3497809730@qq.com>, Jaegeuk Kim References: Content-Language: en-US From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/13/26 14:40, Guanghui Yang wrote: > f2fs_move_inline_dirents() documents that the caller grabs ifolio, and > that the function should release it on any error. > > The f2fs_grab_cache_folio() failure path already drops ifolio, but the > f2fs_reserve_block() failure path only drops the newly grabbed folio at > the shared out label. If f2fs_reserve_block() fails before clearing > dn.inode_folio, the caller's ifolio reference is left behind. > > Release ifolio on this error path when dn.inode_folio is still set. > > Signed-off-by: Guanghui Yang <3497809730@qq.com> > --- > fs/f2fs/inline.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c > index e2f7bedf1552..dea4ab957de8 100644 > --- a/fs/f2fs/inline.c > +++ b/fs/f2fs/inline.c > @@ -427,8 +427,11 @@ static int f2fs_move_inline_dirents(struct inode *dir, struct folio *ifolio, > > set_new_dnode(&dn, dir, ifolio, NULL, 0); > err = f2fs_reserve_block(&dn, 0); f2fs_reserve_block() can handle the error case in itself? Thanks, > - if (err) > + if (err) { > + if (dn.inode_folio) > + f2fs_folio_put(ifolio, true); > goto out; > + } > > if (unlikely(dn.data_blkaddr != NEW_ADDR)) { > f2fs_put_dnode(&dn); > > base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa