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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 8C031C433E9 for ; Wed, 27 Jan 2021 09:15:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50EF920759 for ; Wed, 27 Jan 2021 09:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbhA0JPh (ORCPT ); Wed, 27 Jan 2021 04:15:37 -0500 Received: from mx2.suse.de ([195.135.220.15]:58202 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234658AbhA0JNY (ORCPT ); Wed, 27 Jan 2021 04:13:24 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E08A1AD78; Wed, 27 Jan 2021 09:12:37 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id A78BE1E14C5; Wed, 27 Jan 2021 10:12:37 +0100 (CET) Date: Wed, 27 Jan 2021 10:12:37 +0100 From: Jan Kara To: Jens Axboe Cc: Jan Kara , Maxim Levitsky , linux-fsdevel@vger.kernel.org, "Darrick J. Wong" Subject: Re: [PATCH] bdev: Do not return EBUSY if bdev discard races with write Message-ID: <20210127091237.GA3108@quack2.suse.cz> References: <20210107154034.1490-1-jack@suse.cz> <20210126100215.GA10966@quack2.suse.cz> <29be3d51-43b4-b4eb-66e0-669c517ed830@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29be3d51-43b4-b4eb-66e0-669c517ed830@kernel.dk> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Tue 26-01-21 10:22:56, Jens Axboe wrote: > On 1/26/21 3:02 AM, Jan Kara wrote: > > On Thu 07-01-21 16:40:34, Jan Kara wrote: > >> blkdev_fallocate() tries to detect whether a discard raced with an > >> overlapping write by calling invalidate_inode_pages2_range(). However > >> this check can give both false negatives (when writing using direct IO > >> or when writeback already writes out the written pagecache range) and > >> false positives (when write is not actually overlapping but ends in the > >> same page when blocksize < pagesize). This actually causes issues for > >> qemu which is getting confused by EBUSY errors. > >> > >> Fix the problem by removing this conflicting write detection since it is > >> inherently racy and thus of little use anyway. > >> > >> Reported-by: Maxim Levitsky > >> CC: "Darrick J. Wong" > >> Link: https://lore.kernel.org/qemu-devel/20201111153913.41840-1-mlevitsk@redhat.com > >> Signed-off-by: Jan Kara > > > > Jens, can you please pick up this patch? Thanks! > > Picked it up for 5.12, hope that works. It looks simple enough but not > really meeting criteria for 5.11 at this point. Sure, 5.12 is fine. We've been living with the current behavior for quite some time and not many people complained... Honza -- Jan Kara SUSE Labs, CR