Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp594075pxb; Wed, 27 Oct 2021 08:41:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEmFrHWva7tTdde9oU4hE8t8//Ie/cnL0pgTQfxSNyhtn4n0tGqUuSPQ63m97RaTzjSUHT X-Received: by 2002:a63:68c9:: with SMTP id d192mr18431257pgc.335.1635349316807; Wed, 27 Oct 2021 08:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635349316; cv=none; d=google.com; s=arc-20160816; b=DJW4ZFdntCajRD07azb2NwASMCVWy/BmRgBphcyEaBryssnL0UchwDJO0riey/WQq0 VWKnEDd0ux6ZwyqX8Kfyu+vVGBPjyqxLEJ/2Y62O9ddRMiTfM5e69s2Hrvr/s1zimC+u dVtn74CZHSiDT627ZKwJC+8gCfvchDGvTtbF8ozqq52CIq+WwGcWM6INNNeiPTdsVAE6 c2ZcGNJxn9QnuwIytADKryiIToUXgMfEk8C2gC1b8xELOoOaZcm9+1dtpZUYpfEFvZAT Br44yHY/KqI0R54XGFIboMqyD9Ive28S1Yuxa44yue7+F1LbppASqD7bbJf69Nnf30D4 zjbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=zELOuwK6i1O/SaSNqSxfj70rrSL/WFi3T6qmEiKKdgk=; b=IvShdzfqTTM9yU11BEa9IHMFQbAF9NfsIrei7FOyfACVE/rM8g3U/EVawjdmCE8IQd lEgeXcQVvPXJonO3+ed6fTnAs+353jGgqi0rStPXj/EaZja/UVrFfrkNBusUxNaG2ews QkB1OR1z7C+LN/0vB/XEJJgKaY8lc4TaUt6cVGlq/ZRJsdv+p/5Y1kDFrUGp42aGVqxk IIrgmhP2WI7JZaOJcemX6ycAZyz/0txoJLOc944YsJZ9duD3cEra6md0dNTOX46pv9AJ 6PLvrM5F9MToY5J/fmgKkDUFVSjepFcjz7DMdHeUAGKRzedACzpmvHpWzOAugX54OBnY pRRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GJ5SrEFB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r23si235732pls.210.2021.10.27.08.41.13; Wed, 27 Oct 2021 08:41:56 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GJ5SrEFB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235154AbhJ0CWW (ORCPT + 99 others); Tue, 26 Oct 2021 22:22:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:54358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230243AbhJ0CWW (ORCPT ); Tue, 26 Oct 2021 22:22:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD785610A0; Wed, 27 Oct 2021 02:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635301197; bh=6OnS/9NlrXeuVcDWbkkNkhf9wUozNfxWCF5JnO+Sd0g=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GJ5SrEFBopmQPRVZEr3mltDxlkZ7M6MKGEIfehRJYjf+JTh91b0vtQSqksfnqRyrp XlEoR/hKvcbv4VqIL9Ltzc1U7xAXjQB8pqhRcYZLNTdkQtfDILoTcEk87KvGrDvDKp KvtAc1I/0jhuFrynUtoHU0hzWFmgf0dQg5vvfs8Y8/dSqMtaRwGi/oXvescz9pmDDd ccNqCNs8JPQMVIVI0uzkpuPLMVS8o+uUzenZ36B3Vy/Ur1NeYD7vVnvF+ObT+b3BlM kUsDUs7b8WkcHpvamq2dOpbw6otbbmKX8Sm8F0PXPgxnf8w6QKxEouQiXIotZtC7z4 LE3rErfe3gGfg== Message-ID: <4897a06a-9f9e-27ce-91d3-58721bee42ac@kernel.org> Date: Wed, 27 Oct 2021 10:19:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.0.3 Subject: Re: [PATCH] f2fs: fix incorrect return value in f2fs_sanity_check_ckpt() Content-Language: en-US To: jaegeuk@kernel.org, Pavel Machek Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20210922152705.720071-1-chao@kernel.org> <20210924095021.GA16651@duo.ucw.cz> From: Chao Yu In-Reply-To: <20210924095021.GA16651@duo.ucw.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jaegeuk, Missed to apply this patch? Thanks, On 2021/9/24 17:50, Pavel Machek wrote: > Hi! > >> This code looks quite confused: part of function returns 1 on >> corruption, part returns -errno. The problem is not stable-specific. >> >> [1] https://lkml.org/lkml/2021/9/19/207 >> >> Let's fix to make 'insane cp_payload case' to return 1 rater than >> EFSCORRUPTED, so that return value can be kept consistent for all >> error cases, it can avoid confusion of code logic. >> >> Fixes: 65ddf6564843 ("f2fs: fix to do sanity check for sb/cp fields correctly") >> Reported-by: Pavel Machek >> Signed-off-by: Chao Yu > > Reviewed-by: Pavel Machek > > (This is good minimal fix, but eventually I believe the function > should switch to 0/-errno... for consistency with rest of kernel). > > Thank you, > Pavel > >> +++ b/fs/f2fs/super.c >> @@ -3487,7 +3487,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) >> NR_CURSEG_PERSIST_TYPE + nat_bits_blocks >= blocks_per_seg)) { >> f2fs_warn(sbi, "Insane cp_payload: %u, nat_bits_blocks: %u)", >> cp_payload, nat_bits_blocks); >> - return -EFSCORRUPTED; >> + return 1; >> } >> >> if (unlikely(f2fs_cp_error(sbi))) { >