Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp610279pxt; Thu, 12 Aug 2021 05:58:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYBDMzXToEw1T1ov/agFFY3nFIqQv04BzyJzHx5rn/nGJSf+vXNM25MbGIs5ZYBXTrogb8 X-Received: by 2002:a17:906:a382:: with SMTP id k2mr3520408ejz.454.1628773137862; Thu, 12 Aug 2021 05:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628773137; cv=none; d=google.com; s=arc-20160816; b=xyYKDdYuBMVdK1jFcB72Zuz9+xHOc2o+JpU1osDBi1moVniHWRXVfgJCZ2CC8u8Oe3 LBJc9DwaBA/XFLoNchMJysywhe+ZCChNcufFFAyAk4mC0PC2zqzmeSpBVQPrjCfg7Ofb wXLMny2FYt61/pe9JpQg6GsIeF7KJVvsmY0smS7fe2sGH3ZUXyOkIgnuqQFZ/xQbO22i JRp866oyi/ePSG2p7isxbrUqATkrHnXeOMW55nfoWansEeUkNTE8XqhyEHbSUsQgclI9 lrTVS7Tb63EFru9ndBVosGHVUqmD80iExETjgTDcb2kiRdL//cXHfaZ9VmPNngElSvKf iHtQ== 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 :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:dkim-signature; bh=8ZP0BTbARXicISnosfO6HJhYb0b69CuAmBAEbs1b1ZI=; b=XDyDz2Q+DEzvVksKCJHZoURqOBmc5KQ/QRdPgcOcDw0O+1uH2vs4mQVsKNUiT2QD3T E+/8fI7aPvi1XNJ/XEt20Ku175iEzKs9+bTTYwJWiqG97BJSSzRsSHEabIFqOKb/rnl2 pQhpljQEafxVYr7wdgy22s6zLwDdrpZGiuBtA+p3DYuAf98MCYb3WOnHiZSHk/K5yUAE B7nNaOvJCjoxcvQTGEm2+L46ekd2pbRnB8doWUGMsacS47DX5MmqvQr8V9SM8IL5DL8E nPZMHVdrfW1146SZ2AAyg3mo6RQqHlm/YWh++4h0O+B64IG2q3cytKoVLqHQCICZHclI K9Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JtNZuWjG; 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 hq34si2556855ejc.343.2021.08.12.05.58.32; Thu, 12 Aug 2021 05:58:57 -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=JtNZuWjG; 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 S235390AbhHLMSW (ORCPT + 99 others); Thu, 12 Aug 2021 08:18:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:35176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234942AbhHLMSV (ORCPT ); Thu, 12 Aug 2021 08:18:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21C7260FD7; Thu, 12 Aug 2021 12:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628770676; bh=hPO/RgigXZIs0Z1FajHF6364OnjOffqwUiOdt5UM+nY=; h=Subject:To:References:From:Date:In-Reply-To:From; b=JtNZuWjGBG9wnDAVj6jC6VLhI3i3WTJ384vlUBlruCSMI78HFPKISeU0PSHTNSW9Q xgae88WAwRjEVp07Kp4nCI16VqohDclFllFTTDUEscbiStegVFwICiB02csZS4amJd zqfQ3zfYTQfX3mlug0FZgxPS1xxHAyX63FV76wl/IOy3eANjF/Jyem5pgnXtMOaE15 35uFip7/exR/FqjlDPNVFWDKGEz7l+nR6KxKi4cqNEqMSxGfo6qCIDI7f7MrNjjr8Z 1Xo3ceJxiWH3ldQSqt0IbL5/ADzXOWCEFq+7mG4/vWZVVREBpdr7Xf2U4xVtml9a+l i8pLiAjtR9riA== Subject: Re: [f2fs-dev] f2fs do DIO write make file corruption To: Wu Bo , 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: Chao Yu Message-ID: Date: Thu, 12 Aug 2021 20:17:54 +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-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/8/12 10:55, Wu Bo wrote: > > 在 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. I think you can pick up patches from your 4.19 f2fs codes which are not in your 4.14 f2fs codes, and check each patch you picked to see whether there is a patch can fix that problem. Thanks, > >> 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 >>> >>