Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1126806pxa; Thu, 13 Aug 2020 00:53:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtb0Ymq8eM7IvTHVu3o38A0UOTZASmTmsO3XwndQtvwmT8jo1POrfrDID9/WPkJybS5YTr X-Received: by 2002:a17:906:b110:: with SMTP id u16mr3473405ejy.483.1597305193970; Thu, 13 Aug 2020 00:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597305193; cv=none; d=google.com; s=arc-20160816; b=omXfCDDbZ8e9WBbv4N/fRDGp4hSmPW9g8j9mjSQ+OFaD1uO94pk+zEDLnl9WotezTb YWySvAqegskTYiu+k9JeVhZfkgs/rK4Yaz4Ky58drXPugWodlYYIaTSfzehkNGeEWLQJ QppC12AuqOdOgmCocx8c7m7AweZQLznsOnFMAhZG2d9xhd0hFA1p6ASZnttnBYasWmRw nG3G+K1gj/jFepAftiLaya4W3pdiA4M4uSEnqJBDq8mDsTC3p5NaUKs+WAALLf5D0WFC guLGipUDq0hOSOB/vrg5wKd6IOohyeKl8DArDJu0mpZwMJDpZeA2DEgGxHJjpf/iPm1F +F0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=kbfJFqw0BUIJ5TzLMuAPa26O83MFMfq45p0iJLXoQ24=; b=nNyOz5le+BWrHNboJtbC/mtrlCNRGyMGKXQoF7M+wM5/aol00aROvSkOE2GPSkz0kY UHnohWJeSKRekr5h1n+nesspAYTFt2AN8VHTxG1dmG78KZ1AdfO1eEJjNF6elCRY5L95 qN0jmoAW9VGoTm0o+WRJx2M+yXh34vwfAoYCkiylYBB3OE1UDieEa7JJ0Bk89eJy53m7 cZk2f/WZeiaSf3tFMdQxfC/qMU3zWuT2jc/unH2LS4qnUzL070X12UKVwyaX0CffBljj c6hTZyhsWAiY5jkkTuLV7m8fcZylfRL7jqmTzLtNE0aXAexIZn4tXa08lWi7WTe7MrLi exAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=ZAQkkNen; 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 a8si3008023ejx.662.2020.08.13.00.52.51; Thu, 13 Aug 2020 00:53:13 -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=ZAQkkNen; 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 S1726578AbgHMHwT (ORCPT + 99 others); Thu, 13 Aug 2020 03:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbgHMHwR (ORCPT ); Thu, 13 Aug 2020 03:52:17 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34223C061757 for ; Thu, 13 Aug 2020 00:52:17 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id o22so3632176qtt.13 for ; Thu, 13 Aug 2020 00:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=kbfJFqw0BUIJ5TzLMuAPa26O83MFMfq45p0iJLXoQ24=; b=ZAQkkNengTyFVITiU/IeQgQ8HUcxvR/qUzlEP1RkhZ4iS/OOOs5MyjOL3nQ9ZPHooL 2Lm+rlX360bQxFPcvK+ssLbn55/ZstUNPA/IZ46mxJz660/HZNdYyR1dOgo4ohnvMnnB FM7Fk7t4lTwEdO8ewUfwXcSV8fzdb0Q+1cStpUJmN6rjCCECvD05//W62XGFcP5Gt2t5 7/3/h3cAUMoxSh5DXwYOH4jHbFuLuUIpKk5KUxrZox9QeYctu7eizH7U7PvqsVHSX5+p 9lQjmDIlIHqGjLXUQuJQ8nYrrWwq2vjQwsjqY0pG7M/1LYgcCxrtqvNNfZI0rq3HxnJw zZAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=kbfJFqw0BUIJ5TzLMuAPa26O83MFMfq45p0iJLXoQ24=; b=Dfs+ZUdLsWi4KiaQF8CKvqmAFLdlSvO5px0hPst4Wx3iV2tVCXgbjqD923OQSZ65oG uwX6t6HWuxnPDyfUQ270wrpxg1kMexpqBKeovqJBDTq1Ic9ZLsK6bEd2hd23IQKuDMjb glmkF888mZ0TTvxahDGLN+d0RbX2+Y1BHqrkLW3uW6F2eAGnzMEOJY+Zy/Bu1ZtureMq ruQH203Z6mfAiOjVCJNMQ0fIFX5QwcIg+DueV54vZy8xIUZLE9JqWkydGqZUD1ZMsckn WL0DNW7Z7O1CgPINyuzbCaEu8il9z5GPZw2jSLa/uXD2TEjM0TqyaJJ1TCH2Kbt0ZVzU XzQg== X-Gm-Message-State: AOAM533xR2708BA9aY0fs89GeImwtEqShuZyTbs1j8rbe9fkRVd7brXU JA3yO/OIfg7P1FjGSPk2CKpDoEbgXhUP8A== X-Received: by 2002:aed:3e45:: with SMTP id m5mr3655774qtf.210.1597305134863; Thu, 13 Aug 2020 00:52:14 -0700 (PDT) Received: from [192.168.1.183] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id y26sm5348981qto.75.2020.08.13.00.52.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Aug 2020 00:52:14 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Qian Cai Mime-Version: 1.0 (1.0) Subject: Re: WARN_ON_ONCE(1) in iomap_dio_actor() Date: Thu, 13 Aug 2020 03:52:13 -0400 Message-Id: References: <20200813054418.GB3339@dread.disaster.area> Cc: Christoph Hellwig , 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 In-Reply-To: <20200813054418.GB3339@dread.disaster.area> To: Dave Chinner X-Mailer: iPhone Mail (17G68) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Aug 13, 2020, at 1:44 AM, Dave Chinner wrote: >=20 > Ok: >=20 > file.fd_write =3D safe_open("./testfile", O_RDWR|O_CREAT); > .... > file.fd_read =3D safe_open("./testfile", O_RDWR|O_CREAT|O_DIRECT); > .... > file.ptr =3D safe_mmap(NULL, fsize, PROT_READ|PROT_WRITE, MAP_SHARED, > file.fd_write, 0); >=20 > So this is all IO to the same inode.... >=20 > and you loop >=20 > while !done { >=20 > do { > rc =3D pread(file.fd_read, file.ptr + read, fsize - read, > read); > if (rc > 0) > read +=3D rc; > } while (rc > 0); >=20 > rc =3D safe_fallocate(file.fd_write, > FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, > 0, fsize); > } >=20 > On two threads at once? >=20 > So, essentially, you do a DIO read into a mmap()d range from the > same file, with DIO read ascending and the mmap() range descending, > then once that is done you hole punch the file and do it again? >=20 > IOWs, this is a racing page_mkwrite()/DIO read workload, and the > moment the two threads hit the same block of the file with a > DIO read and a page_mkwrite at the same time, it throws a warning. >=20 > Well, that's completely expected behaviour. DIO is not serialised > against mmap() access at all, and so if the page_mkwrite occurs > between the writeback and the iomap_apply() call in the dio path, > then it will see the delalloc block taht the page-mkwrite allocated. >=20 > No sane application would ever do this, it's behaviour as expected, > so I don't think there's anything to care about here. It looks me the kernel warning is trivial to trigger by an non-root user. Sh= ouldn=E2=80=99t we worry a bit because this could be a DoS for systems which= set panic_on_warn?=