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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 B60CFC433DF for ; Thu, 28 May 2020 16:34:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9489620721 for ; Thu, 28 May 2020 16:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405087AbgE1Qe4 (ORCPT ); Thu, 28 May 2020 12:34:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:60232 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405004AbgE1Qez (ORCPT ); Thu, 28 May 2020 12:34:55 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2AF11AD3A; Thu, 28 May 2020 16:34:53 +0000 (UTC) Date: Thu, 28 May 2020 11:34:50 -0500 From: Goldwyn Rodrigues To: Filipe Manana Cc: Johannes Thumshirn , "linux-btrfs@vger.kernel.org" , "hch@infradead.org" , "dsterba@suse.cz" Subject: Re: [PATCH 4/7] btrfs: Switch to iomap_dio_rw() for dio Message-ID: <20200528163450.uykayisbrn6hfm2z@fiona> References: <20200522123837.1196-1-rgoldwyn@suse.de> <20200522123837.1196-5-rgoldwyn@suse.de> <20200526164428.sirhx6yjsghxpnqt@fiona> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 16:13 28/05, Filipe Manana wrote: > On Tue, May 26, 2020 at 5:47 PM Goldwyn Rodrigues wrote: > > > > On 15:03 26/05, Johannes Thumshirn wrote: > > > Just as a heads up, this one gives me lot's of Page cache invalidation > > > failure prints from dio_warn_stale_pagecache() on btrfs/004 with > > > current misc-next: > > > > > > > > > > [ 23.696400] Page cache invalidation failure on direct I/O. Possible data corruption due to collision with buffered I/O! > > > [ 23.698115] File: /mnt/scratch/bgnoise/p0/f0 PID: 6562 Comm: fsstress > > > > > > I have no idea yet why but I'm investigating. > > > > This is caused because we are trying to release a page when the extent > > has locked the page and release page returns false. > > By "we" you mean what exaclty, a direct IO read, a direct IO write? > > And who locked the extent range before? This is usually locked by a previous buffered write or read. > > That seems alarming to me, specially if it's a direct IO write failing > to invalidate the page cache, since a subsequent buffered read could > get stale data (what's in the page cache), and not what the direct IO > write wrote. > > Can you elaborate more on all those details? The origin of the message is when iomap_dio_rw() tries to invalidate the inode pages, but fails and calls dio_warn_stale_pagecache(). In the vanilla code, generic_file_direct_write() aborts direct writes and returns 0 so that it may fallback to buffered I/O. Perhaps this should be changed in iomap_dio_rw() as well. I will write a patch to accomodate that. -- Goldwyn