Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2829338pxu; Mon, 7 Dec 2020 17:31:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmpihp2xXzGO7xioBbW/2ZMzBZovlI/vkZ58x0jtuxicYoydyVFR+CDQmpK6xS9p74F9Ds X-Received: by 2002:a05:6402:312b:: with SMTP id dd11mr23095370edb.308.1607391063201; Mon, 07 Dec 2020 17:31:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607391063; cv=none; d=google.com; s=arc-20160816; b=S80ch8tMXRWUDhGWtqiCKQdhXWFXn5hRcKU7whDJR1ynu01QvZReBh7gMwAxt4d4L/ FVPMT4DiPOD02CHQYC3mG7ETtaecD2GC6s1z6Sl/aFt8soBwwGKvd3KbHTl7K5A1B7Zr Nj32yF79M5odESpunnnKWLzYmirjtTPmg99rdavKCbW2VYx98+min8mvuaVaRQd3M4YO rTDB1QaUqYPoIK/fQuhfbjAxApM4C7fJk6zaLJVlWqsSkVW9KPMczlckTvqXaPYpSfhC 4Jt6C9Y89HGJE/67EA2guGw3Erpp1j7TGx1TVjKlYlwe/o4c+acpvBZWZQcsSE2B0gWm ig0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=zka+vNdRYl/Cn8BWdxR/4B0nEebd3VHj+GCnBZTaz4k=; b=aXSIHBLug/W7HV43kPccGdZ93k9Qg7Fw0o9QsWjkjAEUI+geAR9HusHHParpWkYWZR KUtb6xiAq7cKmX3XlG6Ln1XNtk2LOC/0kdJ0RKgY8fHslDW89Tn/7IRwkzTcvillHtid NH+xQhGkfduItpfD75+eEKhCuXyMbGymI9YhVlLeD/4XX3EPGum1/L+M58It9XXBhHs1 F5UO8DphAwUoIDCzFOF/F+mGiPJrk9h/mMq1x0/yX8TsMJSuS/DRNkoXvf3fUjBet6sq UvxLh4VUc4kT5xzdpdnH9+HrChI0zYp/ihwceLdYKvHrgHvR97wBmkNQFxwISctaXg+I goag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lU3x0KdO; 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 c17si4696055eds.556.2020.12.07.17.30.40; Mon, 07 Dec 2020 17:31:03 -0800 (PST) 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=lU3x0KdO; 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 S1726190AbgLHB0q (ORCPT + 99 others); Mon, 7 Dec 2020 20:26:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:44482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbgLHB0p (ORCPT ); Mon, 7 Dec 2020 20:26:45 -0500 Date: Mon, 7 Dec 2020 17:26:03 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607390765; bh=dKxMYGEJk/qsfEljvMrUx1suvymwSnTOX+Nd8kkjqAU=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=lU3x0KdOCyqLG0bPUqEzQKEK6FINx4Paat/QU4vCgl2l6XPe/G3mIHZEWKXCsLA4S Xqshe2PrpSSIwniVht2EnpD6EZClKo8wjvWa2UItV/0bZUs8JzOAK2wOCkXI203DgZ HOXs8HjeblvoAOT8eovsvqpwgxVtKkcWB5OQRaIyhreM2UmzHagvFmCRjKjTNSQRhG QCcNuRlIBUMz2rv95yJL5nXsain7p73KwTPYy5dgTfmdLSHQDexWIanSZiY81TQNRU JpRT12rSlNmCUuvGaLWWuzkA64nlbB+ol4hIE1pTuwmyLmYx5pWGAImV4Ji21Td/GT dUQg/XZ2sK8IQ== From: Jaegeuk Kim To: Chao Yu Cc: Eric Biggers , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] [PATCH v3] f2fs: compress: support chksum Message-ID: References: <20201126103209.67985-1-yuchao0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/08, Chao Yu wrote: > On 2020/12/8 4:37, Eric Biggers wrote: > > On Thu, Nov 26, 2020 at 06:32:09PM +0800, Chao Yu wrote: > > > + if (!ret && fi->i_compress_flag & 1 << COMPRESS_CHKSUM) { > > > > This really could use some parentheses. People shouldn't have to look up a > > C operator precedence table to understand the code. > > Will add parentheses to avoid misread. > > > > > > + u32 provided = le32_to_cpu(dic->cbuf->chksum); > > > + u32 calculated = f2fs_crc32(sbi, dic->cbuf->cdata, dic->clen); > > > + > > > + if (provided != calculated) { > > > + if (!is_inode_flag_set(dic->inode, FI_COMPRESS_CORRUPT)) { > > > + set_inode_flag(dic->inode, FI_COMPRESS_CORRUPT); > > > + printk_ratelimited( > > > + "%sF2FS-fs (%s): checksum invalid, nid = %lu, %x vs %x", > > > + KERN_INFO, sbi->sb->s_id, dic->inode->i_ino, > > > + provided, calculated); > > > + } > > > + set_sbi_flag(sbi, SBI_NEED_FSCK); > > > + WARN_ON_ONCE(1); > > > > WARN, WARN_ON_ONCE, BUG, BUG_ON, etc. are only for kernel bugs, not for invalid > > inputs from disk or userspace. > > > > There is already a log message printed just above, so it seems this WARN_ON_ONCE > > should just be removed. > > Jaegeuk wants to give WARN_ON and marking a FSCK flag without returning EFSCORRUPTED, I think above printk_ratelimited should be enough. > > Jaegeuk, thoughts? > > Thanks, > > > > > - Eric > > . > >