Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2980597ybi; Sun, 28 Jul 2019 22:24:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqybEAeRgTcyLtmorq0dkyxmThzsabjMVlljJKe9ki6KPvRQB73V4jFg79cTb8iZmLt1tdLs X-Received: by 2002:a63:121b:: with SMTP id h27mr87296197pgl.335.1564377854148; Sun, 28 Jul 2019 22:24:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564377854; cv=none; d=google.com; s=arc-20160816; b=XTb4EEyDvvJ/2LPl4DlEbdsIWDAOzTl1soVRouLJTtfivnTGB082tN45H3XMm4oLRv U4etemjZLm+FGbQIUVy65bxh20pEymyIGLQlBH4C1Z0Uwqvy/ffleowoBfWUyvdAivnJ dHBjEjba+qyNdODcSdXTWXfUrm1f8a0OSIWa16kpXMvnFxKLPwu36amTvg8EaDv4X8OG Qfk7JvAZEE1XY+vs10NFXNmHxwOaQhFxO+SmBcjRWYq8pqiLAZPfbBWZ++QCiyYlNNJ8 PsOHvekix7yGeqq+/xs6UVFm3U1FPHB3Rh3IXGOHgNszJqvr/wAB5fOJh+PTXBWBAekO zoRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=LkTjUfmQDq8uMDFINyNdIgkyee+pL/ShRxiQCY5zjOY=; b=E5z5tbGt7qazHkslJLPPwXXJTuv0tcbGNEHIcEs+zGou/gZ97+mD2PwyeoSssd7R1p 23x1zNBD6qd5U0IzfV9ZBDY9NgZ3OxGRNOPeZijrxfTBv+EcaZaunXSGXaO06I05PQBz scRCdvugch+q0ln7OWepn0FN6BQQ75KTQ9ryiG1G8YpjlucPrHc/NoYWpF0b/AkWf6TH 0YsM/VcQBhCK1fzg9zD8Hd8G3vzBJAEPqNyrZxaT0ZZW9Tm+3Xer7dgknsWHIxaZ39Xl dAUgzI+o7/T1s+xsmwENkVgcW5oS9JaO1Yo2vxwtWo131RavojWji3d/7C2BWR9p+P5s 3HbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=h8jFmrSe; dkim=pass header.i=@codeaurora.org header.s=default header.b=MoVOvdoM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4si23881513pgf.383.2019.07.28.22.23.58; Sun, 28 Jul 2019 22:24:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=h8jFmrSe; dkim=pass header.i=@codeaurora.org header.s=default header.b=MoVOvdoM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbfG2FU5 (ORCPT + 99 others); Mon, 29 Jul 2019 01:20:57 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:35456 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726332AbfG2FU5 (ORCPT ); Mon, 29 Jul 2019 01:20:57 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7550A6030E; Mon, 29 Jul 2019 05:20:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1564377656; bh=nn4l3B+Tf7YJji7ydB+5u0cuzi2/Yx4Dzyvf35VIPO8=; h=From:To:Cc:Subject:Date:From; b=h8jFmrSePKbG9gt57DG3JtGI2HdMWMa7N6SaBfPf4YAdjuiKtgZGvFKWFo64VDlmw uDmnAdeidhgDmcWiKJ3wabDbMVmZxJeBIfQzk0YIIQluYT2JQV6WWia4TwnhNkNfEo n7BJr/KEagkqnrOtWG3kABeD6OyyZk3rrovyA3/k= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: stummala@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3A327602B7; Mon, 29 Jul 2019 05:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1564377655; bh=nn4l3B+Tf7YJji7ydB+5u0cuzi2/Yx4Dzyvf35VIPO8=; h=From:To:Cc:Subject:Date:From; b=MoVOvdoMsDTX6km6I4LYGbfkxBkA2gaHNqg7J9xiJDVjdSzrH7DaCWI6oiqFHSk/N ab+Nwsfa+68RPogtLX/4oHZnN7r27IU/Yf5NjYARul53+pIx3vh1OSaNxFWdwXTfNj d4gntsIaM7gI7GLAQG4Yuo+yKONkMAN67PoMRQOc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3A327602B7 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=stummala@codeaurora.org From: Sahitya Tummala To: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Cc: Sahitya Tummala , linux-kernel@vger.kernel.org Subject: [PATCH] f2fs: Fix indefinite loop in f2fs_gc() Date: Mon, 29 Jul 2019 10:50:26 +0530 Message-Id: <1564377626-12898-1-git-send-email-stummala@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Policy - foreground GC, LFS mode and greedy GC mode. Under this policy, f2fs_gc() loops forever to GC as it doesn't have enough free segements to proceed and thus it keeps calling gc_more for the same victim segment. This can happen if the selected victim segment could not be GC'd due to failed blkaddr validity check i.e. is_alive() returns false for the blocks set in current validity map. Fix this by not resetting the sbi->cur_victim_sec to NULL_SEGNO, when the segment selected could not be GC'd. This helps to select another segment for GC and thus helps to proceed forward with GC. Signed-off-by: Sahitya Tummala --- fs/f2fs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 8974672..7bbcc4a 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1303,7 +1303,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, round++; } - if (gc_type == FG_GC) + if (gc_type == FG_GC && seg_freed) sbi->cur_victim_sec = NULL_SEGNO; if (sync) -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.