Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp250495lqo; Thu, 9 May 2024 20:37:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgFWgy3hN5EJPkp5nTUgPmdDaoN7J2ZdI/rnT7vTBW7x24yqDpBbgJUgpSGD66YoroPfHqt1FnOrZa6UttcDJkelNCD2MF/SxywjTeRQ== X-Google-Smtp-Source: AGHT+IFwbgM/erb651KBgbbluVJ4ZA3472F2OivOAiG5Kc/NX7D4zDVnav6sRzlByXL7rSrgA9nP X-Received: by 2002:a05:622a:1b87:b0:43a:a8ad:7954 with SMTP id d75a77b69052e-43dfdaf2107mr12822901cf.28.1715312229763; Thu, 09 May 2024 20:37:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715312229; cv=pass; d=google.com; s=arc-20160816; b=a7XCGXbH0eAxOwYP2/pt7O77XiCMa1efAfZ3bZAnXiwizlEfuAGay3FosN2gOJvkfm OZ6V2nrUfO/vPQAzPFSe8ipY0GAyFZjeFVqHYQZ2mBmDVdKyb2+HeFjoq1ZXaKgVP4Sg HXAj154VGaPMxVDV6KFXD79/C7Cel1acl0tF4R5esTSion7VyIF6zq7T97iqKwwWOH6N cb7esgPS6djttR+X9hvcB4a4aNZq6tUE854EsbjKBAaR+YRyzbxVpy96kXEFopht3CMu rlGvY+pTfM+Buk+Pr32CcwYlwRQ63MhOnyWraVRnpGPzZ22fog1gTzuskLSdnbTeQn4x nBSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=UYMElMAXHutQ9TEBBxQI23YG7Q3h1CCb5i1x2aGQOeA=; fh=imjFzjLG4qph4h5QWRTC1cq+KRDJyzf1iF2L5GqgaZs=; b=DMeoymNOgKQ0FYip+PEdNeuHzIWsBOVQ5LyK8tAege2QIwED9RhXPe/epHxwO4oAS7 +Lg/0JXj3jYlN0wnMAuSisgEt4ff3Xjw3jlj1UYgSlbnmfeQLrWrHPYAfpptyUEGT2ch ibJ879/a4u6nhPDjgxk6gUAhDpEOiz/6wnZLjpwBbEjrSdSdWwvHRKbfkJ+AIDhZ0tQA QxACEF23/FPNTftkiVVonwq/I4AoQaP5vuOW+Bk2MXxyuvYRhwDW36ds5jrJOstHRT4s EGShj69DPH1eqlaFmxM8Oh6S21Kzz1Y8FM7GURalbANhegykJY5Xh5g+gLbCJG8bdc3C F+Ow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hBP8m2hQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-175255-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df56d4f9csi11412331cf.703.2024.05.09.20.37.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 20:37:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175255-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hBP8m2hQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-175255-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 80C571C21EBB for ; Fri, 10 May 2024 03:37:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A1C8149C4A; Fri, 10 May 2024 03:36:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hBP8m2hQ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 99310524C4 for ; Fri, 10 May 2024 03:36:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715312217; cv=none; b=aMZQ3ODzvaA/IXFw76+Z7cXPhAInyo6WeeoL2gWwHYB9F79/IhlXAtYKO5WW69FZpBo3fkGzz1GnLe1xWwybVNqbRHI2sCshFW7wQsP4NPBReRTQ9Nzrme5yd1HTv7TbfqE5qVuOxrDJxa1LdRywu8D37cjdfXgowb12e77Kf90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715312217; c=relaxed/simple; bh=1KviGYd5beyNX2PBlLyIIAQ0SMbAih+SYoo5RKeNBEE=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=Rtv+O6A5iKpbW98O7kOJhjLGpdyPVjhWE8HLR+q3hZrv5k64t8LyNo+ZKBreKn8ji3A8nIc/0WIVpVO3ZWMy7rXiyFKl97CICDy6Mrw3BibhQWOMXoMXQc1zEpGMDQCnkKogGYk5oETEZlPnjR+pN7Kh5C4xp1B43IE0Jy0+GrQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hBP8m2hQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9137DC113CC; Fri, 10 May 2024 03:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715312217; bh=1KviGYd5beyNX2PBlLyIIAQ0SMbAih+SYoo5RKeNBEE=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=hBP8m2hQxhieQldc8KDb6vku9VRUD5vfmOv6LIxyK18cKM8+DqLMF/LmKoZXwVwz6 bIOmr+nPSe9hZ+8tfjV5080kM100ppP4/QghvFkZoNdbdwCfvo7zk9LT8yw2Zxxfq5 iXfwpgKihp90C8K4Lii7hB1Q0xbo5fDvtKrUTx4DoRKcFY0DbGOryRYorHW0IlvEBu ulS8j5OIsfEfapYP0XtG/9dvXQv2pkqKlz56uwdaugCTt1YEqhPRaSlbUcpL6kRXDa d1OxZnwDVdj58W7vE6tUzSlUJgugIILJpXRCEjnn16/qGqmjE+IWw4kxWXYI4fHKpc JOdkeAsUnNDaA== Message-ID: Date: Fri, 10 May 2024 11:36:54 +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 Subject: Re: [f2fs-dev] [PATCH 2/3] f2fs: fix to add missing iput() in gc_data_segment() From: Chao Yu To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <20240506103313.773503-1-chao@kernel.org> <20240506103313.773503-2-chao@kernel.org> <32e097e6-67f1-4f06-bad0-0c7b3afb46f0@kernel.org> Content-Language: en-US In-Reply-To: <32e097e6-67f1-4f06-bad0-0c7b3afb46f0@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/5/9 10:49, Chao Yu wrote: > On 2024/5/9 8:46, Jaegeuk Kim wrote: >> On 05/06, Chao Yu wrote: >>> During gc_data_segment(), if inode state is abnormal, it missed to call >>> iput(), fix it. >>> >>> Fixes: 132e3209789c ("f2fs: remove false alarm on iget failure during GC") Oh, this line should be replaced w/ below one, let me revise the patch. Fixes: b73e52824c89 ("f2fs: reposition unlock_new_inode to prevent accessing invalid inode"). Thanks, >>> Fixes: 9056d6489f5a ("f2fs: fix to do sanity check on inode type during garbage collection") >>> Signed-off-by: Chao Yu >>> --- >>>   fs/f2fs/gc.c | 9 +++++++-- >>>   1 file changed, 7 insertions(+), 2 deletions(-) >>> >>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >>> index 8852814dab7f..e86c7f01539a 100644 >>> --- a/fs/f2fs/gc.c >>> +++ b/fs/f2fs/gc.c >>> @@ -1554,10 +1554,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, >>>               int err; >>>               inode = f2fs_iget(sb, dni.ino); >>> -            if (IS_ERR(inode) || is_bad_inode(inode) || >>> -                    special_file(inode->i_mode)) >>> +            if (IS_ERR(inode)) >>>                   continue; >>> +            if (is_bad_inode(inode) || >>> +                    special_file(inode->i_mode)) { >>> +                iput(inode); >> >> iget_failed() called iput()? > > It looks the bad inode was referenced in this context, it needs to be iput()ed > here. > > The bad inode was made in other thread, please check description in commit > b73e52824c89 ("f2fs: reposition unlock_new_inode to prevent accessing invalid > inode"). > > Thanks, > >> >> >>> +                continue; >>> +            } >>> + >>>               err = f2fs_gc_pinned_control(inode, gc_type, segno); >>>               if (err == -EAGAIN) { >>>                   iput(inode); >>> -- >>> 2.40.1 > > > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel