Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp708669pxj; Fri, 11 Jun 2021 09:28:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3toEPzu54FRZzxFbL9akwGa/H8jjgrBfhtW9JjZInrVsgVP801z7f9xeP1fubSTAklRCR X-Received: by 2002:aa7:cf0d:: with SMTP id a13mr4556165edy.384.1623428926441; Fri, 11 Jun 2021 09:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623428926; cv=none; d=google.com; s=arc-20160816; b=z+eSZ0uYaLmf/d9d/qPzBA6vNQTm9R7B5CiH5pPXMlMImxIM4ottcNgd/SvECBGLBr nZAEbQz+hVJoT3JZxtbGmAYgOK26+TXZvey3Pd2ItKQnupfxCJHX7eAO5sm72ztjZCV2 YaEaMgTqch40v5wphaeEOs0AU36aNF+urevyfbPJOxgYO+ydBrYspIs95Vvr4gg64yKz Jw7H8w1AdlMir1pM7uMqus+UZpsSZMbedGs6HE2v9SUZ6DkS1zcvim4j3z0QmoSPYKUJ KCuq8wUrnZX6uhgQCsfPpHdzmHhvUfFyhfBo7xkqL8S1HhV6xPsKRKA1gB6DSBfNOimZ EGdQ== 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; bh=XwmYxciIEBu53L0g7XSm3KafuGRdK6BkCMweo5dpNjw=; b=eMNHRhygKy79k7X1YlIilcBksS9k7ItRTcOkoqe52vK+XwYZ6+3SU+7zI1lv8gtoQA fkf5L8US3b9XOXjHz/+5oEDkcW1iJagDo9RYn8UamWp5U6XuSQRm1AneAQJKnNEXj3dg 2HBys/sn2pmNXWJ3fzy+nldsVV5XXJY0aNVGStHrijzPnmz0vCvdJs4yxyCnDE40uS8G 5JBWTAQ3TOC1b0HS0B+Y2PlNOHyqWALDS7hzIvMQUVKADcQqNCFZiqzK9PQX5Osds1ED 1fnmwihDkd26Da5IWGL0QpXN1tnF8lf448Z+CY0LbWULH3Tvu5t//I6g3cv6i7SZgFHp JU7A== ARC-Authentication-Results: i=1; mx.google.com; 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 g21si4992736edu.34.2021.06.11.09.28.22; Fri, 11 Jun 2021 09:28:46 -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; 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 S229753AbhFKQ1N (ORCPT + 99 others); Fri, 11 Jun 2021 12:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbhFKQ1N (ORCPT ); Fri, 11 Jun 2021 12:27:13 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24FB0C061574 for ; Fri, 11 Jun 2021 09:25:15 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrjy2-006zhk-Gb; Fri, 11 Jun 2021 16:25:10 +0000 Date: Fri, 11 Jun 2021 16:25:10 +0000 From: Al Viro To: Andreas Gruenbacher Cc: Linus Torvalds , cluster-devel , Linux Kernel Mailing List , Jan Kara , Matthew Wilcox Subject: Re: [RFC 4/9] gfs2: Fix mmap + page fault deadlocks (part 1) Message-ID: References: <20210531170123.243771-1-agruenba@redhat.com> <20210531170123.243771-5-agruenba@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 02, 2021 at 01:16:32PM +0200, Andreas Gruenbacher wrote: > Well, iomap_file_buffered_write() does that by using > iov_iter_fault_in_readable() and iov_iter_copy_from_user_atomic() as > in iomap_write_actor(), but the read and direct I/O side doesn't seem > to have equivalents. I suspect we can't just wrap > generic_file_read_iter() and iomap_dio_rw() calls in > pagefault_disable(). And it will have zero effect on O_DIRECT case, so you get the same deadlocks right back. Because there you hit iomap_dio_bio_actor() bio_iov_iter_get_pages() .... get_user_pages_fast() .... faultin_page() handle_mm_fault() and at no point had CPU hit an exception, so disable_pagefault() will have no effect whatsoever. You can bloody well hit gfs2 readpage/mkwrite if the destination is in mmapped area of some GFS2 file. Do that while holding GFS2 locks and you are fucked. No amount of prefaulting will protect you, BTW - it might make the deadlock harder to reproduce, but that's it.