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 1895F318EC7 for ; Tue, 21 Jul 2026 00:47:30 +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=1784594852; cv=none; b=GX4c92HLf+zooHjjd7rXtcbCpt8ftsugEHA5UOnAO7iYwOyqilnYlPOmxsOmJ3vUKywnjRddfMFqL2X5ZWEhEJsxCXutkDCjQvS5+Il1kBzRh4DOXfv4ZF755sGGdm1QBaqmLswHF2Syt3qw18Zd2xWWXA8bAkN/SYo3XyhSck8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784594852; c=relaxed/simple; bh=QbBeyD92MhZxFWHXoAdOPcHr/VvMjlSF/v4vnuwlBik=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=Wo4vAPMG1oIOzqXUSd67YEyM2L/C3cTWXsDqqI99ItoXtMGa4c0dZpcBqUkRoCOcMYsU17ZDL+HFsO6+yVJJcj/aYEjaiBSwYEFcReJ58Jsl4UnzHA27zJKz4rwWDXE11eMa8AlZIVpOojo8E5a4/tLmIWgmA9xqo1IXzfaWY98= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fXoJK6QC; 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="fXoJK6QC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAE1B1F000E9; Tue, 21 Jul 2026 00:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784594850; bh=Qe4dxL2O/OqQk5rOLVOCDy8ZLVEizuB81/dqZgzj2ck=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=fXoJK6QCD8VJuuAQVXPH2JRgJXEEHoYLDcfiWzMM/4zT63SaV61CK4wO5WaTZ03LF LodzRaqokD/DCOisjaN+u1rOcQiSkc3mUrzbZyyn58FluP4Sqrm/uH0Qo8Unz8elCz WZl9r1qAHwtCJsjKfIhJb+MKuSzSSTilrk40QeF9WLMzIctEX1vwZODPUX6QUS7qfn DD2z455pMccjToP8S52TatMNwdFaxoQ9hYM/REivgGFQGDGbGsWjMGJVdTLHOqIqA3 z+YKi1edqtiCrUbm3f6h9fl45WCYwMNdsqJ8Q5x4AA1VJ+kPqx0GX41XCP/2zvQf5j FW3l1vAKnw2Hg== Message-ID: Date: Tue, 21 Jul 2026 08:47: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, jaegeuk@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> 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/19/26 17:05, Guanghui Yang wrote: > Thanks for taking a look. > > f2fs_reserve_block() drops the dnode only when the inode folio was not > provided by the caller: > > bool need_put = dn->inode_folio ? false : true; > ... > if (err || need_put) What about err is non-zero? > f2fs_put_dnode(dn); > > In this path, f2fs_move_inline_dirents() passes ifolio through > set_new_dnode(), so need_put is false and f2fs_reserve_block() keeps the > caller-provided folio. > > The caller of do_convert_inline_dir() also drops ifolio only on success: > > err = do_convert_inline_dir(dir, ifolio, inline_dentry); > if (!err) > f2fs_folio_put(ifolio, true); > > Therefore, when f2fs_reserve_block() fails, the ifolio reference still > appears to need cleanup in f2fs_move_inline_dirents(). I kept the cleanup > local to avoid changing f2fs_reserve_block() semantics for other callers. > > Thanks, > Guanghui >