Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp620596ybg; Sun, 26 Jul 2020 15:53:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzR3wkVKUeSTvQN9TQYejjexQ5KBcdIdfRP6vVqFSAIqvbcOymtP8jiaCUeKp7hXF/IoRI6 X-Received: by 2002:a17:906:4f82:: with SMTP id o2mr19195834eju.424.1595804015474; Sun, 26 Jul 2020 15:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595804015; cv=none; d=google.com; s=arc-20160816; b=nJLa1ZPRqmOzt9ylgkOARBe9JUHfloqOEnaUvCG0Ng+COI+fN6XhY3CXPn+B/JDNPV xLzsEHQM0mCpbRyJQ26XBhkv8bpGJLN/yCmwdNAvPOWlJ4YBJ0uAMSYQ0gu9faQb2Sjx oorpPXKGongbSZGLjNSGwLkZa5xsPwAds+SWA9V0XVmli5lWhnVNTaBejt3T434P4ygB +eO8cOMMGd5IW8jY388LZ3Dc/ugRSu3h4cqbIVAW5B1bMbEOoLYDYG7tOSiRS1WXw2tB MihZ6kM59sgVbSd3Xbn4vjHvJQS3RXj1BG7QM6tEtTZRfXcjfXg0PNHhxJGpjT2onrdC USCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=8qxqp4Cra7c8Q17ZGNold8rkyaZiozPWBwMAyhGj2zo=; b=kJoeAw1cbzGjJ/veaF1d4HWHOSV1h/hPtAhPzHw3gZx3zr6ef7+1CH0f8IDMG4k/QU 1BFgxeFB1jVrXI35c/5RP9aXReGuvC61Wpejim8rz02h0FAmhNJY6qWgPwYHIt3mVi26 cCld3HYZ49UAfiJYKezkhThk3HEeCZWb23Lp+N0lWJqZo+8u/4G/UCld4KdTFMbbujOJ BXz7ARzkKiQ173R0qilIaDZgvtodAOq+BhfA4GOd4NtfeUfIefD987uC5LHWVdThZCZe DB98YwTfuXYsqxb5ZI/4d3Zy2jjUfjiDd0AU0QZ7Olga8NcTYxYI8vYOA+SK/DzYIeyM hU+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=JkDdmLMl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 s18si4649873edx.6.2020.07.26.15.53.13; Sun, 26 Jul 2020 15:53:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=JkDdmLMl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726082AbgGZWwF (ORCPT + 99 others); Sun, 26 Jul 2020 18:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbgGZWwE (ORCPT ); Sun, 26 Jul 2020 18:52:04 -0400 Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96DB6C0619D2 for ; Sun, 26 Jul 2020 15:52:04 -0700 (PDT) Received: by mail-qv1-xf44.google.com with SMTP id y11so3676930qvl.4 for ; Sun, 26 Jul 2020 15:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8qxqp4Cra7c8Q17ZGNold8rkyaZiozPWBwMAyhGj2zo=; b=JkDdmLMlOOUeQhUCCC15e+gkl4e2eabFhCb9ynbxSm34RgDUqt6M37JmbF9hvf/noi fiFoU3kOcsHOhNWXL74Ui2bXI3vyGhKCRSw9Msvo+e4uuTvycKoym9Lrcs1SiiWKhQcb cuL/ajKCgjMdxo28TW2jfxoifsW/74Pnvjv5+gT1hggLnSYYtgEzIFjz6VNEMMGgp4jx u+YJcX54ih5WlXdreWOiBX7ylgibmQ6QnmdGd2fqoIBXQYAmx6gVcqaa915e3Vsmhp3x LMRhA8A+HoUvA5BsBW/hxJ5UB2PRENXf9ouMF1/xOHDoV/wQpvueF2EdJg23BOyuqG2l Wt7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8qxqp4Cra7c8Q17ZGNold8rkyaZiozPWBwMAyhGj2zo=; b=a89y8jEbF0UIp97+YlKhQ2LHLH1qi9OcdGDrIVJA87ZW2KIeOeBX6GyhlwErU6N4bR 71ZZGOYbfVA94AqJa9Jrg1bI1Xs2nFYO9rZNCLTVX7g3IIEZXbvhHfdIcljT4We6jOue 8a3ndyc5byglLjLWEzTyhxy12rkp7HsCS+E3pLy3donwe/6Uq5dPwCl1TqBIzzh01WHT tHMSw4HjGRbwnFA7BdnOVzwLxGGZqlYnbDwV6RuFaLTB+cKk8D+co4Ze7gp9Kb4X0rDz /qo7uKyr51B6rRX0tDGqrdV8P2pO/o6e3YYGeKsMU+HXQJ1vf7t9lCc2Peqd7pkSfCT/ +b4w== X-Gm-Message-State: AOAM532OAwI2HQCIzw3vQJg0DuZZouN2p74XnH76+z9KUs9XKnhsHGrR 8mSNgFBScyCTRlnXuMz8++Kg0A== X-Received: by 2002:a05:6214:11f3:: with SMTP id e19mr9636442qvu.220.1595803923650; Sun, 26 Jul 2020 15:52:03 -0700 (PDT) Received: from lca.pw (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id p17sm2043556qtn.15.2020.07.26.15.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jul 2020 15:52:02 -0700 (PDT) Date: Sun, 26 Jul 2020 18:51:54 -0400 From: Qian Cai To: Christoph Hellwig Cc: Matthew Wilcox , darrick.wong@oracle.com, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, khlebnikov@yandex-team.ru Subject: Re: WARN_ON_ONCE(1) in iomap_dio_actor() Message-ID: <20200726225154.GA929@lca.pw> References: <20200619211750.GA1027@lca.pw> <20200620001747.GC8681@bombadil.infradead.org> <20200724182431.GA4871@lca.pw> <20200726152412.GA26614@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200726152412.GA26614@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 26, 2020 at 04:24:12PM +0100, Christoph Hellwig wrote: > On Fri, Jul 24, 2020 at 02:24:32PM -0400, Qian Cai wrote: > > On Fri, Jun 19, 2020 at 05:17:47PM -0700, Matthew Wilcox wrote: > > > On Fri, Jun 19, 2020 at 05:17:50PM -0400, Qian Cai wrote: > > > > Running a syscall fuzzer by a normal user could trigger this, > > > > > > > > [55649.329999][T515839] WARNING: CPU: 6 PID: 515839 at fs/iomap/direct-io.c:391 iomap_dio_actor+0x29c/0x420 > > > ... > > > > 371 static loff_t > > > > 372 iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length, > > > > 373 void *data, struct iomap *iomap, struct iomap *srcmap) > > > > 374 { > > > > 375 struct iomap_dio *dio = data; > > > > 376 > > > > 377 switch (iomap->type) { > > > > 378 case IOMAP_HOLE: > > > > 379 if (WARN_ON_ONCE(dio->flags & IOMAP_DIO_WRITE)) > > > > 380 return -EIO; > > > > 381 return iomap_dio_hole_actor(length, dio); > > > > 382 case IOMAP_UNWRITTEN: > > > > 383 if (!(dio->flags & IOMAP_DIO_WRITE)) > > > > 384 return iomap_dio_hole_actor(length, dio); > > > > 385 return iomap_dio_bio_actor(inode, pos, length, dio, iomap); > > > > 386 case IOMAP_MAPPED: > > > > 387 return iomap_dio_bio_actor(inode, pos, length, dio, iomap); > > > > 388 case IOMAP_INLINE: > > > > 389 return iomap_dio_inline_actor(inode, pos, length, dio, iomap); > > > > 390 default: > > > > 391 WARN_ON_ONCE(1); > > > > 392 return -EIO; > > > > 393 } > > > > 394 } > > > > > > > > Could that be iomap->type == IOMAP_DELALLOC ? Looking throught the logs, > > > > it contains a few pread64() calls until this happens, > > > > > > It _shouldn't_ be able to happen. XFS writes back ranges which exist > > > in the page cache upon seeing an O_DIRECT I/O. So it's not supposed to > > > be possible for there to be an extent which is waiting for the contents > > > of the page cache to be written back. > > > > Okay, it is IOMAP_DELALLOC. We have, > > Can you share the fuzzer? If we end up with delalloc space here we > probably need to fix a bug in the cache invalidation code. This is just a wrapper of the trinity fuzzer. # git clone https://gitlab.com/cailca/linux-mm # cd linux-mm; make # ./random -x 0-100 -f https://gitlab.com/cailca/linux-mm/-/blob/master/random.c#L1383