Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp145119pxa; Tue, 18 Aug 2020 19:05:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu9Mbovboi40BNHVhtk+487K1TZJp2ukFQhUHPOJXcP9JchlMTrkLCki6KwmO9rdWQkxHW X-Received: by 2002:aa7:ccd5:: with SMTP id y21mr21935034edt.91.1597802704242; Tue, 18 Aug 2020 19:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597802704; cv=none; d=google.com; s=arc-20160816; b=OuJnsCbEjuN2iktn3nOXbFsiJ7MQoVhSWRx8KVMpha1j8dvCRMGNn88077KoRtnKNQ p2Ktqb28Dt5OMl5Sr3dJ55YarHXPl5nAWN+ctm/tDcJfLdv0wr7nEBTgogm+Ila/WwIu CbiP6FQxcp5b+rnFs5Y2SP/W9eD+9HR8vb51ZprfNhE37H/3XS8PnOFy6lDqkTwIyKFK ZYPwDycdHqof6YQDDsFDLFf9CrKSxJfmd63vVTrjjPa0HBpSUH0OARg3bDeICULDsx8/ SZSFzrhxGcemJopLDCxm2zjQEbrq/0WJ1Z895c0o+kX5WLOV5gujjO0uq8T8rIIrGMCC HRdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=kXYyV9Kk7LJG8V/NUSeKCNSH7u96kxaXdfUZnw0VLv4=; b=LW7JIjiTyeXCASsAupBsM+uWosKjBlSlR+JIW78J6wt5rlmDjCgEgwvtIU4NwAKSpm +nNIpN9tBoELzp/txKtr7cBAqRrlUDofrK7yeimPpgPF8wqfY0ESN/ud8MSvY5DtjWo6 TY91UWIfN64wtN3nWlRcTZig8/k5/LxpL6Mm6b4mneFgmlUg207SsSFptMm+sx5v+7SF Tt5GZA+4yA0NE0MG8TFglNyAMK1XviPOdccWBzhfZgFeSPzU458wxhWlp1JkbEnwUxNE +xXOd1FxP0Z27/WkciBp6/wKitJMR4mOfdMtL9Ywiy2K1gFS8MOa1g/a9pDUfLlLjBbI sP/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fy16si15415861ejb.15.2020.08.18.19.04.40; Tue, 18 Aug 2020 19:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726980AbgHSBf6 (ORCPT + 99 others); Tue, 18 Aug 2020 21:35:58 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:41844 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726367AbgHSBf6 (ORCPT ); Tue, 18 Aug 2020 21:35:58 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D0006D65640004EEF6EB; Wed, 19 Aug 2020 09:35:54 +0800 (CST) Received: from [10.136.114.67] (10.136.114.67) by smtp.huawei.com (10.3.19.214) with Microsoft SMTP Server (TLS) id 14.3.487.0; Wed, 19 Aug 2020 09:35:53 +0800 Subject: Re: [PATCH v2] f2fs: fix indefinite loop scanning for free nid To: Sahitya Tummala , Jaegeuk Kim , CC: References: <1597745414-13135-1-git-send-email-stummala@codeaurora.org> From: Chao Yu Message-ID: Date: Wed, 19 Aug 2020 09:35:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1597745414-13135-1-git-send-email-stummala@codeaurora.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.136.114.67] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/8/18 18:10, Sahitya Tummala wrote: > If the sbi->ckpt->next_free_nid is not NAT block aligned and if there > are free nids in that NAT block between the start of the block and > next_free_nid, then those free nids will not be scanned in scan_nat_page(). > This results into mismatch between nm_i->available_nids and the sum of > nm_i->free_nid_count of all NAT blocks scanned. And nm_i->available_nids > will always be greater than the sum of free nids in all the blocks. > Under this condition, if we use all the currently scanned free nids, > then it will loop forever in f2fs_alloc_nid() as nm_i->available_nids > is still not zero but nm_i->free_nid_count of that partially scanned > NAT block is zero. > > Fix this to align the nm_i->next_scan_nid to the first nid of the > corresponding NAT block. > > Signed-off-by: Sahitya Tummala Reviewed-by: Chao Yu > During CP we update only ckpt->next_free_nid but not > the nm_i->next_free_nid, which is done only once during boot up. Oops, thanks for correcting that... Thanks,