Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp401272pxb; Tue, 3 Nov 2020 02:37:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBvRPDVhKb9u4ZLSpRfcHMsY1kcnafYH69YB30IiP551yJuA/E9LA+hYuVoJ2iVR5PctDo X-Received: by 2002:a05:6402:1691:: with SMTP id a17mr20523932edv.264.1604399859776; Tue, 03 Nov 2020 02:37:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604399859; cv=none; d=google.com; s=arc-20160816; b=dDoPoOMBvbS3yBZH8X7MSKehiw3ipP/ulVio8Pg3xJrFAVNvXkaKV8+NsNh9ndXG5b 0m3FGwV4z8003cAxMN01fjaFhiO3ReXk5D1aAIKPFMeQjjdnYy9kHJCNU317HHCOiRlO fqZLwwDrtiddDQJnYMWXpW/VPKhAddjWiRpAeRHsxfnA9WMQgG8snEJEhcMmT63xuvTr IKGd+880wCkxymabAyKMsQsC4Y6GwxiltgkynVaF6HHeJrYQX3UYtU0HaHqmnxw175Hr 6v6iKc/t9YIkIlRighKuHkoKStx98lrfFzSIhJ8OMMEJKK+c8Jcq8yj6HrjJzkCFxfVQ xDhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=/Kx+4ESlvUy/mPitofIGMNf1xf2AfyPYIgAZyCRJjsU=; b=1ET5kejXae8dwKI2qWyZJzpYpIKp3OFcNN46UocAocd6bXRJI0h3OfsDsM0UmXsnyR qqZtOMbYJ1FJ1n8xvuAWTcAs8tJKwjLzRE76dVaRF9wUK9ZC3sGIVu2BVqYvVAQq58ds D/UzC67EIPVHXIVC8o4qJQhnvllCUlb/kDpo2MpCHMvQuFZwxI7Ujocvk+L9QfHBJMnu 3EoBW7IetOJwRI7yJu3O2vVDAvialHeS3eqpS64GnDsJQHTPxpPww68UEdqhf+z4pcVd TYcNpuxM+LpkkCSAvCqkRHL4j35DWYzaaI7j4UmqkHGNJMPzDIuetGbvS6zFhW9vm2xK tr+Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t13si12569295edv.198.2020.11.03.02.37.17; Tue, 03 Nov 2020 02:37:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728134AbgKCKfV convert rfc822-to-8bit (ORCPT + 99 others); Tue, 3 Nov 2020 05:35:21 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:60260 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbgKCKfT (ORCPT ); Tue, 3 Nov 2020 05:35:19 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-233-2rsIwucwNt6IOklb3brp3w-1; Tue, 03 Nov 2020 10:35:14 +0000 X-MC-Unique: 2rsIwucwNt6IOklb3brp3w-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 3 Nov 2020 10:35:13 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 3 Nov 2020 10:35:13 +0000 From: David Laight To: 'Chao Yu' , Jaegeuk Kim CC: "linux-kernel@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" Subject: RE: [f2fs-dev] [PATCH] f2fs: compress: support chksum Thread-Topic: [f2fs-dev] [PATCH] f2fs: compress: support chksum Thread-Index: AQHWsYo6GU/sZ9yvlUirgmcRS3PqXKm2M3MA Date: Tue, 3 Nov 2020 10:35:13 +0000 Message-ID: References: <20201102122333.76667-1-yuchao0@huawei.com> <20201102163123.GD529594@google.com> <756e482c-b638-1c09-3868-ae45d33ed2c2@huawei.com> <6b5bce0e-c967-b9cf-3544-a8e65595059c@huawei.com> In-Reply-To: <6b5bce0e-c967-b9cf-3544-a8e65595059c@huawei.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Yu > Sent: 03 November 2020 02:37 ... > >> Do we need to change fsck.f2fs to recover this? > > However, we don't know which one is correct, compressed data or chksum value? > if compressed data was corrupted, repairing chksum value doesn't help. > > Or how about adding chksum values for both raw data and compressed data. What errors are you trying to detect? If there are errors in the data then 'fixing' the checksum is pointless. (You've got garbage data - might as well not have the checksum). If you are worried about the implementation of the compression algorithm then a checksum of the raw data is needed. If you want to try error correcting burst errors in the compressed data then a crc of the compressed data can be used for error correction. OTOH the most likely error is that the file meta-data and data sector weren't both committed to disk when the system crashed. In which case the checksum has done its job and the file is corrupt. fsck should probably move the file to 'lost+found' for manual checking. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)