Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp243139pxt; Wed, 11 Aug 2021 19:59:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxamVuJEni9qkF1NPWzteIpQ2zlusecpXfeVMmuHSvmmRoCOuaBrFNjoTKM4a6FtlCbahgL X-Received: by 2002:a6b:c895:: with SMTP id y143mr1346138iof.74.1628737148466; Wed, 11 Aug 2021 19:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628737148; cv=none; d=google.com; s=arc-20160816; b=nWJqZg5LjdO9GVBbZNGqm6gIoXWmoL/lU9c+3Frk8wln+2+sKcWC1biA0f8YOAqweO G7pmpDoMwVZYJ3Ig4qIzkFHglauZWbiccAXKxAFXGlRmjHtBr++ZYYTW/dyLw6j4TuMw a93kYw7CdVPQcvjsH5yzfoMhPFb0hr/ELmHzf4XBEpgvXeR3NppdS/G0nIVy0xAx2oRs SxckflBttw3V8P9Ekqi2ppCpqk8K1bz73Rgpze8FUw4ZJNMPAjgDwuGhd7YAnl8r6tpD zGneeqM1EwHMLFehZ8Oya4tyxAxdDdN865WieFGgQBRZGh5MCK4JvgyvD5JD0UP7FtL9 6c5Q== 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 :mime-version:user-agent:date:message-id:from:references:to:subject; bh=9Mbz24TNO7Gub2tHIi6skAq1WJSguE/hScoR0PgzM2w=; b=WoqwT/aXCp9ssdKvx7BxDWNlBrA2aj2hOzRARnxzZe/NYa9aWi6ZXFdFHJivpILCzy UcCPytR4DKjbVaDL5T2pMJ62m/ea0rYv66G/zJ6SFE10Ovr42CvTE06GUjZrH9tlcRro o+l+i7q9geDdmkUdM/CE3I/RC1KFMP5C0SpjRgaiDixnBe4LYQkTQ1magzsp/WsJdV0N NYWPDSEV1Qc+4CHIRr6Vosy51i7N5gEz338O35vqMGfIBxiofoJ0f4xQWEdlMn6usE+L F88XqA0YQv+Dmgpa1KCCr77rURx6NYriWb8lFXxpH0g3GqKkOrxrLviljvu9Dbmgwgpv ZxYw== 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=vivo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si1459589jat.29.2021.08.11.19.58.56; Wed, 11 Aug 2021 19:59:08 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233652AbhHLCzy (ORCPT + 99 others); Wed, 11 Aug 2021 22:55:54 -0400 Received: from mail-m17656.qiye.163.com ([59.111.176.56]:63478 "EHLO mail-m17656.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233640AbhHLCzx (ORCPT ); Wed, 11 Aug 2021 22:55:53 -0400 Received: from [172.25.45.51] (unknown [58.250.176.229]) by mail-m17656.qiye.163.com (Hmail) with ESMTPA id 1A1E6C400FE; Thu, 12 Aug 2021 10:55:25 +0800 (CST) Subject: Re: [f2fs-dev] f2fs do DIO write make file corruption To: Chao Yu , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <5b68208b-fd94-bf4e-fc4b-d79d13abf1c6@vivo.com> <6519b8b7-1eb0-f286-7593-5c5ebbfb5554@kernel.org> <86e53ee7-13b5-5e8e-7c81-acb1736ebc8b@vivo.com> From: Wu Bo Message-ID: Date: Thu, 12 Aug 2021 10:55:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUhPN1dZLVlBSVdZDwkaFQgSH1lBWRpMTh9WSx5DT0pDT05ISx pIVRMBExYaEhckFA4PWVdZFhoPEhUdFFlBWU9LSFVKSktITUpVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NUk6PAw4IT9CLSEhPTFPOQEN IR4aCi1VSlVKTUlDTEhNQklOTUhCVTMWGhIXVRkUVQwOOw0SDRRVGBQWRVlXWRILWUFZTkNVSU5L VUpMTVVJSUJZV1kIAVlBTkpKTjcG X-HM-Tid: 0a7b38492e16da02kuws1a1e6c400fe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/8/11 20:57, Chao Yu 写道: > On 2021/8/11 11:28, Wu Bo wrote: >> >> 在 2021/8/11 11:03, Chao Yu 写道: >>> On 2021/8/11 10:48, Wu Bo wrote: >>>> I use the following command to create a file, the file may got >>>> corruption: >>>>      f2fs_io write 2 0 512 inc_num dio $path >>>> >>>> And when I use bio or to set the chunk size to 1 block, the file is >>>> normal. The commands as following: >>>>      f2fs_io write 2 0 512 inc_num buffered $path >>>>      f2fs_io write 1 0 512 inc_num dio $path >>>> >>>> I find this bug on old kernel version 4.14.117, and not find on version >>>> 4.19.152. So this bug is fixed. Can anyone can tell me which patch >>>> fixed >>>> this bug? >>> >>> Not sure, >>> >>> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.19.y&id=7bae8b6b73e46c307fa355ce086800b7ad6610f8 >>> > > I didn't see this patch in 4.14 stable kernel of mailine, so do you mean > 4.14 kernel > maintained by Android? > > If so, f2fs codes in between 4.14 and 4.19 Android kernel are almost the > same, > see below link: > > https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-stable.git/ > Sorry, it's our old Android project code.So the kernel version may have no reference value. This project code last sync to Android common kernel is: 9f892496fc0b:f2fs: readahead encrypted block during GC[2018-09-05] The code link is: https://android.googlesource.com/kernel/common/+/9f892496fc0b And after that, we applied some fixup patches. > Thanks, > >>> >> >> This patch is applied. The issue occurs when f2fs dio try to preallocate >> multiple blocks and got scattered disk blocks. The log as following: >>         my_f2fs_io-13425 [002] ....   395.583637: el0_irq_naked: >> 1:type:1,ino:40132,off:768,old_blk:0,new_blk:185764 >>         my_f2fs_io-13425 [002] ....   395.583710: el0_irq_naked: >> 1:type:1,ino:40132,off:769,old_blk:0,new_blk:205824 >>         my_f2fs_io-13425 [002] ....   395.583721: f2fs_map_blocks: dev = >> (259,23), ino = 40132, file offset = 768, start blkaddr = 0x2d5a4, len = >> 0x2, err = 0 >>         my_f2fs_io-13425 [002] ....   395.583735: f2fs_map_blocks: dev = >> (259,23), ino = 40132, file offset = 768, start blkaddr = 0x2d5a4, len = >> 0x1, err = 0 >>         my_f2fs_io-13425 [002] ....   395.583741: f2fs_map_blocks: dev = >> (259,23), ino = 40132, file offset = 769, start blkaddr = 0x32400, len = >> 0x1, err = 0 >> >> And if the blocks are continuously, the file data is normal: >>       my_f2fs_io-13425 [002] ....   395.584037: el0_irq_naked: >> 1:type:1,ino:40132,off:770,old_blk:0,new_blk:205825 >>         my_f2fs_io-13425 [002] ....   395.584066: el0_irq_naked: >> 1:type:1,ino:40132,off:771,old_blk:0,new_blk:205826 >>         my_f2fs_io-13425 [002] ....   395.584077: f2fs_map_blocks: dev = >> (259,23), ino = 40132, file offset = 770, start blkaddr = 0x32401, len = >> 0x2, err = 0 >>         my_f2fs_io-13425 [002] ....   395.584091: f2fs_map_blocks: dev = >> (259,23), ino = 40132, file offset = 770, start blkaddr = 0x32401, len = >> 0x2, err = 0 >> >>> >>> Thanks, >>> >>>> >>>> >>>> _______________________________________________ >>>> Linux-f2fs-devel mailing list >>>> Linux-f2fs-devel@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel >>>> >>> >> >> >> _______________________________________________ >> Linux-f2fs-devel mailing list >> Linux-f2fs-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel >> >