Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2258682pxb; Mon, 8 Mar 2021 20:04:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwe/9ErJKQiG4YPrcT+Aks60HgusntyowvWYxPYnO2VR1zpSoH+GaBvzP0JFMJOWeZJadNt X-Received: by 2002:a05:6402:1754:: with SMTP id v20mr1803193edx.191.1615262674620; Mon, 08 Mar 2021 20:04:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615262674; cv=none; d=google.com; s=arc-20160816; b=YQXO7UfSWuMt1OUoXA7tqDx7Tbi4crZ+jeKk82PRvpONw/38WEQk4FIa0mxR5ZeDE8 sh86AifEoeWMXoSzeiNmZmq62JwPCLg+HoToKDbiEfSlGI1UOK6347T89o9U9g1leO7r BUPCl+QwGS1Sw6INKSqCMLkpAxEjFreHVCbY3AfqxAncg8JZWDq+b9s3e9TLcW+e8gyN HX3bkf/p4fbpJsY5sRYyUPfTaCjqifidq9MXujZ4C3H2ZLHMZCeIfvB0ATfkRvWv3LV/ hYmDQFWDagTl8wK0bbDR5wuh535Xhwdhbx8YUbS4ewKuTaWtSSfG5JMuMJ60JY26/+h4 uvXw== 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:date:dkim-signature; bh=iM+/dn+YhIAlWAYAVQcoqGr6ZVF7ceWPf6AbVrGnBfA=; b=DxOhzIgVQMeBMjKB881tE6OECE3OILdfw7So4j4fIcb+UWwZWYHJgSmxFKF2Bay3mf W48f7vpoduD2xWyEDhvY5QwyrGsLWG4OTrbsuG0wJk4Y/73k+K+t3Ntx8bhmcSVNEOzP rKD4bne2Zpo3aKJ7EYyJ/bykPsrN7WEp08OPV96t3tpbeQztZcDfMi6QVvniTSI9pk7T KX0246ZV9u4JhNc9NvhK6ahf3Z6ZBDzkJMxkLJQhawlUTh09xhOAUGm/V+9iZqH8mHxq +Nx6DEL7brdh5t8jbNLfFZftgmrlB6UVpbiogkeSBlFouy90xyxe9WA7NTEfpEOpDi2U V/Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OUj945fp; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rn25si4385168ejb.250.2021.03.08.20.04.11; Mon, 08 Mar 2021 20:04:34 -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=@infradead.org header.s=casper.20170209 header.b=OUj945fp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbhCIEDQ (ORCPT + 99 others); Mon, 8 Mar 2021 23:03:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbhCIECj (ORCPT ); Mon, 8 Mar 2021 23:02:39 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F15F2C06174A for ; Mon, 8 Mar 2021 20:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=iM+/dn+YhIAlWAYAVQcoqGr6ZVF7ceWPf6AbVrGnBfA=; b=OUj945fp0c25Ck1x1CORIjI7y6 uxhLXajEd83UoACqAIgCF/aJsafBbA3E/oQxWukhEUctxbGmAFCJxd1UETGApes1n/nBXjkTCOxeF KvlOQzcwbKscc3/4essTpANC3nKPpZBq3Nk5G+zLCmWKBYA1wnh+pkJfOVwsa87mksG4tCv5lMwUo SLh+TtNEb5/W4aJE5T0m4Mf4FlysP1hlG5LPoUJthuk793Ckev5Dr2je4AsMRb1FKF4xOhp3M39TY SAOO61+7sbjuCE8nZyUCAkGdDxur8vlS0cplB9nFuFUgenR3eHzQW3dmWrwiOlScZSRRu7nx5JIvj S0bINp6w==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lJTZ2-00HLCQ-Bk; Tue, 09 Mar 2021 04:01:53 +0000 Date: Tue, 9 Mar 2021 04:01:44 +0000 From: Matthew Wilcox To: Weichao Guo Cc: rpalethorpe@suse.de, kernel test robot , "huangjianan@oppo.com" , lkp@intel.com, Linux Memory Management List , Chao Yu , LKML , lkp@lists.01.org, Jaegeuk Kim , ltp@lists.linux.it Subject: Re: [LTP] [f2fs] 02eb84b96b: ltp.swapon03.fail Message-ID: <20210309040144.GH3479805@casper.infradead.org> References: <20210308072510.GA902@xsang-OptiPlex-9020> <87h7llhnfe.fsf@suse.de> 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 Tue, Mar 09, 2021 at 10:23:35AM +0800, Weichao Guo wrote: > Hi Richard, > > On 2021/3/8 19:53, Richard Palethorpe wrote: > > Hello, > > > > > kern :err : [ 187.461914] F2FS-fs (sda1): Swapfile does not align to section > > > commit 02eb84b96bc1b382dd138bf60724edbefe77b025 > > > Author: huangjianan@oppo.com > > > Date: Mon Mar 1 12:58:44 2021 +0800 > > > f2fs: check if swapfile is section-alligned > > > If the swapfile isn't created by pin and fallocate, it can't be > > > guaranteed section-aligned, so it may be selected by f2fs gc. When > > > gc_pin_file_threshold is reached, the address of swapfile may change, > > > but won't be synchronized to swap_extent, so swap will write to wrong > > > address, which will cause data corruption. > > > Signed-off-by: Huang Jianan > > > Signed-off-by: Guo Weichao > > > Reviewed-by: Chao Yu > > > Signed-off-by: Jaegeuk Kim > > The test uses fallocate to preallocate the swap file and writes zeros to > > it. I'm not sure what pin refers to? > > 'pin' refers to pinned file feature in F2FS, the LBA(Logical Block Address) > of a file is fixed after pinned. Without this operation before fallocate, > the LBA may not align with section(F2FS GC unit), some LBA of the file may > be changed by F2FS GC in some extreme cases. > > For this test case, how about pin the swap file before fallocate for F2FS as > following: > > ioctl(fd, F2FS_IOC_SET_PIN_FILE, true); No special ioctl should be needed. f2fs_swap_activate() should pin the file, just like it converts inline inodes and disables compression.