[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210309040144.GH3479805@casper.infradead.org>
Date: Tue, 9 Mar 2021 04:01:44 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Weichao Guo <guoweichao@...o.com>
Cc: rpalethorpe@...e.de, kernel test robot <oliver.sang@...el.com>,
"huangjianan@...o.com" <huangjianan@...o.com>, lkp@...el.com,
Linux Memory Management List <linux-mm@...ck.org>,
Chao Yu <yuchao0@...wei.com>,
LKML <linux-kernel@...r.kernel.org>, lkp@...ts.01.org,
Jaegeuk Kim <jaegeuk@...nel.org>, ltp@...ts.linux.it
Subject: Re: [LTP] [f2fs] 02eb84b96b: ltp.swapon03.fail
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@...o.com <huangjianan@...o.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 <huangjianan@...o.com>
> > > Signed-off-by: Guo Weichao <guoweichao@...o.com>
> > > Reviewed-by: Chao Yu <yuchao0@...wei.com>
> > > Signed-off-by: Jaegeuk Kim <jaegeuk@...nel.org>
> > 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.
Powered by blists - more mailing lists