Re: [PATCH] iomap: Set all uptodate bits for an Uptodate page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 27, 2020 at 2:04 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Sun, Sep 27, 2020 at 01:31:15PM +0200, Sedat Dilek wrote:
> > > I would suggest that you try applying just the assertion to Linus'
> > > kernel, then try to make it fire.  Then apply the fix and see if you
> > > can still make the assertion fire.
> > >
> > > FWIW, I got it to fire with generic/095 from the xfstests test suite.
> >
> > With...
> >
> > Linux v5.9-rc6+ up to commit a1bf fa48 745a ("Merge tag 'scsi-fixes'
> > of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi")
> > ...and...
> >
> >  xfstests-dev up to commit 75bd80f900ea ("src/t_mmap_dio: do not build
> > if !HAVE_AIO")
> >
> > ...I have seen in my first run of...
> >
> > [ generic/095 ]
> >
> > dileks@iniza:~/src/xfstests-dev/git$ sudo ./check generic/095
> > FSTYP         -- ext4
>
> There's the first problem in your setup; you need to be checking XFS
> to see this problem.  ext4 doesn't use iomap for buffered IO yet.
>
> > PLATFORM      -- Linux/x86_64 iniza 5.9.0-rc6-7-amd64-clang-cfi
> > #7~bullseye+dileks1 SMP 2020-
> > 09-27
> > MKFS_OPTIONS  -- /dev/sdb1
>
> I'm using "-m reflink=1,rmapbt=1 -i sparse=1 -b size=1024"
>

Sorry, for being pedantic...

With your patch and assertion diff I hit the same issue like with Ext4-FS...

[So Sep 27 15:40:18 2020] run fstests generic/095 at 2020-09-27 15:40:19
[So Sep 27 15:40:26 2020] XFS (sdb1): Mounting V5 Filesystem
[So Sep 27 15:40:26 2020] XFS (sdb1): Ending clean mount
[So Sep 27 15:40:26 2020] xfs filesystem being mounted at /mnt/scratch
supports timestamps until 2038 (0x7fffffff)
[So Sep 27 15:40:28 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:28 2020] File: /mnt/scratch/file1 PID: 12 Comm: kworker/0:1
[So Sep 27 15:40:29 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:29 2020] File: /mnt/scratch/file1 PID: 73 Comm: kworker/0:2
[So Sep 27 15:40:30 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:30 2020] File: /mnt/scratch/file2 PID: 12 Comm: kworker/0:1
[So Sep 27 15:40:30 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:30 2020] File: /mnt/scratch/file2 PID: 3271 Comm: fio
[So Sep 27 15:40:30 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:30 2020] File: /mnt/scratch/file2 PID: 3273 Comm: fio
[So Sep 27 15:40:31 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:31 2020] File: /mnt/scratch/file1 PID: 3308 Comm: fio
[So Sep 27 15:40:36 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:36 2020] File: /mnt/scratch/file1 PID: 73 Comm: kworker/0:2
[So Sep 27 15:40:43 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:43 2020] File: /mnt/scratch/file1 PID: 73 Comm: kworker/0:2
[So Sep 27 15:40:52 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:52 2020] File: /mnt/scratch/file2 PID: 73 Comm: kworker/0:2
[So Sep 27 15:40:56 2020] Page cache invalidation failure on direct
I/O.  Possible data corruption due to collision with buffered I/O!
[So Sep 27 15:40:56 2020] File: /mnt/scratch/file2 PID: 12 Comm: kworker/0:1

Is that a different issue?

- Sedat -

P.S.: Current git diff

dileks@iniza:~/src/linux-kernel/git$ git diff
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index bcfc288dba3f..b421e4efc4bd 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -53,7 +53,10 @@ iomap_page_create(struct inode *inode, struct page *page)
       atomic_set(&iop->read_count, 0);
       atomic_set(&iop->write_count, 0);
       spin_lock_init(&iop->uptodate_lock);
-       bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE);
+       if (PageUptodate(page))
+               bitmap_fill(iop->uptodate, PAGE_SIZE / SECTOR_SIZE);
+       else
+               bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE);

       /*
        * migrate_page_move_mapping() assumes that pages with private data have
@@ -67,11 +70,15 @@ static void
iomap_page_release(struct page *page)
{
       struct iomap_page *iop = detach_page_private(page);
+       unsigned int nr_blocks = PAGE_SIZE / i_blocksize(page->mapping->host);

       if (!iop)
               return;
       WARN_ON_ONCE(atomic_read(&iop->read_count));
       WARN_ON_ONCE(atomic_read(&iop->write_count));
+       WARN_ON_ONCE(bitmap_full(iop->uptodate, nr_blocks) !=
+                       PageUptodate(page));
+
       kfree(iop);
}

- EOT -



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux