Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp596458ybt; Wed, 8 Jul 2020 07:17:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8EVEwDRJMV60mw9x+ZMSEjf2x2/PL0QzrK5RNI2sEe8PwMmEYXAk5FYDQRCPT2nCG2kzS X-Received: by 2002:a17:906:40d3:: with SMTP id a19mr53782165ejk.474.1594217870775; Wed, 08 Jul 2020 07:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594217870; cv=none; d=google.com; s=arc-20160816; b=Qnih1ghHZbKirrpvFYPw6qFtR9X+JScsG3GT98rWRdZmnKDY2BGtAQWWWnVeJLjZtJ JuFqvPfgMi+T2wqnrrZpDa6k7AXAHNZaavgRB11lJqVGFF/s+n4d3ZAjnaZTX+eSPUJ6 ZIOMpcmxrdi49v5vOaJt6mzkyHHwXA5n28TR/hZYCaa+cqbDQ691+2bM0EuVjP3pRs7U qJNLEoe/vSJiqY5yq+oaftwGzeoj8Omq9EjIbEDWgAC/oO2BfC7VfPA5eGiI0QVz1MHw Z+TGsUeFGdNYrcqLHQsd2j4/an/Ngob7JlB23H4vZNkHci6DPn9eU55ENdZS/dSGba+3 D1dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NlPeIjl5l03xbMHkFI5O/O+d5ldLjUPIk6PfBb/Zwp0=; b=mmX44lksPE5DveQvFx63ww8qqeWpR9cGkckQ/raQjvuNbQaNh/iX3CSyOuSWp8seJZ Ceh0lr5yT1U3EHvsiAizUt14F6m7WP/9+KyPHx6toDlitFlnEpGwCJZ/I6UTaHkx9Rat wwPGcEoGj5ZyU6LEmM8v+IqYnThtET7kS51asrcdPGPFvQRV7h8FeA8jcb/D6kDx3H2i Eh1ar8uAlCIUR1DRQfEK3/R7IoXm9PzUWndf5MANhGd48P45xZ3LXVAxaNGUO5coRZ73 MXeLufOD/B+eH73SOH6ku8jqbyVjkxXhwY4GwtZq7kNnZeLs0ZnhEZHvpgoEbcSQRKLQ hkpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si17325577ejn.680.2020.07.08.07.17.27; Wed, 08 Jul 2020 07:17:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729593AbgGHORI (ORCPT + 99 others); Wed, 8 Jul 2020 10:17:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:37002 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729477AbgGHORI (ORCPT ); Wed, 8 Jul 2020 10:17:08 -0400 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 7B24DAE2D; Wed, 8 Jul 2020 14:17:07 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id D59451E12BF; Wed, 8 Jul 2020 16:17:06 +0200 (CEST) Date: Wed, 8 Jul 2020 16:17:06 +0200 From: Jan Kara To: Filipe Manana Cc: linux-ext4 Subject: Re: RWF_NOWAIT writes not failing when writing to a range with holes Message-ID: <20200708141706.GB5288@quack2.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hi! On Mon 15-06-20 18:53:11, Filipe Manana wrote: > I found out a bug in btrfs where a RWF_NOWRITE does not fail if we > write to a range that starts with an extent followed by holes (since > it requires allocating extent(s)). > > When writing a test case for fstests I noticed xfs fails with -EAGAIN > as expected, but ext4 succeeds just like btrfs currently does: > > mkfs.ext4 -F /dev/sdb > mount /dev/sdb /mnt > > xfs_io -f -d -c "pwrite -S 0xab -b 256K 0 256K" /mnt/bar > xfs_io -c "fpunch 64K 64K" /mnt/bar > sync > xfs_io -d -c "pwrite -N -V 1 -b 128K -S 0xfe 0 128K" /mnt/bar > > Is this a known bug? Or is there a technical reason that makes it too > expensive to check no extents will need to be allocated? Thanks for report! This is actually a fallout of the conversion of ext4 direct IO code to iomap (commit 378f32bab37 "ext4: introduce direct I/O write using iomap infrastructure"). I'll send a fix. Honza -- Jan Kara SUSE Labs, CR