Received: by 10.213.65.68 with SMTP id h4csp1768350imn; Mon, 19 Mar 2018 12:44:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELsGHE+euP6hSiMaoWHFWLy3vOPAng/oPqHwu0LrOkl8atQAmNwVYpTSpMHwRqOM0b+H11iZ X-Received: by 10.99.108.202 with SMTP id h193mr10216021pgc.325.1521488640884; Mon, 19 Mar 2018 12:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521488640; cv=none; d=google.com; s=arc-20160816; b=KHh1E0HeLg2waUyZmWxYJcVwT3YQXBfjXhxz0PYxcXOTdWf7lDD7Bnf+IenHI3W3Sd QoIq649EKU9dW2DjorDl9n4+kz8q8vvbaKoFxL3jXhi6nh+6nF2hojFI3V3EpiKz0dZm fERfmeysRG8mtjV4m8T3Ruocq+QT7Nt90i9dtsl+bP6m0JaSMNN8wI6JnUKgmPkYzoOf rJWrIdV+X0qdZoXiVlKKSKUHxYYxBWUcXJTFToiMO6j8ceX1nad+oYSp4xaTkNSAjnxB SHS30jl2Ima3NoddD6Vrws5pFMXahAEluYXgiXUEXfZ8XOVWjkQcf3PvvS97Dkkf0JEz LFgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=IvyYWFmbopNw8zTnEfdCGbOwWtNcoe9+panq6O/QAgU=; b=LVnWl9RyEP6MXjys49VFIvuP0j51RcH06u1DhBr0tEeRFLqnKQ1fO304pI8lPqnQgv Iu5dPHGnYb4UBB+HiWavEq7UAwIO/HXT158khIz04jlpaeWemLfCtTvfzE6l1SFsnxrp y8dDYIBwEhavb54DRnh/rlEwx6joec8Gxcb5Kw/LgM3YUGtxyaH203BK4QRqpYPBpBeF 9RYmxQLkVtq+XTKLQ/6xb31j37c6vJ+0rEyEZ+rr+yIuZZbuXEncKxpbjsSw7F0WWRmP EcbvzKI0Adpbsq2mKZEd/A74Q7Q1Kkj3B327EIXgK9ODIFkqzz13rD5OPup5sMcxkN1x i2VA== ARC-Authentication-Results: i=1; mx.google.com; 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 e127si422509pfc.315.2018.03.19.12.43.46; Mon, 19 Mar 2018 12:44:00 -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; 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 S969599AbeCSTm0 (ORCPT + 99 others); Mon, 19 Mar 2018 15:42:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48160 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966229AbeCSSVe (ORCPT ); Mon, 19 Mar 2018 14:21:34 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C2FD9127A; Mon, 19 Mar 2018 18:21:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunlei He , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.9 082/241] f2fs: relax node version check for victim data in gc Date: Mon, 19 Mar 2018 19:05:47 +0100 Message-Id: <20180319180754.596539198@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jaegeuk Kim [ Upstream commit c13ff37e359bb3eacf4e1760dcea8d9760aa7459 ] - has_not_enough_free_secs node_secs: 0 dent_secs: 0 freed:0 free_segments:103 reserved:104 - f2fs_gc - get_victim_by_default alloc_mode 0, gc_mode 1, max_search 2672, offset 4654, ofs_unit 1 - do_garbage_collect start_segno 3976, end_segno 3977 type 0 - is_alive nid 22797, blkaddr 2131882, ofs_in_node 0, version 0x8/0x0 - gc_data_segment 766, segno 3976, block 512/426 not alive So, this patch fixes subtle corrupted case where node version does not match to summary version which results in infinite loop by gc. Reported-by: Yunlei He Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/gc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -538,8 +538,10 @@ static bool is_alive(struct f2fs_sb_info get_node_info(sbi, nid, dni); if (sum->version != dni->version) { - f2fs_put_page(node_page, 1); - return false; + f2fs_msg(sbi->sb, KERN_WARNING, + "%s: valid data with mismatched node version.", + __func__); + set_sbi_flag(sbi, SBI_NEED_FSCK); } *nofs = ofs_of_node(node_page);