From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C133C433E0 for ; Tue, 9 Mar 2021 04:02:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D7C816528A for ; Tue, 9 Mar 2021 04:02:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7C816528A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0A3748D00AE; Mon, 8 Mar 2021 23:02:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 02BEF8D007F; Mon, 8 Mar 2021 23:02:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE7A58D00AE; Mon, 8 Mar 2021 23:02:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id BED078D007F for ; Mon, 8 Mar 2021 23:02:26 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7EE6D1730846 for ; Tue, 9 Mar 2021 04:02:26 +0000 (UTC) X-FDA: 77898988692.12.832AFD7 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id 561942000383 for ; Tue, 9 Mar 2021 04:02:26 +0000 (UTC) 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: X-Stat-Signature: ydo649ir61exissxy5634prcp9oyooq5 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 561942000383 Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf18; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615262546-914610 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.